Hello everyone! I need your help in understanding the McCall model graphs (link attached). I used the code shown in the link and I’m off. My problem is that I can’t understand the units of measure used for wages. As I should adapt this model to a real case, is it right to use a w_min = 800 (euro) w_max = 5000 (euro) and c = 600 (euro)?
I would also have another question regarding the second graph shown: on the abscissa we read wages, while on ordinates the value of the function that does not correspond to the wage to be accepted, as I always read it on the x axis when w is greater than w_bar (reservation wage). Right?
Hi @Noemi, thank you very much for your good question. Please let me try to respond one by one.
-
Yes the parameterization you proposed should work. The units of measure could vary depending on the context and the most important thing is to have a consistent measure for w and c.
-
To make it clear, the second graph shows the value of function v defined in equation (4). If the current wage offer (w on the x axis) is above the reservation wage \bar{w}, then the agent will accept and the value is the sum of discounted wage flow. This corresponds to the first term within the maximization bracket in equation (4). Otherwise, the agent stays unemployed and search again in the next period, which corresponds to the second term in the bracket. At each iteration, the kink point gives the reservation wage.
Please let me know if this could be helpful for you.
Hello @shizejin! Thank you very much for your reply, you have been helpful. I have another doubt, I show you the graph (imm python attached) and the values that appear to me both on the abscissas and on the ordinates. In your opinion, do I have too high values for the sum of the discounted wage flow, on the y axis? For example: for a wage of 2400 euros, (in this case it corresponds to the booking salary as it is the intersection between the blue curve and the iterate curve 5) corresponds to a value of the w / 1-beta function equal to 242500. The my real doubt is w / 1-beta is the salary that the agent accepts and therefore will perceive when he will work or only a value that takes on the function to choose whether or not to accept the offer?
Another question: for the betabinomial distribution I inverted the values of a and b, can it be done? because on the model it reports a = 200 and b = 100, I instead placed a = 100 and b = 200, according to you is correct?
Thank you very much for your time.
Hi @Noemi, the value \frac{w}{1 - \beta} corresponds to the sum of discounted wage flow of accepting the current wage offer w and work forever thereafter. This value may seem large to you since we assume agents live infinitely long. If you want to make this value more realistic, you may want to adjust the discount factor \beta (downwards) to account for the probability of death in each period to make people live and work 100 years expectedly for example.
Regarding the second question, yes you are allowed to play with the beta parameters freely as you want.
Please let me know if there is anything else I could help you with
Ciao @shizejin! Thank you again! So he gave me confirmation that it represents value and not wages.
In your opinion, could the values I have given to the salary (x-axis) and the values that I get from the function (y-axis) be fine, considering a real case, or too high? I always refer to the chart attached in the previous post.
Hi @Noemi, this really depends on the context and the research question you are interested in. To the most I could say on this issue, I think your calibration looks fine to me.
Hello @shizejin! I need an help! I would like to do the linear regression for the reservation wage but I cannot understand which array inside the code I have to take and if it is correct to do it in this case. I chose R as an array (I report both the code and the image) but I don’t know if it makes sense. Can you give me some advice?
CODE:
def compute_reservation_wage(c=600,
β=0.99,
w_default=w_default,
ϕ_vals=ϕ_vals,
max_iter=500,
tol=1e-6):
# == First compute the value function == #
v = w_default / (1 - β)
v_next = np.empty_like(v)
i = 0
error = tol + 1
while i < max_iter and error > tol:
for j, w in enumerate(w_default):
stop_val = w / (1 - β)
cont_val = c + β * np.sum(v * ϕ_vals)
v_next[j] = max(stop_val, cont_val)
error = np.max(np.abs(v_next - v))
i += 1
v[:] = v_next # copy contents into v
# == Now compute the reservation wage == #
return (1 - β) * (c + β * np.sum(v * ϕ_vals))
compute_reservation_wage()
grid_size = 25
R = np.empty((grid_size, grid_size))
c_vals = np.linspace(600, 2000, grid_size)
β_vals = np.linspace(0.9, 0.99, grid_size)
for i, c in enumerate(c_vals):
for j, β in enumerate(β_vals):
R[i, j] = compute_reservation_wage(c=c, β=β)
fig, ax = plt.subplots(figsize=(10, 5.7))
cs1 = ax.contourf(c_vals, β_vals, R.T, alpha=0.75)
ctr1 = ax.contour(c_vals, β_vals, R.T)
plt.clabel(ctr1, inline=1, fontsize=13)
plt.colorbar(cs1, ax=ax)
ax.set_title(“reservation wage”)
ax.set_xlabel("c", fontsize=16)
ax.set_ylabel("β", fontsize=16)
ax.ticklabel_format(useOffset=False)
plt.show()
#LINEAR REGRESSION
y=R
fig, ax = plt.subplots(figsize=(9, 6.5))
ax.set_title(“reservation wage”)
ax.set_xlabel(“index”)
ax.set_ylabel(“reservation wage”)
plt.plot(y)
indexStart=0
indexStop=25
x=np.arange(indexStart,indexStop)
z=np.array(x)
results=sm.OLS(y,sm.add_constant(z)).fit()
coefs=results.params
print(coefs)
plt.plot(z,y,‘ro’,label=‘Original Data’)
print(results.summary())
yAp=z*coefs[1]+coefs[0]
print(yAp)
print(‘slope is=’,coefs[1])
plt.plot(z,yAp,label=‘Regression with OLS’)
plt.legend()
It also gives me this type of error:"Axis must be specified when shapes of a and weights "
TypeError: Axis must be specified when shapes of a and weights differ.
This is the figure:
Hi @Noemi, thanks for your interest in the lectures. I know that @shizejin is very busy so him might not have time to keep responding to your questions. Good luck solving them.
Regards, John.
Hi @Noemi, thank you for posting your question. It looks a very serious and interesting research project, but as @john.stachurski mentioned, I hesitate to give an irresponsible answer to your question without spending enough time on investigation due to time constraint. I strongly encourage you to consult with your advisor, ask for help on Stack Overflow, or look at other QuantEcon lectures which might help you with doing econometrics in Python. Good luck with your research project!