## Motivation
The motivation for writing a short notebook on the auto-regression
concept is that lots of mathetmatical analysis is applied in the financial
world, on stock prices, valuations etc.

Fundamentally what is not understood very well is that stock prices fluctuate, and not in a random way. Generally there tends to be a **drift** over time, and I'd like to show that this drift is something called stationarity.


## Auto-regression

An auto-regressive, **AR(1)**, process is one that is not always stationary and may contain a unit root. 

For an AR process to be stationary, $ |\rho| < 1 $: 

\begin{align}
    X_{t} &= X_{t-1} + \epsilon_{t}  \\
            &= X_{t-2} + \epsilon_{t-1} + \epsilon_{t} \\
            &= X_{0} + \sum_{i=0}^{t-1} \epsilon_{t-i} 
\end{align}
for $ \epsilon_{t} \sim iid(0,1) $ where $ X_{0}$ is a constant.

Further attributes are as follows:

\begin{align}
            E(X_{t}) &=  E(X_{0}) + E \sum_{i=0}^{t-1} \epsilon_{t-i} \\
                    &= E(X_{0})          
\end{align}
             
since $ \epsilon_{t} \sim iid(0,1) $ and $ \therefore  E(X_{t}) = 0 $, $ Var(\epsilon_{t}) = \sigma^2 $, 
so the random noise has zero mean.

\begin{align}
    Var(X_{t}) &=  \sum_{i=0}^{t-1} Var ( \epsilon_{t-i}) \\
                 &=  t \sigma^2   \\
                 &= f(t)
\end{align}
since $ Var(\epsilon_{t}) = \sigma^2$. Therefore, the variance is a function of time, so it is non-stationary.
\\
Therefore a random walk is a non-stationary time series, it is a function of time. 
There is no covarance ($\epsilon_{t}$ terms) since $\epsilon_{t}$ are 
independent of one another.    

\begin{align}
    Cov(X_{t}, X_{t+h}) &= Cov(X_{t}, X_{t} + \sum_{i=0}^{h-1} \epsilon_{t+h-i} ) \\
            &= Cov(X_{t}, X_{t})
            &= Var(X_{t})
\end{align}
given $X_{t+h} = X_{t} + \sum_{i=0}^{h-1} \epsilon_{t+h-i}$, and since $\epsilon_{t}$ are independent, then $Cov(X_{t}, \epsilon_{t_{k}}) = 0$.

Therefore, a random walk is non-stationary, since the variance 
increases with time, and the covariance also increases with time.

5f27a5e36c38f690d7024406f13af3d16b3502eb
ipynb
Jupyter Notebook
src/jupyter-notebooks/Auto-Regression.ipynb
philip-papasavvas/PythonSkills
7744779314245f23065a36ba0318e21f83b1019b
MIT
2019-09-19T15:36:17.000Z
2019-12-23T11:38:01.000Z
src/jupyter-notebooks/Auto-Regression.ipynb
philip-papasavvas/projects
7744779314245f23065a36ba0318e21f83b1019b
MIT
src/jupyter-notebooks/Auto-Regression.ipynb
philip-papasavvas/projects
7744779314245f23065a36ba0318e21f83b1019b
MIT
2020-11-26T00:00:19.000Z
2022-03-25T01:54:38.000Z
Qwen/Qwen-72B
1. YES
2. YES