Suppose we have following AR(1) model (autoregressive model of order 1) defined by: $$X_{t+1}=aX_t + b+ cW_{t+1}$$ where

• $$X_0$$ and $$W_{t}$$ are independent,
• [a,b,c] are scalar-valued parameters,
• the state space is $$\mathbb{R}$$,
• the process $$W_{t}$$ is independently distributed and standard normal, and
• initial condition $$X_0$$ is drawn from the normal distribution of mean $$\mu_0$$ and standard error of $$\nu_0$$.

Iterating backward from time $$t$$, we have $$X_t = a^tX_0 + b \sum_{j=0}^{t-1}a^j + c\sum_{j=0}^{t-1}a^jW_{t-j},$$ which implies that $$X_t$$ depends on parameter [a,b,c], initial condition $$X_0$$, and the sequence of shocks from period 1 throughout t represented by $$W_1, \cdots, W_t$$.

Let $$\mu_t$$ and $$\nu_t$$ denote the mean and variance of $$X_t$$. Then we can trace out the sequence of distributions $${\psi_t}$$ corresponding to the time series $$X_t$$.

$$\psi_t=N(\mu_t, \nu_t)$$ where $$\mu_{t+1}=a\mu_t + b \newline \nu_{t+1} = a^2 \nu_t + c^2.$$

The following code excerpts are from julia.quantecon.org.

"""
plot_density_seq
in:
mu_0=-3.0
v_0=0.6
sim_length=60
during:
update mu
update v
plot normal distribution with updated mu and v
out:
accumulated plots
"""
function plot_density_seq(mu_0=-3.0, v_0=0.6; sim_length=60)
mu = mu_0
v = v_0
plt = plot()
for t in 1:sim_length
mu = a * mu + b
v = a^2 * v + c^2
dist = Normal(mu, sqrt(v))
plot!(plt, x_grid, pdf.(dist, x_grid), label=nothing, linealpha=0.5)
end
return plt
end
plot_density_seq()
plot_density_seq(3.0)


Note that regardless of the starting $$\mu$$, the $$\psi$$distribution seems to be converging to some limiting distribution. (stationarity) This is true when $$|a|<1$$.

## Reference#

https://julia.quantecon.org/introduction_dynamics/ar1_processes.html