You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am getting returns for Q5 but it appears to be incorrect. I worked through the logic/structure during office hours, but still running into issues. Do you have any suggestions? Thanks!
state_vals = np.linspace(11, 39, 29)
P = []
for i in range(29):
probs = np.zeros(29)
if i == 0:
probs[0] = 0.5
probs[1] = 0.5
elif i == 28:
probs[28] = 0.5
probs[27] = 0.5
else:
probs[i] = 0.5
probs[i-1] = 0.25
probs[i+1] = 0.25
P.append(probs)
P = np.array(P)
def compute_rwage(c=15, w_vals=state_vals, beta=0.9, max_iter = 10000, tol = 1e-5, n=1000):
#w = 10 # starting val
v = w_vals / (1 - beta)
v_next = np.empty_like(v)
i = 0
error = tol + 1
while error > tol and i < max_iter:
for j, w in enumerate(w_vals):
stop_val = w / (1 - beta)
p_vals = P[i,:]
exp_val = c + beta * np.sum(v * p_vals)
v_next = max(stop_val, exp_val)
error = np.max(np.abs(v_next - v))
i += 1
v = v_next
reservation_wages = np.empty_like(w_vals)
for i, val in enumerate(w_vals):
p_vals = P[:,i]
reservation_wages[i] = (1 - beta) * c + beta * np.sum(v * p_vals)
return reservation_wages, v
result:
The text was updated successfully, but these errors were encountered:
I am getting returns for Q5 but it appears to be incorrect. I worked through the logic/structure during office hours, but still running into issues. Do you have any suggestions? Thanks!
result:
![e](https://user-images.githubusercontent.com/32854361/58601860-506fa780-8250-11e9-8354-622e3e28c4b2.PNG)
The text was updated successfully, but these errors were encountered: