Skip to content

Commit 37f2951

Browse files
committed
update graphs in tax_smooth
1 parent 0326295 commit 37f2951

File tree

1 file changed

+33
-34
lines changed

1 file changed

+33
-34
lines changed

lectures/tax_smooth.md

Lines changed: 33 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ jupytext:
44
extension: .md
55
format_name: myst
66
format_version: 0.13
7-
jupytext_version: 1.16.6
7+
jupytext_version: 1.16.4
88
kernelspec:
99
display_name: Python 3 (ipykernel)
1010
language: python
@@ -269,7 +269,6 @@ Let's verify this with Python code.
269269
First we implement the model with `compute_optimal`
270270
271271
```{code-cell} ipython3
272-
273272
def compute_optimal(model, B0, G_seq):
274273
275274
R, S = model.R, model.S
@@ -300,10 +299,10 @@ The drop in government expenditures could reflect a change in spending requireme
300299
301300
```{code-cell} ipython3
302301
# Initial debt
303-
B0 = 0 # initial government debt
302+
B0 = 2 # initial government debt
304303
305304
# Government expenditure process
306-
G_seq = np.concatenate([np.ones(46), 5*np.ones(5),np.ones(15)])
305+
G_seq = np.concatenate([np.ones(46), 4*np.ones(5), np.ones(15)])
307306
tax_model = create_tax_smoothing_model()
308307
T_seq, B_seq, h0 = compute_optimal(tax_model, B0, G_seq)
309308
@@ -314,18 +313,24 @@ print('check B_S+1=0:',
314313
The graphs below show paths of government expenditures, tax collections, and government debt.
315314
316315
```{code-cell} ipython3
317-
318316
# Sequence Length
319317
S = tax_model.S
320318
321-
plt.plot(range(S+1), G_seq, label='government expenditures')
322-
plt.plot(range(S+1), T_seq, label='tax collections')
323-
plt.plot(range(S+2), B_seq, label='government debt')
324-
plt.plot(range(S+2), np.zeros(S+2), '--')
319+
fig, axes = plt.subplots(1, 2, figsize=(12,5))
320+
321+
axes[0].plot(range(S+1), G_seq, label='expenditures', lw=2)
322+
axes[0].plot(range(S+1), T_seq, label='tax', lw=2)
323+
axes[1].plot(range(S+2), B_seq, label='debt', color='green', lw=2)
324+
axes[0].set_ylabel(r'$T_t,G_t$')
325+
axes[1].set_ylabel(r'$B_t$')
326+
327+
for ax in axes:
328+
ax.plot(range(S+2), np.zeros(S+2), '--', lw=1, color='black')
329+
ax.legend()
330+
ax.set_xlabel(r'$t$')
331+
325332
326-
plt.legend()
327333
plt.xlabel(r'$t$')
328-
plt.ylabel(r'$T_t,G_t,B_t$')
329334
plt.show()
330335
```
331336
@@ -364,18 +369,24 @@ def plot_ts(model, # tax-smoothing model
364369
# Compute optimal tax path
365370
T_seq, B_seq, h0 = compute_optimal(model, B0, G_seq)
366371
367-
# Sequence length
372+
# Sequence Length
368373
S = tax_model.S
369374
370-
# Generate plot
371-
plt.plot(range(S+1), G_seq, label='government expenditures')
372-
plt.plot(range(S+1), T_seq, label='tax collections')
373-
plt.plot(range(S+2), B_seq, label='government debt')
374-
plt.plot(range(S+2), np.zeros(S+2), '--')
375+
fig, axes = plt.subplots(1, 2, figsize=(12,5))
376+
377+
axes[0].plot(range(S+1), G_seq, label='expenditures', lw=2)
378+
axes[0].plot(range(S+1), T_seq, label='tax', lw=2)
379+
axes[1].plot(range(S+2), B_seq, label='debt', color='green', lw=2)
380+
axes[0].set_ylabel(r'$T_t,G_t$')
381+
axes[1].set_ylabel(r'$B_t$')
382+
383+
for ax in axes:
384+
ax.plot(range(S+2), np.zeros(S+2), '--', lw=1, color='black')
385+
ax.legend()
386+
ax.set_xlabel(r'$t$')
387+
375388
376-
plt.legend()
377389
plt.xlabel(r'$t$')
378-
plt.ylabel(r'$T_t,G_t,B_t$')
379390
plt.show()
380391
```
381392
@@ -464,9 +475,9 @@ What happens with oscillating expenditures
464475
465476
```{code-cell} ipython3
466477
λ = -0.95
467-
geo_seq = λ ** np.arange(t_max) * G_0
478+
geo_seq = λ ** np.arange(t_max) * G_0 + 1
468479
G_seq_geo = np.concatenate(
469-
[geo_seq, np.zeros(20)])
480+
[geo_seq, np.ones(20)])
470481
471482
plot_ts(tax_model, B0, G_seq_geo)
472483
```
@@ -648,16 +659,4 @@ plt.plot(ξ1_arr, cost_grad)
648659
plt.ylabel('derivative of cost')
649660
plt.xlabel(r'$\phi$')
650661
plt.show()
651-
```
652-
653-
<!-- ## Wrapping up the consumption-smoothing model
654-
655-
The consumption-smoothing model of Milton Friedman {cite}`Friedman1956` and Robert Hall {cite}`Hall1978`) is a cornerstone of modern macro that has important ramifications for the size of the Keynesian "fiscal policy multiplier" described briefly in
656-
QuantEcon lecture {doc}`geometric series <geom_series>`.
657-
658-
In particular, it **lowers** the government expenditure multiplier relative to one implied by
659-
the original Keynesian consumption function presented in {doc}`geometric series <geom_series>`.
660-
661-
Friedman's work opened the door to an enlightening literature on the aggregate consumption function and associated government expenditure multipliers that
662-
remains active today. -->
663-
662+
```

0 commit comments

Comments
 (0)