diff --git a/lectures/back_prop.md b/lectures/back_prop.md index 82787db44..0b8ab96eb 100644 --- a/lectures/back_prop.md +++ b/lectures/back_prop.md @@ -492,8 +492,8 @@ key = random.key(0) def train(params, grid, f_val, key, num_epochs=300): for epoch in range(num_epochs): - key, _ = random.split(key) - random_permutation = random.permutation(random.key(1), indices) + key, subkey = random.split(key) + random_permutation = random.permutation(subkey, indices) for x, y in zip(grid[random_permutation], f_val[random_permutation]): params = update_la(params, x, y) diff --git a/lectures/endogenous_lake.md b/lectures/endogenous_lake.md index 526352cdb..f8f48b90b 100644 --- a/lectures/endogenous_lake.md +++ b/lectures/endogenous_lake.md @@ -335,8 +335,8 @@ mcm = create_mccall_model(w_vec=w_vec, p_vec=p_vec) V, U = solve_mccall_model(mcm) w_idx = jnp.searchsorted(V - U, 0) w_bar = jnp.where(w_idx == len(V), jnp.inf, mcm.w_vec[w_idx]) -λ = mcm.γ * jnp.sum(p_vec * (w_vec > w_bar)) -print(f"Job finding rate at default paramters ={λ}.") +λ = mcm.γ * jnp.sum(p_vec * (w_vec >= w_bar)) +print(f"Job finding rate at default parameters ={λ}.") ``` @@ -461,7 +461,7 @@ def compute_optimal_quantities( w_bar = jnp.where(w_idx == len(V), jnp.inf, mcm.w_vec[w_idx]) # Compute job finding rate - λ = economy.γ * jnp.sum(p_vec * (w_vec - τ > w_bar)) + λ = economy.γ * jnp.sum(p_vec * (w_vec - τ >= w_bar)) return w_bar, λ, V, U ``` @@ -493,7 +493,7 @@ def compute_steady_state_quantities( u, e = rate_steady_state(model) # Compute expected lifetime value conditional on being employed. - mask = (w_vec - τ > w_bar) + mask = (w_vec - τ >= w_bar) w = jnp.sum(V * p_vec * mask) / jnp.sum(p_vec * mask) # Compute steady state welfare. welfare = e * w + u * U diff --git a/lectures/multi_hyper.md b/lectures/multi_hyper.md index c3ba57470..cb5351dc0 100644 --- a/lectures/multi_hyper.md +++ b/lectures/multi_hyper.md @@ -389,7 +389,7 @@ def bivariate_normal(x, y, μ, Σ, i, j): ```{code-cell} ipython3 @jit def count(vec1, vec2, n): - size = sample.shape[0] + size = vec1.shape[0] count_mat = np.zeros((n+1, n+1)) for i in prange(size): diff --git a/lectures/stats_examples.md b/lectures/stats_examples.md index 8a1e5cccc..025cd1939 100644 --- a/lectures/stats_examples.md +++ b/lectures/stats_examples.md @@ -118,8 +118,8 @@ We compute the mean and variance to be $$ \begin{aligned} -\mathbb{E}(X) & = \frac{k(1-p)}{p} \\ -\mathbb{V}(X) & = \frac{k(1-p)}{p^2} +\mathbb{E}(X) & = \frac{r(1-p)}{p} \\ +\mathbb{V}(X) & = \frac{r(1-p)}{p^2} \end{aligned} $$