Closed lindapelzer closed 3 years ago
The first question regarding the moral hazard section is about the vector w. I defined it as w = [10,20] as w=[w_a,w_g] gave me the error that w_a is not defined. Are we supposed to define the numbers ourselves?
You do not have to define the vector at all; except for specifying initial values when maximizing profits.
I guess the problem starts when defining the function q_choice
. The definition that I use is:
def q_choice(w,ability): # w = [w_a,w_g]
choice = optimize.fminbound(lambda x: -(q_g(x,ability)*w[1] + x*w[0]),0,1,disp=0) #note the minus sign in front of the lambda function
return choice
Hence, the function simply works with the vector w
.
The second question is about the last part of that section where you have to use the banks optimization problem to find the q chosen by a worker. I only changed the bank optimal choice and kept the rest same (q_choice and contract): def bank_choices_1(ability): opt_w_1 = optimize.fmin(lambda q: -((qy_a)+(ability(1-q)(1+q)y_g)+((1-q-ability(1-q)(1+q))*y_b)),initial_guess, disp=0) return [opt_w_1,q_choice(opt_w_1,ability)]
I don't know if this is the correct way to go?
I am not sure why you would like to define the function bank_choices
again. Why not use the one that is given?
Besides, I used a graph to check the outcome (already with outside option of 1, the graph returned to an outcome of -1). However, is there another way you can immediately see the outcome without drawing the graph?
Can you try again with the function q_choice
above? With outside options up to 2 (probably 2.3), the function should return an optimal q
. Only for outside options above 2.3 does the function return -1.
Does this help?
First question, yes. Second question, no. In the notebook, you pre-defined bank_choices() and contract() and from those definitions + q_choice. After that, you ask us to create a graph, which indeed returns what you described.
So this part now works?
I read the assignment again and understand now that the second part of the moral hazard only part is going through the code analytically. However, I do not really know what is asked from us then with: "Use the equation for 𝑞 above to find the 𝑞 chosen by a worker facing a bonus contract with 𝑤𝑎,𝑤𝑔." as basically it has been found in the graph before right?
Ah, I can see that this is confusing. Indeed, we ask you to repeat analytically what you just derived using python. The reason is that we want to use the analytical expression in the next section on moral hazard and adverse selection.
The first order condition for $q$ for the bank gives an optimal $q$ in terms of $y_g,y_a,y_b$. To use this same expression to calculate the worker's optimal $q$ we substitute $w_g$ for $y_g$, $w_a$ for $y_a$ and we already know that $w_b =0$.
You should be able to derive something like $q=w_a/(2 \alpha w_g)$.
Hi,
The first question regarding the moral hazard section is about the vector w. I defined it as w = [10,20] as w=[w_a,w_g] gave me the error that w_a is not defined. Are we supposed to define the numbers ourselves?
The second question is about the last part of that section where you have to use the banks optimization problem to find the q chosen by a worker. I only changed the bank optimal choice and kept the rest same (q_choice and contract): def bank_choices_1(ability): opt_w_1 = optimize.fmin(lambda q: -((qy_a)+(ability(1-q)(1+q)y_g)+((1-q-ability(1-q)(1+q))*y_b)),initial_guess, disp=0) return [opt_w_1,q_choice(opt_w_1,ability)]
I don't know if this is the correct way to go?
Besides, I used a graph to check the outcome (already with outside option of 1, the graph returned to an outcome of -1). However, is there another way you can immediately see the outcome without drawing the graph?