@@ -4,7 +4,7 @@ jupytext:
4
4
extension : .md
5
5
format_name : myst
6
6
format_version : 0.13
7
- jupytext_version : 1.14.4
7
+ jupytext_version : 1.16.1
8
8
kernelspec :
9
9
display_name : Python 3 (ipykernel)
10
10
language : python
@@ -29,7 +29,7 @@ To map Friedman's application into our model, think of our high school students
29
29
30
30
Our presentation is "incomplete" in the sense that it is based on a single equation that would be part of set equilibrium conditions of a more fully articulated model.
31
31
32
- This ''equalizing difference'' equation determines a college, high-school wage ratio that equalizes present values of a high school educated worker and a college educated worker.
32
+ This ''equalizing difference'' equation determines a college- high-school wage ratio that equalizes present values of a high school educated worker and a college educated worker.
33
33
34
34
The idea is that lifetime earnings somehow adjust to make a new high school worker indifferent between going to college and not going to college but instead going to work immmediately.
35
35
@@ -50,6 +50,8 @@ As usual, we'll start by importing some Python modules.
50
50
``` {code-cell} ipython3
51
51
import numpy as np
52
52
import matplotlib.pyplot as plt
53
+ from collections import namedtuple
54
+ from sympy import Symbol, Lambda, symbols
53
55
```
54
56
55
57
## The indifference condition
@@ -206,34 +208,34 @@ prominently including $\gamma_h, \gamma_c, R$.
206
208
207
209
Now let's write some Python code to compute $\phi$ and plot it as a function of some of its determinants.
208
210
209
-
210
211
```{code-cell} ipython3
211
- class equalizing_diff:
212
- """
213
- A class of the equalizing difference model
214
- """
212
+ # Define the namedtuple for the equalizing difference model
213
+ EqDiffModel = namedtuple('EqDiffModel', 'R T γ_h γ_c w_h0 D π')
214
+
215
+ def create_edm(R=1.05, # Gross rate of return
216
+ T=40, # Time horizon
217
+ γ_h=1.01, # High-school wage growth
218
+ γ_c=1.01, # College wage growth
219
+ w_h0=1, # Initial wage (high school)
220
+ D=10, # Cost for college
221
+ π=None):
222
+
223
+ return EqDiffModel(R, T, γ_h, γ_c, w_h0, D, π)
224
+
225
+ def compute_gap(model):
226
+ R, T, γ_h, γ_c, w_h0, D, π = model
227
+
228
+ A_h = (1 - (γ_h/R)**(T+1)) / (1 - γ_h/R)
229
+ A_c = (1 - (γ_c/R)**(T-3)) / (1 - γ_c/R) * (γ_c/R)**4
215
230
216
- def __init__(self, R, T, γ_h, γ_c, w_h0, D=0, π=None):
217
- # one switches to the weak model by setting π
218
- self.R, self.γ_h, self.γ_c, self.w_h0, self.D = R, γ_h, γ_c, w_h0, D
219
- self.T, self.π = T, π
231
+ # Tweaked model
232
+ if π is not None:
233
+ A_c = π * A_c
220
234
221
- def compute_gap(self):
222
- R, γ_h, γ_c, w_h0, D = self.R, self.γ_h, self.γ_c, self.w_h0, self.D
223
- T, π = self.T, self.π
224
-
225
- A_h = (1 - (γ_h/R)**(T+1)) / (1 - γ_h/R)
226
- A_c = (1 - (γ_c/R)**(T-3)) / (1 - γ_c/R) * (γ_c/R)**4
227
-
228
- # tweaked model
229
- if π!=None:
230
- A_c = π*A_c
231
-
232
- ϕ = A_h/A_c + D/(w_h0*A_c)
233
- return ϕ
235
+ ϕ = A_h / A_c + D / (w_h0 * A_c)
236
+ return ϕ
234
237
```
235
238
236
-
237
239
Using vectorization instead of loops,
238
240
we build some functions to help do comparative statics .
239
241
@@ -242,75 +244,30 @@ For a given instance of the class, we want to recompute $\phi$ when one paramete
242
244
Let's do an example.
243
245
244
246
```{code-cell} ipython3
245
- # ϕ_R
246
- def ϕ_R(mc, R_new):
247
- mc_new = equalizing_diff(R_new, mc.T, mc.γ_h, mc.γ_c, mc.w_h0, mc.D, mc.π)
248
- return mc_new.compute_gap()
249
-
250
- ϕ_R = np.vectorize(ϕ_R)
251
-
252
- # ϕ_γh
253
- def ϕ_γh(mc, γh_new):
254
- mc_new = equalizing_diff(mc.R, mc.T, γh_new, mc.γ_c, mc.w_h0, mc.D, mc.π)
255
- return mc_new.compute_gap()
256
-
257
- ϕ_γh = np.vectorize(ϕ_γh)
258
-
259
- # ϕ_γc
260
- def ϕ_γc(mc, γc_new):
261
- mc_new = equalizing_diff(mc.R, mc.T, mc.γ_h, γc_new, mc.w_h0, mc.D, mc.π)
262
- return mc_new.compute_gap()
247
+ ex1 = create_edm()
248
+ gap1 = compute_gap(ex1)
263
249
264
- ϕ_γc = np.vectorize(ϕ_γc)
265
-
266
- # ϕ_π
267
- def ϕ_π(mc, π_new):
268
- mc_new = equalizing_diff(mc.R, mc.T, mc.γ_h, mc.γ_c, mc.w_h0, mc.D, π_new)
269
- return mc_new.compute_gap()
270
-
271
- ϕ_π = np.vectorize(ϕ_π)
272
- ```
273
-
274
- ```{code-cell} ipython3
275
- # set benchmark parameters
276
- R = 1.05
277
- T = 40
278
- γ_h, γ_c = 1.01, 1.01
279
- w_h0 = 1
280
- D = 10
281
-
282
- # create an instance
283
- ex1 = equalizing_diff(R=R, T=T, γ_h=γ_h, γ_c=γ_c, w_h0=w_h0, D=D)
284
- gap1 = ex1.compute_gap()
285
-
286
- print(gap1)
250
+ gap1
287
251
```
288
252
289
253
Let's not charge for college and recompute $\phi$.
290
254
291
255
The initial college wage premium should go down.
292
256
293
-
294
-
295
-
296
257
```{code-cell} ipython3
297
258
# free college
298
- ex2 = equalizing_diff(R, T, γ_h, γ_c, w_h0, D=0)
299
- gap2 = ex2. compute_gap()
300
- print( gap2)
259
+ ex2 = create_edm( D=0)
260
+ gap2 = compute_gap(ex2 )
261
+ gap2
301
262
```
302
263
303
-
304
-
305
264
Let us construct some graphs that show us how the initial college-high-school wage ratio $\phi$ would change if one of its determinants were to change.
306
265
307
- Let's start with the gross interest rate $R$.
308
-
309
-
266
+ Let's start with the gross interest rate $R$.
310
267
311
268
```{code-cell} ipython3
312
269
R_arr = np.linspace(1, 1.2, 50)
313
- plt.plot(R_arr, φ_R(ex1, R_arr))
270
+ plt.plot(R_arr, compute_gap(create_edm(R= R_arr) ))
314
271
plt.xlabel(r'$R$')
315
272
plt.ylabel(r'wage gap')
316
273
plt.show()
@@ -323,11 +280,12 @@ determinants of $\phi$.
323
280
324
281
```{code-cell} ipython3
325
282
γc_arr = np.linspace(1, 1.2, 50)
326
- plt.plot(γc_arr, φ_γc(ex1, γc_arr))
283
+ plt.plot(γc_arr, compute_gap(create_edm(γ_c= γc_arr) ))
327
284
plt.xlabel(r'$\gamma_c$')
328
285
plt.ylabel(r'wage gap')
329
286
plt.show()
330
287
```
288
+
331
289
Notice how the intitial wage gap falls when the rate of growth $\gamma_c$ of college wages rises.
332
290
333
291
The wage gap falls to "equalize" the present values of the two types of career, one as a high school worker, the other as a college worker.
@@ -338,33 +296,31 @@ The following graph shows what happens.
338
296
339
297
```{code-cell} ipython3
340
298
γh_arr = np.linspace(1, 1.1, 50)
341
- plt.plot(γh_arr, φ_γh(ex1, γh_arr))
299
+ plt.plot(γh_arr, compute_gap(create_edm(γ_h= γh_arr) ))
342
300
plt.xlabel(r'$\gamma_h$')
343
301
plt.ylabel(r'wage gap')
344
302
plt.show()
345
303
```
346
304
347
-
348
305
## Entrepreneur-worker interpretation
349
306
350
307
Now let's adopt the entrepreneur-worker interpretation of our model.
351
308
352
- If the probability that a new business succeeds is $.2$, let's compute the initial wage premium for successful entrepreneurs.
309
+ If the probability that a new business succeeds is $0 .2$, let's compute the initial wage premium for successful entrepreneurs.
353
310
354
311
```{code-cell} ipython3
355
312
# a model of enterpreneur
356
- ex3 = equalizing_diff(R, T, γ_h, γ_c, w_h0, π=0.2)
357
- gap3 = ex3. compute_gap()
313
+ ex3 = create_edm( π=0.2)
314
+ gap3 = compute_gap(ex3 )
358
315
359
- print( gap3)
316
+ gap3
360
317
```
361
318
362
319
Now let's study how the initial wage premium for successful entrepreneurs depend on the success probability.
363
320
364
-
365
321
```{code-cell} ipython3
366
322
π_arr = np.linspace(0.2, 1, 50)
367
- plt.plot(π_arr, φ_π(ex3, π_arr))
323
+ plt.plot(π_arr, compute_gap(create_edm(π= π_arr) ))
368
324
plt.ylabel(r'wage gap')
369
325
plt.xlabel(r'$\pi$')
370
326
plt.show()
@@ -388,16 +344,10 @@ But for a reader interested in how we can get Python to do all the hard work inv
388
344
389
345
We'll use the Python module 'sympy' to compute partial derivatives of $\phi$ with respect to the parameters that determine it.
390
346
391
- Let's import key functions from sympy.
392
-
393
- ```{code-cell} ipython3
394
- from sympy import Symbol, Lambda, symbols
395
- ```
396
-
397
347
Define symbols
398
348
399
349
```{code-cell} ipython3
400
- γ_h, γ_c, w_h0, D = symbols('\gamma_h, \gamma_h_c , w_0^h, D', real=True)
350
+ γ_h, γ_c, w_h0, D = symbols('\gamma_h, \gamma_c , w_0^h, D', real=True)
401
351
R, T = Symbol('R', real=True), Symbol('T', integer=True)
402
352
```
403
353
@@ -450,8 +400,6 @@ Now let's compute $\frac{\partial \phi}{\partial D}$ and then evaluate it at the
450
400
451
401
Thus, as with our earlier graph, we find that raising $R$ increases the initial college wage premium $\phi$.
452
402
453
- +++
454
-
455
403
Compute $\frac{\partial \phi}{\partial T}$ and evaluate it a default parameters
456
404
457
405
```{code-cell} ipython3
@@ -469,8 +417,6 @@ We find that raising $T$ decreases the initial college wage premium $\phi$.
469
417
470
418
This is because college graduates now have longer career lengths to "pay off" the time and other costs they paid to go to college
471
419
472
- +++
473
-
474
420
Let's compute $\frac{\partial \phi}{\partial γ_h}$ and evaluate it at default parameters.
475
421
476
422
```{code-cell} ipython3
@@ -486,8 +432,6 @@ Let's compute $\frac{\partial \phi}{\partial γ_h}$ and evaluate it at default p
486
432
487
433
We find that raising $\gamma_h$ increases the initial college wage premium $\phi$, as we did with our earlier graphical analysis.
488
434
489
- +++
490
-
491
435
Compute $\frac{\partial \phi}{\partial γ_c}$ and evaluate it numerically at default parameter values
492
436
493
437
```{code-cell} ipython3
@@ -503,8 +447,6 @@ Compute $\frac{\partial \phi}{\partial γ_c}$ and evaluate it numerically at def
503
447
504
448
We find that raising $\gamma_c$ decreases the initial college wage premium $\phi$, as we did with our graphical analysis earlier
505
449
506
- +++
507
-
508
450
Let's compute $\frac{\partial \phi}{\partial R}$ and evaluate it numerically at default parameter values
509
451
510
452
```{code-cell} ipython3
@@ -518,12 +460,4 @@ Let's compute $\frac{\partial \phi}{\partial R}$ and evaluate it numerically at
518
460
ϕ_R_func(D_value, γ_h_value, γ_c_value, R_value, T_value, w_h0_value)
519
461
```
520
462
521
- +++ {"tags": []}
522
-
523
- We find that raising the gross interest rate $R$ increases the initial college wage premium $\phi$, as we did with our graphical analysis earlier
524
-
525
-
526
-
527
- ```{code-cell} ipython3
528
-
529
- ```
463
+ We find that raising the gross interest rate $R$ increases the initial college wage premium $\phi$, as we did with our graphical analysis earlier
0 commit comments