From fac9a2f31f72109238039b6e0ed55013a4b31d10 Mon Sep 17 00:00:00 2001 From: JingkunZhao <155940781+SylviaZhaooo@users.noreply.github.com> Date: Thu, 11 Jul 2024 09:23:45 +1000 Subject: [PATCH] [AR1] Update unfinished suggestions (#513) * [AR1] Update unfinished suggestions * Update ar1_processes.md * misc --------- Co-authored-by: John Stachurski --- lectures/ar1_processes.md | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/lectures/ar1_processes.md b/lectures/ar1_processes.md index 3df2c113..90cc0514 100644 --- a/lectures/ar1_processes.md +++ b/lectures/ar1_processes.md @@ -48,7 +48,7 @@ plt.rcParams["figure.figsize"] = (11, 5) #set default figure size ## The AR(1) model -The *AR(1) model* (autoregressive model of order 1) takes the form +The **AR(1) model** (autoregressive model of order 1) takes the form ```{math} :label: can_ar1 @@ -56,7 +56,9 @@ The *AR(1) model* (autoregressive model of order 1) takes the form X_{t+1} = a X_t + b + c W_{t+1} ``` -where $a, b, c$ are scalar-valued parameters. +where $a, b, c$ are scalar-valued parameters + +(Equation {eq}`can_ar1` is sometimes called a **stochastic difference equation**.) For example, $X_t$ might be @@ -88,6 +90,7 @@ Iterating backwards from time $t$, we obtain $$ X_t = a X_{t-1} + b + c W_t = a^2 X_{t-2} + a b + a c W_{t-1} + b + c W_t + = a^3 X_{t-3} + a^2 b + a^2 c W_{t-2} + b + c W_t = \cdots $$ @@ -200,7 +203,7 @@ Notice that, in the figure above, the sequence $\{ \psi_t \}$ seems to be conver This is even clearer if we project forward further into the future: ```{code-cell} python3 -def plot_density_seq(ax, mu_0=-3.0, v_0=0.6, sim_length=60): +def plot_density_seq(ax, mu_0=-3.0, v_0=0.6, sim_length=40): mu, v = mu_0, v_0 for t in range(sim_length): mu = a * mu + b @@ -220,7 +223,7 @@ For example, this alternative density sequence also converges to the same limit. ```{code-cell} python3 fig, ax = plt.subplots() -plot_density_seq(ax, mu_0=3.0) +plot_density_seq(ax, mu_0=4.0) plt.show() ``` @@ -255,7 +258,7 @@ We can confirm this is valid for the sequence above using the following code. ```{code-cell} python3 fig, ax = plt.subplots() -plot_density_seq(ax, mu_0=3.0) +plot_density_seq(ax, mu_0=4.0) mu_star = b / (1 - a) std_star = np.sqrt(c**2 / (1 - a**2)) # square root of v_star