diff --git a/code/estimark/data/Cagetti2003.csv b/code/data/Cagetti2003.csv similarity index 100% rename from code/estimark/data/Cagetti2003.csv rename to code/data/Cagetti2003.csv diff --git a/code/estimark/data/SCFdata.csv b/code/data/SCFdata.csv similarity index 100% rename from code/estimark/data/SCFdata.csv rename to code/data/SCFdata.csv diff --git a/code/estimark/estimation.py b/code/estimark/estimation.py index e9fbfd9..fe72e69 100644 --- a/code/estimark/estimation.py +++ b/code/estimark/estimation.py @@ -10,7 +10,6 @@ """ import csv -from pathlib import Path from time import time # Timing utility import matplotlib.pyplot as plt @@ -35,7 +34,7 @@ ) # Parameters for the consumer type and the estimation -from estimark.calibration.parameters import ( +from estimark.parameters import ( init_consumer_objects, init_subjective_labor, init_subjective_stock, @@ -43,7 +42,7 @@ ) # SCF 2004 data on household wealth -from estimark.calibration.scf import ( +from estimark.scf import ( age_groups, scf_array, scf_data, @@ -54,7 +53,7 @@ # Pathnames to the other files: # Relative directory for primitive parameter files -tables_dir = "code/tables/" +tables_dir = "content/tables/" # Relative directory for primitive parameter files figures_dir = "content/figures/" @@ -152,12 +151,7 @@ def get_targeted_moments(data=scf_data, weights=scf_weights, groups=scf_groups): def get_initial_guess(agent_name): # start from previous estimation results if available - csv_file_path = ( - Path(__file__).resolve().parent - / ".." - / "tables" - / (agent_name + "_estimate_results.csv") - ) + csv_file_path = tables_dir + agent_name + "_estimate_results.csv" try: with open(csv_file_path, "r") as file: @@ -385,7 +379,7 @@ def smm_obj_func_redux(params): print(f"Estimated values: DiscFacAdj={model_estimate[0]}, CRRA={model_estimate[1]}") # Create the simple estimate table - estimate_results_file = tables_dir + "/" + agent_name + "_estimate_results.csv" + estimate_results_file = tables_dir + agent_name + "_estimate_results.csv" with open(estimate_results_file, "wt") as f: writer = csv.writer(f) @@ -427,7 +421,7 @@ def do_compute_se_boostrap( print(f"Standard errors: DiscFacAdj--> {std_errors[0]}, CRRA--> {std_errors[1]}") # Create the simple bootstrap table - bootstrap_results_file = tables_dir + "/" + agent_name + "_bootstrap_results.csv" + bootstrap_results_file = tables_dir + agent_name + "_bootstrap_results.csv" with open(bootstrap_results_file, "wt") as f: writer = csv.writer(f) @@ -487,9 +481,9 @@ def simulate_moments_redux(params): axs[1].set_ylabel("Sensitivity") axs[1].set_xlabel("Median W/Y Ratio") - plt.savefig(figures_dir + "/" + agent_name + "Sensitivity.pdf") - plt.savefig(figures_dir + "/" + agent_name + "Sensitivity.png") - plt.savefig(figures_dir + "/" + agent_name + "Sensitivity.svg") + plt.savefig(figures_dir + agent_name + "Sensitivity.pdf") + plt.savefig(figures_dir + agent_name + "Sensitivity.png") + plt.savefig(figures_dir + agent_name + "Sensitivity.svg") plt.show() @@ -530,9 +524,9 @@ def do_make_contour_plot(agent_name, estimation_agent, model_estimate, target_mo plt.plot(model_estimate[1], model_estimate[0], "*r", ms=15) plt.xlabel(r"coefficient of relative risk aversion $\rho$", fontsize=14) plt.ylabel(r"discount factor adjustment $\beth$", fontsize=14) - plt.savefig(figures_dir + "/" + agent_name + "SMMcontour.pdf") - plt.savefig(figures_dir + "/" + agent_name + "SMMcontour.png") - plt.savefig(figures_dir + "/" + agent_name + "SMMcontour.svg") + plt.savefig(figures_dir + agent_name + "SMMcontour.pdf") + plt.savefig(figures_dir + agent_name + "SMMcontour.png") + plt.savefig(figures_dir + agent_name + "SMMcontour.svg") plt.show() diff --git a/code/estimark/calibration/parameters.py b/code/estimark/parameters.py similarity index 100% rename from code/estimark/calibration/parameters.py rename to code/estimark/parameters.py diff --git a/code/estimark/calibration/scf.py b/code/estimark/scf.py similarity index 97% rename from code/estimark/calibration/scf.py rename to code/estimark/scf.py index 1ef2ba0..4f13845 100644 --- a/code/estimark/calibration/scf.py +++ b/code/estimark/scf.py @@ -6,7 +6,7 @@ import numpy as np # Numerical Python import pandas as pd -from estimark.calibration.parameters import initial_age +from estimark.parameters import initial_age # Get the directory containing the current file and construct the full path to the CSV file csv_file_path = Path(__file__).resolve().parent / ".." / "data" / "SCFdata.csv" diff --git a/code/IndShock.ipynb b/code/notebooks/IndShock.ipynb similarity index 100% rename from code/IndShock.ipynb rename to code/notebooks/IndShock.ipynb diff --git a/code/Portfolio.ipynb b/code/notebooks/Portfolio.ipynb similarity index 100% rename from code/Portfolio.ipynb rename to code/notebooks/Portfolio.ipynb diff --git a/code/WarmGlow.ipynb b/code/notebooks/WarmGlow.ipynb similarity index 100% rename from code/WarmGlow.ipynb rename to code/notebooks/WarmGlow.ipynb diff --git a/code/WarmGlowPortfolio.ipynb b/code/notebooks/WarmGlowPortfolio.ipynb similarity index 100% rename from code/WarmGlowPortfolio.ipynb rename to code/notebooks/WarmGlowPortfolio.ipynb diff --git a/code/WealthPortfolio.ipynb b/code/notebooks/WealthPortfolio.ipynb similarity index 100% rename from code/WealthPortfolio.ipynb rename to code/notebooks/WealthPortfolio.ipynb diff --git a/code/tables/IndShockSub(Labor)Market_estimate_results.csv b/content/tables/IndShockSub(Labor)Market_estimate_results.csv similarity index 100% rename from code/tables/IndShockSub(Labor)Market_estimate_results.csv rename to content/tables/IndShockSub(Labor)Market_estimate_results.csv diff --git a/code/tables/IndShockSub(Stock)(Labor)Market_estimate_results.csv b/content/tables/IndShockSub(Stock)(Labor)Market_estimate_results.csv similarity index 100% rename from code/tables/IndShockSub(Stock)(Labor)Market_estimate_results.csv rename to content/tables/IndShockSub(Stock)(Labor)Market_estimate_results.csv diff --git a/code/tables/IndShockSub(Stock)Market_estimate_results.csv b/content/tables/IndShockSub(Stock)Market_estimate_results.csv similarity index 100% rename from code/tables/IndShockSub(Stock)Market_estimate_results.csv rename to content/tables/IndShockSub(Stock)Market_estimate_results.csv diff --git a/code/tables/IndShock_bootstrap_results.csv b/content/tables/IndShock_bootstrap_results.csv similarity index 100% rename from code/tables/IndShock_bootstrap_results.csv rename to content/tables/IndShock_bootstrap_results.csv diff --git a/code/tables/IndShock_estimate_results.csv b/content/tables/IndShock_estimate_results.csv similarity index 100% rename from code/tables/IndShock_estimate_results.csv rename to content/tables/IndShock_estimate_results.csv diff --git a/code/tables/PortfolioSub(Labor)Market_estimate_results.csv b/content/tables/PortfolioSub(Labor)Market_estimate_results.csv similarity index 100% rename from code/tables/PortfolioSub(Labor)Market_estimate_results.csv rename to content/tables/PortfolioSub(Labor)Market_estimate_results.csv diff --git a/code/tables/PortfolioSub(Stock)(Labor)Market_estimate_results.csv b/content/tables/PortfolioSub(Stock)(Labor)Market_estimate_results.csv similarity index 100% rename from code/tables/PortfolioSub(Stock)(Labor)Market_estimate_results.csv rename to content/tables/PortfolioSub(Stock)(Labor)Market_estimate_results.csv diff --git a/code/tables/PortfolioSub(Stock)Market_estimate_results.csv b/content/tables/PortfolioSub(Stock)Market_estimate_results.csv similarity index 100% rename from code/tables/PortfolioSub(Stock)Market_estimate_results.csv rename to content/tables/PortfolioSub(Stock)Market_estimate_results.csv diff --git a/code/tables/Portfolio_bootstrap_results.csv b/content/tables/Portfolio_bootstrap_results.csv similarity index 100% rename from code/tables/Portfolio_bootstrap_results.csv rename to content/tables/Portfolio_bootstrap_results.csv diff --git a/code/tables/Portfolio_estimate_results.csv b/content/tables/Portfolio_estimate_results.csv similarity index 100% rename from code/tables/Portfolio_estimate_results.csv rename to content/tables/Portfolio_estimate_results.csv diff --git a/code/tables/WarmGlowPortfolioSub(Labor)Market_estimate_results.csv b/content/tables/WarmGlowPortfolioSub(Labor)Market_estimate_results.csv similarity index 100% rename from code/tables/WarmGlowPortfolioSub(Labor)Market_estimate_results.csv rename to content/tables/WarmGlowPortfolioSub(Labor)Market_estimate_results.csv diff --git a/code/tables/WarmGlowPortfolioSub(Stock)(Labor)Market_estimate_results.csv b/content/tables/WarmGlowPortfolioSub(Stock)(Labor)Market_estimate_results.csv similarity index 100% rename from code/tables/WarmGlowPortfolioSub(Stock)(Labor)Market_estimate_results.csv rename to content/tables/WarmGlowPortfolioSub(Stock)(Labor)Market_estimate_results.csv diff --git a/code/tables/WarmGlowPortfolioSub(Stock)Market_estimate_results.csv b/content/tables/WarmGlowPortfolioSub(Stock)Market_estimate_results.csv similarity index 100% rename from code/tables/WarmGlowPortfolioSub(Stock)Market_estimate_results.csv rename to content/tables/WarmGlowPortfolioSub(Stock)Market_estimate_results.csv diff --git a/code/tables/WarmGlowPortfolio_bootstrap_results.csv b/content/tables/WarmGlowPortfolio_bootstrap_results.csv similarity index 100% rename from code/tables/WarmGlowPortfolio_bootstrap_results.csv rename to content/tables/WarmGlowPortfolio_bootstrap_results.csv diff --git a/code/tables/WarmGlowPortfolio_estimate_results.csv b/content/tables/WarmGlowPortfolio_estimate_results.csv similarity index 100% rename from code/tables/WarmGlowPortfolio_estimate_results.csv rename to content/tables/WarmGlowPortfolio_estimate_results.csv diff --git a/code/tables/WarmGlowSub(Labor)Market_estimate_results.csv b/content/tables/WarmGlowSub(Labor)Market_estimate_results.csv similarity index 100% rename from code/tables/WarmGlowSub(Labor)Market_estimate_results.csv rename to content/tables/WarmGlowSub(Labor)Market_estimate_results.csv diff --git a/code/tables/WarmGlowSub(Stock)(Labor)Market_estimate_results.csv b/content/tables/WarmGlowSub(Stock)(Labor)Market_estimate_results.csv similarity index 100% rename from code/tables/WarmGlowSub(Stock)(Labor)Market_estimate_results.csv rename to content/tables/WarmGlowSub(Stock)(Labor)Market_estimate_results.csv diff --git a/code/tables/WarmGlowSub(Stock)Market_estimate_results.csv b/content/tables/WarmGlowSub(Stock)Market_estimate_results.csv similarity index 100% rename from code/tables/WarmGlowSub(Stock)Market_estimate_results.csv rename to content/tables/WarmGlowSub(Stock)Market_estimate_results.csv diff --git a/code/tables/WarmGlow_bootstrap_results.csv b/content/tables/WarmGlow_bootstrap_results.csv similarity index 100% rename from code/tables/WarmGlow_bootstrap_results.csv rename to content/tables/WarmGlow_bootstrap_results.csv diff --git a/code/tables/WarmGlow_estimate_results.csv b/content/tables/WarmGlow_estimate_results.csv similarity index 100% rename from code/tables/WarmGlow_estimate_results.csv rename to content/tables/WarmGlow_estimate_results.csv diff --git a/code/tables/WealthPortfolioSub(Labor)Market_estimate_results.csv b/content/tables/WealthPortfolioSub(Labor)Market_estimate_results.csv similarity index 100% rename from code/tables/WealthPortfolioSub(Labor)Market_estimate_results.csv rename to content/tables/WealthPortfolioSub(Labor)Market_estimate_results.csv diff --git a/code/tables/WealthPortfolioSub(Stock)(Labor)Market_estimate_results.csv b/content/tables/WealthPortfolioSub(Stock)(Labor)Market_estimate_results.csv similarity index 100% rename from code/tables/WealthPortfolioSub(Stock)(Labor)Market_estimate_results.csv rename to content/tables/WealthPortfolioSub(Stock)(Labor)Market_estimate_results.csv diff --git a/code/tables/WealthPortfolioSub(Stock)Market_estimate_results.csv b/content/tables/WealthPortfolioSub(Stock)Market_estimate_results.csv similarity index 100% rename from code/tables/WealthPortfolioSub(Stock)Market_estimate_results.csv rename to content/tables/WealthPortfolioSub(Stock)Market_estimate_results.csv diff --git a/code/tables/WealthPortfolio_bootstrap_results.csv b/content/tables/WealthPortfolio_bootstrap_results.csv similarity index 100% rename from code/tables/WealthPortfolio_bootstrap_results.csv rename to content/tables/WealthPortfolio_bootstrap_results.csv diff --git a/code/tables/WealthPortfolio_estimate_results.csv b/content/tables/WealthPortfolio_estimate_results.csv similarity index 100% rename from code/tables/WealthPortfolio_estimate_results.csv rename to content/tables/WealthPortfolio_estimate_results.csv