Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Turn off plotting by default #101

Merged
merged 3 commits into from
Apr 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion ogusa/bequest_transmission.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@


def get_bequest_matrix(
J=7, lambdas=np.array([0.25, 0.25, 0.2, 0.1, 0.1, 0.09, 0.01]), graphs=True
J=7,
lambdas=np.array([0.25, 0.25, 0.2, 0.1, 0.1, 0.09, 0.01]),
graphs=False,
):
"""
Returns S x J matrix representing the fraction of aggregate
Expand Down
2 changes: 2 additions & 0 deletions ogusa/calibrate.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ def __init__(
99,
initial_data_year=p.start_year - 1,
final_data_year=p.start_year,
GraphDiag=False,
)

# demographics for 80 period lives (needed for getting e below)
Expand All @@ -79,6 +80,7 @@ def __init__(
99,
initial_data_year=p.start_year - 1,
final_data_year=p.start_year,
GraphDiag=False,
)

# earnings profiles
Expand Down
57 changes: 32 additions & 25 deletions ogusa/labor.py
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ def VCV_moments(cps, n, bin_weights, S):
return VCV


def labor_data_graphs(weighted, S, J, output_dir):
def labor_data_graphs(weighted, S, J, output_dir=None):
"""
Plot labor supply data.

Expand All @@ -166,27 +166,34 @@ def labor_data_graphs(weighted, S, J, output_dir):
X, Y = np.meshgrid(domain, Jgrid)
cmap2 = matplotlib.cm.get_cmap("summer")

plt.plot(domain, weighted, color="black", label="Data")
plt.plot(
np.linspace(76, 100, 23),
extension,
color="black",
linestyle="-.",
label="Extrapolation",
)
plt.plot(np.linspace(65, 76, 11), to_dot, linestyle="--", color="black")
plt.axvline(x=76, color="black", linestyle="--")
plt.xlabel(r"age-$s$")
plt.ylabel(r"individual labor supply $/bar{l}_s$")
plt.legend()
plt.savefig(
os.path.join(baseline_dir, "Demographics/labor_dist_data_withfit.png")
)

fig10 = plt.figure()
ax10 = fig10.add_subplot(projection="3d")
ax10.plot_surface(X, Y, lab_mat_basic.T, rstride=1, cstride=2, cmap=cmap2)
ax10.set_xlabel(r"age-$s$")
ax10.set_ylabel(r"ability type -$j$")
ax10.set_zlabel(r"labor $e_j(s)$")
plt.savefig(os.path.join(baseline_dir, "Demographics/data_labor_dist"))
if output_dir:
plt.plot(domain, weighted, color="black", label="Data")
plt.plot(
np.linspace(76, 100, 23),
extension,
color="black",
linestyle="-.",
label="Extrapolation",
)
plt.plot(
np.linspace(65, 76, 11), to_dot, linestyle="--", color="black"
)
plt.axvline(x=76, color="black", linestyle="--")
plt.xlabel(r"age-$s$")
plt.ylabel(r"individual labor supply $/bar{l}_s$")
plt.legend()
plt.savefig(
os.path.join(
output_dir, "Demographics/labor_dist_data_withfit.png"
)
)

fig10 = plt.figure()
ax10 = fig10.add_subplot(projection="3d")
ax10.plot_surface(
X, Y, lab_mat_basic.T, rstride=1, cstride=2, cmap=cmap2
)
ax10.set_xlabel(r"age-$s$")
ax10.set_ylabel(r"ability type -$j$")
ax10.set_zlabel(r"labor $e_j(s)$")
plt.savefig(os.path.join(output_dir, "Demographics/data_labor_dist"))
4 changes: 3 additions & 1 deletion ogusa/transfer_distribution.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@


def get_transfer_matrix(
J=7, lambdas=np.array([0.25, 0.25, 0.2, 0.1, 0.1, 0.09, 0.01]), graphs=True
J=7,
lambdas=np.array([0.25, 0.25, 0.2, 0.1, 0.1, 0.09, 0.01]),
graphs=False,
):
"""
Compute SxJ matrix representing the distribution of aggregate
Expand Down
Loading