You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -22,6 +22,7 @@ In this notebook, we'll present some useful models of economic dynamics using o
22
22
```{code-cell} ipython3
23
23
import numpy as np
24
24
import matplotlib.pyplot as plt
25
+
from collections import namedtuple
25
26
```
26
27
27
28
+++ {"user_expressions": []}
@@ -70,14 +71,29 @@ Below, we'll describe how to execute these steps using linear algebra -- matrix
70
71
71
72
We shall eventually evaluate alternative budget feasible consumption paths $\vec c$ using the following **welfare criterion**
72
73
73
-
$$
74
+
```{math}
75
+
:label: welfare
76
+
74
77
W = \sum_{t=0}^T \beta^t (g_1 c_t - \frac{g_2}{2} c_t^2 )
75
-
$$
78
+
```
76
79
77
80
where $g_1 > 0, g_2 > 0$.
78
81
79
82
We shall see that when $\beta R = 1$ (a condition assumed by Milton Friedman and Robert Hall), this criterion assigns higher welfare to **smoother** consumption paths.
80
83
84
+
Here we use default parameters $R = 1.05$, $g_1 = 1$, $g_2 = 1/2$, and $T = 65$.
85
+
86
+
We create a namedtuple to store these parameters with default values.
We can evaluate the welfare using the formula {numref}`welfare`
349
+
350
+
```{code-cell} ipython3
351
+
def welfare(model, c_seq):
352
+
β_seq, g1, g2 = model.β_seq, model.g1, model.g2
353
+
354
+
u_seq = g1 * c_seq - g2/2 * c_seq**2
355
+
return β_seq @ u_seq
278
356
357
+
print('Welfare:', welfare(cs_model, c_seq))
358
+
```
279
359
360
+
+++ {"user_expressions": []}
280
361
281
362
### Feasible consumption variations ###
282
363
@@ -331,158 +412,79 @@ Given $R$, we thus have a two parameter class of budget feasible variations $\ve
331
412
to compute alternative consumption paths, then evaluate their welfare.
332
413
333
414
**Note to John:** We can do some fun simple experiments with these variations -- we can use
334
-
graphs to show that, when $\beta R =1$ and starting from the smooth path, all nontrivial budget-feasible variations lower welfare according to the criterion above.
335
-
336
-
We can even use the Python numpy grad command to compute derivatives of welfare with respect to our two parameters.
337
-
338
-
We are teaching the key idea beneath the **calculus of variations**.
339
-
340
-
```{code-cell} ipython3
341
-
class Consumption_smoothing:
342
-
"A class of the Permanent Income model of consumption"
graphs to show that, when $\beta R = 1$ and starting from the smooth path, all nontrivial budget-feasible variations lower welfare according to the criterion above.
397
416
398
-
+++ {"user_expressions": []}
399
-
400
-
Below is an example where the consumer inherits $a_0<0$ (which can be interpreted as a student debt).
401
-
402
-
The income process $\{y_t\}_{t=0}^{T}$ is constant and positive up to $t=45$ and then becomes zero afterward.
0 commit comments