Skip to content

Commit 255d027

Browse files
committed
update according to feedback
1 parent 075b0bb commit 255d027

File tree

1 file changed

+8
-9
lines changed

1 file changed

+8
-9
lines changed

lectures/ar1_bayes.md

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -131,15 +131,14 @@ To illustrate the issue, we'll begin by choosing an initial $y_0$ that is far ou
131131
132132
```{code-cell} ipython3
133133
def ar1_simulate(ρ, σ, y0, T, key):
134-
ε = random.normal(key, shape=(T,)) * σ
135-
136-
def scan_fn(y_prev, ε_t):
137-
y_t = ρ * y_prev + ε_t
138-
return y_t, y_t
139-
140-
_, y = lax.scan(scan_fn, y0, ε)
141-
142-
return y
134+
y = [y0]
135+
ε = random.normal(key, (T,)) * σ
136+
137+
for t in range(T):
138+
y_next = ρ * y[-1] + ε[t]
139+
y.append(y_next)
140+
141+
return jnp.array(y)
143142
144143
σ = 1.0
145144
ρ = 0.5

0 commit comments

Comments
 (0)