From 0d2647d0be2a12d3d62c48eb02757f4bcee24286 Mon Sep 17 00:00:00 2001 From: mmcky Date: Thu, 14 Dec 2023 12:14:21 +1100 Subject: [PATCH] REPLICA: PR 149 for testing --- lectures/arellano.md | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/lectures/arellano.md b/lectures/arellano.md index abf99f38..df2fe239 100644 --- a/lectures/arellano.md +++ b/lectures/arellano.md @@ -421,8 +421,7 @@ def compute_q(v_c, v_d, q, params, arrays): for B_idx in range(len(B_grid)): for y_idx in range(len(y_grid)): # Compute default probability and corresponding bond price - default_states = 1.0 * (v_c[B_idx, :] < v_d) - delta = np.dot(default_states, P[y_idx, :]) + delta = P[y_idx, v_c[B_idx, :] < v_d].sum() q[B_idx, y_idx] = (1 - delta ) / (1 + r) ``` @@ -769,8 +768,7 @@ zz = np.empty_like(v_c) for B_idx in range(B_grid_size): for y_idx in range(y_grid_size): - default_states = 1.0 * (v_c[B_idx, :] < v_d) - zz[B_idx, y_idx] = np.dot(default_states, P[y_idx, :]) + zz[B_idx, y_idx] = P[y_idx, v_c[B_idx, :] < v_d].sum() # Create figure fig, ax = plt.subplots(figsize=(10, 6.5))