diff --git a/lectures/mccall_model.md b/lectures/mccall_model.md index e41c2d0a0..37ede1e4a 100644 --- a/lectures/mccall_model.md +++ b/lectures/mccall_model.md @@ -404,7 +404,7 @@ class McCallModel: # Evaluate value for each state-action pair # Consider action = accept or reject the current offer accept = w[i] / (1 - β) - reject = c + β * np.sum(v * q) + reject = c + β * (v @ q) return np.array([accept, reject]) ``` @@ -488,7 +488,7 @@ def compute_reservation_wage(mcm, # == Now compute the reservation wage == # - return (1 - β) * (c + β * np.sum(v * q)) + return (1 - β) * (c + β * (v @ q)) ``` The next line computes the reservation wage at default parameters @@ -622,13 +622,13 @@ def compute_reservation_wage_two(mcm, # == First compute h == # - h = np.sum(w * q) / (1 - β) + h = (w @ q) / (1 - β) i = 0 error = tol + 1 while i < max_iter and error > tol: s = np.maximum(w / (1 - β), h) - h_next = c + β * np.sum(s * q) + h_next = c + β * (s @ q) error = np.abs(h_next - h) i += 1