Contact
CoCalc Logo Icon
StoreFeaturesDocsShareSupport News AboutSign UpSign In
| Download
Project: midterm
Views: 540
Kernel: SageMath (stable)

This worksheet will illustrate all the calculations in the directed search reading for the case where there is complete information.  The first is the basic equation

πw1/2+(1π)w1=πw2+(1π)w2/2\pi w_1 /2+(1-\pi)w_1=\pi w_2+(1-\pi)w_2 /2

The solution to this equation makes both workers indfferent about whether they apply to firm 1 or firm 2.

var('pi,w_1,w_2') eq1 = pi*w_1/2+(1-pi)*w_1 == pi*w_2+(1-pi)*w_2/2 prob = solve(eq1,pi) show(prob)

If your formula is right, then the solution should be 1/21/2 when the wages are the same.

show(solve(eq1.substitute(w_1=w_2),pi))

We now need access to the first solution to π\pi.  To find it, you treat the solution as if it were an array because most equations have more than one solution.  In this case, there is only one solution, so we use element 00.  You can substitute this into other equations.

We'll do this by definining the profit function of firm 1.  This profit is given by

(1(1π)2)(y1w1)(1-(1-\pi)^2)(y_1-w_1)

as we discussed in class.

 

We can also take the derivative of this profit function to try to find the best reply function.

var('y_1,y_2') Profit = ((1-(1-prob[0])^2))*(y_1-w_1) show(Profit) der = Profit.derivative(w_1) show(der)

Now use the right hand side of the derivative and set it to zero, then solve for w1w_1.

eq2 = der.rhs() == 0 show(eq2) br = solve(eq2,w_1) show(br) show(br[0])

Now we can do a very similar thing for firm 22.

Prof_2 = ((1-(prob[0])^2))*(y_2-w_2) show(Prof_2) der_2 = Prof_2.derivative(w_2) show(der_2)

Again, we can find the best reply function for firm 2 by finding the value for w2w_2 for each value of w1w_1 that makes the derivative zero.

eq3 = der_2.rhs() == 0 show(eq3) br_2 = solve(eq3,w_1) show(br_2) show(br_2[1])

Notice that when I 'solved' the first order condition, instead of solving for w2w_2, which would tell us firm 2's best reply to each w1w_1, I solved for w1w_1. What that gives is the inverse of firm 2's best reply function (for each w2w_2, it gives the value for w1w_1 such that w2w_2 is a best reply.) This ensures that it provides the curve as the inverse image as we did for the picture we drew in class.

In the next step we'll just plot the two best reply functions to look for their intersection. To do this, I substitute the value y1=1y_1 =1 and w2=34w_2 = \frac{3}{4}, so that firm 2 is less productive. The equilibrium should then have the property that the equilibrium wage for firm 2 is less than it is for firm 1. To help show this, I also draw the 45o45^o line (w1=w2w_1 = w_2). As you can see, the point where the lines cross has w1>w2w_1 > w_2.

Notice that there were two solutions for the best reply function, and that I used the second one. Make sure you check what happens when you use the first solution instead.

plot(br[0].rhs().substitute(y_1=1),(w_2,0,1),color="red")+plot(br_2[1].rhs().substitute(y_2=3/4),(w_2,0,1),color="green")+plot(w_2,(w_2,0,1),color="black",linestyle='dashed')
WARNING: Some output was deleted.

As a last step, find the equilibrium by finding the wage that is a best reply to itself.  What that means is that both firms will be best replying to the other firm if they both use this wage.

The inverse function has a square root in it, which will make finding an algebraic solution difficult (if you try it, you'll get an implicit solution). So instead, we'll calculate the intersection point using numerical methods. Just to make sure, we can solve the numerical equation again for the case where y1=y2=1y_1 = y_2 = 1 in which case we already know from previous calculations that w1w_1 and w2w_2 should both be equal to 12\frac{1}{2}. That will give a simple check that our coding is correct.

show(br[0].rhs().substitute(y_1=1)) show(br_2[1].rhs().substitute(y_2=(3/4))) eq4 = br[0].rhs().substitute(y_1=1) == br_2[1].rhs().substitute(y_2=(3/4)) show(eq4.find_root(.2,1)) eq5 = br[0].rhs().substitute(y_1=1) == br_2[1].rhs().substitute(y_2=1) show(eq5.find_root(.2,1))

Notice that the root of the second equation is pretty close to .5.