-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfigures_neoclassical_human_capital.py
111 lines (88 loc) · 3.71 KB
/
figures_neoclassical_human_capital.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
import jax.numpy as jnp
import matplotlib.pyplot as plt
import os
from new_neoclassical_human_capital_matern import human_capital_matern
from mpl_toolkits.axes_grid1.inset_locator import (
zoomed_inset_axes,
mark_inset,
inset_axes,
)
fontsize = 17
ticksize = 16
figsize = (15, 18)
params = {
"font.family": "serif",
"figure.figsize": figsize,
"figure.dpi": 80,
"figure.edgecolor": "k",
"font.size": fontsize,
"axes.labelsize": fontsize,
"axes.titlesize": fontsize,
"xtick.labelsize": ticksize,
"ytick.labelsize": ticksize,
}
plt.rcParams.update(params)
## Plot given solution
sol = human_capital_matern()
output_path = "figures/neoclassical_human_capital.pdf"
t = sol["t_test"]
T = sol["t_train"].max()
c_hat = sol["c_test"]
k_hat = sol["k_test"]
h_hat = sol["h_test"]
i_k_hat = sol["i_k_test"]
i_h_hat = sol["i_h_test"]
mu_k_hat = sol["mu_k_test"]
mu_h_hat = sol["mu_h_test"]
# Plotting
ax_physical_capital = plt.subplot(4, 2, 1)
plt.plot(t, k_hat, color="k", label=r"$\hat{x}_k(t)$: Kernel Approximation")
#plt.axhline(y=sol["k_ss"], linestyle="-.", color="k", label=r"$k^*$:Steady-State")
plt.axvline(x=T, color="k", linestyle=":", label="Extrapolation/Interpolation")
plt.ylabel("Physical Capital: $x_k(t)$")
plt.xlabel("Time")
plt.legend() # Show legend with labels
ax_human_capital = plt.subplot(4, 2, 2)
plt.plot(t, h_hat, color="k", label=r"$\hat{x}_h(t)$: Kernel Approximation")
#plt.axhline(y=sol["h_ss"], linestyle="-.", color="grey", label=r"$h^*$: Steady-State")
plt.axvline(x=T, color="k", linestyle=":", label="Extrapolation/Interpolation")
plt.ylabel("Human Capital: $x_h(t)$")
plt.xlabel("Time")
plt.legend() # Show legend with labels
ax_consumption = plt.subplot(4, 2, 3)
plt.plot(t, c_hat, color="b", label=r"$\hat{y}_c(t)$: Kernel Approximation")
#plt.axhline(y=sol["c_ss"], linestyle="-.", color="b", label=r"$c^*$: Steady-State")
plt.axvline(x=T, color="b", linestyle=":", label="Extrapolation/Interpolation")
plt.ylabel("Consumption: $y_c(t)$")
plt.xlabel("Time")
plt.legend() # Show legend with labels
ax_investment_k = plt.subplot(4, 2, 4)
plt.plot(t, i_k_hat, color="b", label=r"$\hat{y}_k(t)$: Kernel Approximation")
#plt.axhline(y=sol["i_k_ss"], linestyle="-.", color="k", label=r"$i_k^*$: Steady-State")
plt.axvline(x=T, color="b", linestyle=":", label="Extrapolation/Interpolation")
plt.ylabel("Physical Capital Investment: $y_k(t)$")
plt.xlabel("Time")
plt.legend() # Show legend with labels
ax_investment_h = plt.subplot(4, 2, 5)
plt.plot(t, i_h_hat, color="b", label=r"$\hat{y}_h(t)$: Kernel Approximation")
#plt.axhline(y=sol["i_h_ss"], linestyle="-.", color="grey", label=r"$i_h^*$: Steady-State")
plt.axvline(x=T, color="b", linestyle=":", label="Extrapolation/Interpolation")
plt.ylabel("Human Capital Investment: $y_h(t)$")
plt.xlabel("Time")
plt.legend() # Show legend with labels
ax_investment_mu_k = plt.subplot(4, 2, 6)
plt.plot(t, mu_k_hat, color="grey", label=r"$\hat{\mu}_k(t)$: Kernel Approximation")
#plt.axhline(y=sol["i_h_ss"], linestyle="-.", color="grey", label=r"$i_h^*$: Steady-State")
plt.axvline(x=T, color="grey", linestyle=":", label="Extrapolation/Interpolation")
plt.ylabel("Co-state Variable: $\mu_k(t)$")
plt.xlabel("Time")
plt.legend() # Show legend with labels
ax_investment_mu_h = plt.subplot(4, 2, 7)
plt.plot(t, mu_h_hat, color="grey", label=r"$\hat{\mu}_h(t)$: Kernel Approximation")
#plt.axhline(y=sol["i_h_ss"], linestyle="-.", color="grey", label=r"$i_h^*$: Steady-State")
plt.axvline(x=T, color="grey", linestyle=":", label="Extrapolation/Interpolation")
plt.ylabel("Co-state Variable: $\mu_h(t)$")
plt.xlabel("Time")
plt.legend() # Show legend with labels
plt.tight_layout() # Adjust layout to prevent overlap
plt.savefig(output_path, format="pdf")