Skip to content

Commit 7928fbe

Browse files
committed
[equalizing_difference] Add an exercise
1 parent 9f4238c commit 7928fbe

File tree

1 file changed

+97
-80
lines changed

1 file changed

+97
-80
lines changed

lectures/equalizing_difference.md

Lines changed: 97 additions & 80 deletions
Original file line numberDiff line numberDiff line change
@@ -276,86 +276,6 @@ plt.ylabel(r'wage gap')
276276
plt.show()
277277
```
278278
279-
## Entrepreneur-worker interpretation
280-
281-
We can add a parameter and reinterpret variables to get a model of entrepreneurs versus workers.
282-
283-
We now let $h$ be the present value of a "worker".
284-
285-
We define the present value of an entrepreneur to be
286-
287-
$$
288-
c_0 = \pi \sum_{t=4}^T R^{-t} w_t^c
289-
$$
290-
291-
where $\pi \in (0,1) $ is the probability that an entrepreneur's "project" succeeds.
292-
293-
For our model of workers and firms, we'll interpret $D$ as the cost of becoming an entrepreneur.
294-
295-
This cost might include costs of hiring workers, office space, and lawyers.
296-
297-
What we used to call the college, high school wage gap $\phi$ now becomes the ratio
298-
of a successful entrepreneur's earnings to a worker's earnings.
299-
300-
We'll find that as $\pi$ decreases, $\phi$ increases, indicating that the riskier it is to
301-
be an entrepreuner, the higher must be the reward for a successful project.
302-
303-
Now let's adopt the entrepreneur-worker interpretation of our model
304-
305-
```{code-cell} ipython3
306-
# Define a model of entrepreneur-worker interpretation
307-
EqDiffModel = namedtuple('EqDiffModel', 'R T γ_h γ_c w_h0 D π')
308-
309-
def create_edm_π(R=1.05, # gross rate of return
310-
T=40, # time horizon
311-
γ_h=1.01, # high-school wage growth
312-
γ_c=1.01, # college wage growth
313-
w_h0=1, # initial wage (high school)
314-
D=10, # cost for college
315-
π=0 # chance of business success
316-
):
317-
318-
return EqDiffModel(R, T, γ_h, γ_c, w_h0, D, π)
319-
320-
321-
def compute_gap(model):
322-
R, T, γ_h, γ_c, w_h0, D, π = model
323-
324-
A_h = (1 - (γ_h/R)**(T+1)) / (1 - γ_h/R)
325-
A_c = (1 - (γ_c/R)**(T-3)) / (1 - γ_c/R) * (γ_c/R)**4
326-
327-
# Incorprate chance of success
328-
A_c = π * A_c
329-
330-
ϕ = A_h / A_c + D / (w_h0 * A_c)
331-
return ϕ
332-
```
333-
334-
If the probability that a new business succeeds is $0.2$, let's compute the initial wage premium for successful entrepreneurs.
335-
336-
```{code-cell} ipython3
337-
ex3 = create_edm_π(π=0.2)
338-
gap3 = compute_gap(ex3)
339-
340-
gap3
341-
```
342-
343-
Now let's study how the initial wage premium for successful entrepreneurs depend on the success probability.
344-
345-
```{code-cell} ipython3
346-
π_arr = np.linspace(0.2, 1, 50)
347-
models = [create_edm_π(π=π) for π in π_arr]
348-
gaps = [compute_gap(model) for model in models]
349-
350-
plt.plot(π_arr, gaps)
351-
plt.ylabel(r'wage gap')
352-
plt.xlabel(r'$\pi$')
353-
plt.show()
354-
```
355-
356-
Does the graph make sense to you?
357-
358-
359279
360280
## An application of calculus
361281
@@ -488,3 +408,100 @@ Let's compute $\frac{\partial \phi}{\partial R}$ and evaluate it numerically at
488408
```
489409
490410
We find that raising the gross interest rate $R$ increases the initial college wage premium $\phi$, in line with our earlier graphical analysis.
411+
412+
413+
## Exercise
414+
```{exercise-start}
415+
:label: edm_ex1
416+
```
417+
In this exercise, We can add a parameter and reinterpret variables to get a model of entrepreneurs versus workers.
418+
419+
We now let $h$ be the present value of a "worker".
420+
421+
We define the present value of an entrepreneur to be
422+
423+
$$
424+
c_0 = \pi \sum_{t=4}^T R^{-t} w_t^c
425+
$$
426+
427+
where $\pi \in (0,1) $ is the probability that an entrepreneur's "project" succeeds.
428+
429+
For our model of workers and firms, we'll interpret $D$ as the cost of becoming an entrepreneur.
430+
431+
This cost might include costs of hiring workers, office space, and lawyers.
432+
433+
What we used to call the college, high school wage gap $\phi$ now becomes the ratio
434+
of a successful entrepreneur's earnings to a worker's earnings.
435+
436+
We'll find that as $\pi$ decreases, $\phi$ increases, indicating that the riskier it is to
437+
be an entrepreuner, the higher must be the reward for a successful project.
438+
439+
Now adopt the entrepreneur-worker interpretation of our model.
440+
441+
```{exercise-end}
442+
```
443+
444+
```{solution-start} edm_ex1
445+
:class: dropdown
446+
```
447+
448+
Here is one solution
449+
450+
```{code-cell} ipython3
451+
# Define a model of entrepreneur-worker interpretation
452+
EqDiffModel = namedtuple('EqDiffModel', 'R T γ_h γ_c w_h0 D π')
453+
454+
def create_edm_π(R=1.05, # gross rate of return
455+
T=40, # time horizon
456+
γ_h=1.01, # high-school wage growth
457+
γ_c=1.01, # college wage growth
458+
w_h0=1, # initial wage (high school)
459+
D=10, # cost for college
460+
π=0 # chance of business success
461+
):
462+
463+
return EqDiffModel(R, T, γ_h, γ_c, w_h0, D, π)
464+
465+
466+
def compute_gap(model):
467+
R, T, γ_h, γ_c, w_h0, D, π = model
468+
469+
A_h = (1 - (γ_h/R)**(T+1)) / (1 - γ_h/R)
470+
A_c = (1 - (γ_c/R)**(T-3)) / (1 - γ_c/R) * (γ_c/R)**4
471+
472+
# Incorprate chance of success
473+
A_c = π * A_c
474+
475+
ϕ = A_h / A_c + D / (w_h0 * A_c)
476+
return ϕ
477+
```
478+
479+
If the probability that a new business succeeds is $0.2$, let's compute the initial wage premium for successful entrepreneurs.
480+
481+
```{code-cell} ipython3
482+
ex3 = create_edm_π(π=0.2)
483+
gap3 = compute_gap(ex3)
484+
485+
gap3ex3 = create_edm_π(π=0.2)
486+
gap3 = compute_gap(ex3)
487+
488+
gap3
489+
```
490+
491+
Now let's study how the initial wage premium for successful entrepreneurs depend on the success probability.
492+
493+
```{code-cell} ipython3
494+
π_arr = np.linspace(0.2, 1, 50)
495+
models = [create_edm_π(π=π) for π in π_arr]
496+
gaps = [compute_gap(model) for model in models]
497+
498+
plt.plot(π_arr, gaps)
499+
plt.ylabel(r'wage gap')
500+
plt.xlabel(r'$\pi$')
501+
plt.show()
502+
```
503+
504+
Does the graph make sense to you?
505+
506+
```{solution-end}
507+
```

0 commit comments

Comments
 (0)