diff --git a/code/do_all.py b/code/do_all.py index 24e4584..0d75360 100644 --- a/code/do_all.py +++ b/code/do_all.py @@ -45,7 +45,7 @@ still run. """ -from estimark.estimation import estimate +from estimark.min import estimate_min from estimark.options import ( all_replications, high_resource, @@ -143,7 +143,7 @@ def run_replication(): replication_specs["subjective_labor"] = True print("Adding subjective labor market beliefs...") - estimate(**replication_specs) + estimate_min(**replication_specs) if __name__ == "__main__": diff --git a/code/estimark/estimation.py b/code/estimark/estimation.py index a4f127b..8cd322c 100644 --- a/code/estimark/estimation.py +++ b/code/estimark/estimation.py @@ -34,7 +34,6 @@ # Parameters for the consumer type and the estimation from estimark.parameters import ( age_mapping, - bootstrap_options, init_calibration, init_params_options, init_subjective_labor, @@ -47,13 +46,6 @@ from estimark.scf import scf_data from estimark.snp import snp_data -# Pathnames to the other files: -# Relative directory for primitive parameter files -tables_dir = "content/tables/" -Path(tables_dir).mkdir(parents=True, exist_ok=True) -# Relative directory for primitive parameter files -figures_dir = "content/figures/" -Path(figures_dir).mkdir(parents=True, exist_ok=True) # ===================================================== # Define objects and functions used for the estimation @@ -149,6 +141,40 @@ def get_weighted_moments( return emp_moments +def get_moments_cov(agent_name, emp_moments): + moments_cov = em.get_moments_cov( + scf_data, + get_weighted_moments, + moment_kwargs={ + "variable": "wealth_income_ratio", + "weights": "weight", + "groups": "age_group", + "mapping": age_mapping, + }, + ) + + if "Port" in agent_name: + + for key1 in emp_moments: + # Check if key1 exists in moments_cov dictionary + if key1 not in moments_cov: + # If it doesn't exist, create a new dictionary for this key + moments_cov[key1] = {} + + for key2 in emp_moments: + # Check if key2 exists in the nested dictionary under key1 + if key2 not in moments_cov[key1]: + # If it doesn't exist, we need to add it + if key1 == key2: + # If key1 is equal to key2, set the value to 1.0 + moments_cov[key1][key2] = 1.0 + else: + # Otherwise, set the value to 0.0 + moments_cov[key1][key2] = 0.0 + + return moments_cov + + def get_empirical_moments(agent_name): emp_moments = get_weighted_moments( data=scf_data, @@ -420,10 +446,7 @@ def calculate_se_bootstrap( def do_estimate_model( - agent, - emp_moments, - initial_guess, - minimize_options=None, + agent, emp_moments, initial_guess, minimize_options=None, tables_dir=None ): fmt_init_guess = [f"{key} = {value:.3f}" for key, value in initial_guess.items()] multistart_text = " with multistart" if minimize_options.get("multistart") else "" @@ -481,7 +504,12 @@ def do_estimate_model( def save_results( - res, agent_name, time_to_estimate, dir, params_key=None, keys_to_save=None + res, + agent_name, + time_to_estimate, + dir, + params_key=None, + keys_to_save=None, ): model_estimate = getattr(res, params_key) @@ -521,6 +549,7 @@ def do_compute_se_boostrap( time_to_estimate, bootstrap_size=50, seed=0, + tables_dir=None, ): # Estimate the model: print("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~") @@ -568,7 +597,7 @@ def do_compute_se_boostrap( ) -def do_compute_sensitivity(agent, model_estimate, emp_moments): +def do_compute_sensitivity(agent, model_estimate, emp_moments, figures_dir=None): print("``````````````````````````````````````````````````````````````````````") print("Computing sensitivity measure.") print("``````````````````````````````````````````````````````````````````````") @@ -614,7 +643,7 @@ def do_compute_sensitivity(agent, model_estimate, emp_moments): plt.show() -def do_make_contour_plot(agent, model_estimate, emp_moments): +def do_make_contour_plot(agent, model_estimate, emp_moments, figures_dir=None): print("``````````````````````````````````````````````````````````````````````") print("Creating the contour plot.") print("``````````````````````````````````````````````````````````````````````") @@ -655,123 +684,3 @@ def do_make_contour_plot(agent, model_estimate, emp_moments): plt.savefig(figures_dir + agent.name + "SMMcontour.png") plt.savefig(figures_dir + agent.name + "SMMcontour.svg") plt.show() - - -def estimate( - init_agent_name, - params_to_estimate, - estimate_model=True, - compute_se_bootstrap=False, - compute_sensitivity=False, - make_contour_plot=False, - subjective_stock=False, - subjective_labor=False, -): - """Run the main estimation procedure for SolvingMicroDSOP. - - Parameters - ---------- - estimate_model : bool - Whether to estimate the model using Nelder-Mead. When True, this is a low-time, low-memory operation. - - compute_standard_errors : bool - Whether to compute standard errors on the estiamtion of the model. - - make_contour_plot : bool - Whether to make the contour plot associate with the estiamte. - - Returns - ------- - None - - """ - ############################################################ - # Make agent - ############################################################ - - agent = make_agent( - init_agent_name=init_agent_name, - subjective_stock=subjective_stock, - subjective_labor=subjective_labor, - ) - - ############################################################ - # Get empirical moments - ############################################################ - - emp_moments = get_empirical_moments(agent.name) - - ############################################################ - # Get initial guess - ############################################################ - - initial_guess = get_initial_guess( - agent.name, - params_to_estimate, - tables_dir, - ) - - ############################################################ - # Estimate model - ############################################################ - - if estimate_model: - model_estimate, time_to_estimate = do_estimate_model( - agent, - emp_moments, - initial_guess, - minimize_options=minimize_options, - ) - - # Compute standard errors by bootstrap - if compute_se_bootstrap: - do_compute_se_boostrap( - agent, - model_estimate, - time_to_estimate, - **bootstrap_options, - ) - - # Compute sensitivity measure - if compute_sensitivity: - do_compute_sensitivity( - agent, - model_estimate, - initial_guess, - ) - - # Make a contour plot of the objective function - if make_contour_plot: - do_make_contour_plot( - agent, - model_estimate, - emp_moments, - ) - - -if __name__ == "__main__": - # Set booleans to determine which tasks should be done - # Which agent type to estimate ("IndShock" or "Portfolio") - local_agent_name = "IndShock" - local_params_to_estimate = ["CRRA", "DiscFac"] - local_estimate_model = True # Whether to estimate the model - # Whether to get standard errors via bootstrap - local_compute_se_bootstrap = False - # Whether to compute a measure of estimates' sensitivity to moments - local_compute_sensitivity = False - # Whether to make a contour map of the objective function - local_make_contour_plot = False - # Whether to use subjective beliefs - local_subjective_stock = False - local_subjective_labor = False - - estimate( - init_agent_name=local_agent_name, - params_to_estimate=local_params_to_estimate, - estimate_model=local_estimate_model, - compute_se_bootstrap=local_compute_se_bootstrap, - compute_sensitivity=local_compute_sensitivity, - make_contour_plot=local_make_contour_plot, - subjective_stock=local_subjective_stock, - subjective_labor=local_subjective_labor, - ) diff --git a/code/estimark/min.py b/code/estimark/min.py new file mode 100644 index 0000000..f6adea7 --- /dev/null +++ b/code/estimark/min.py @@ -0,0 +1,144 @@ +from estimark.estimation import ( + do_compute_se_boostrap, + do_compute_sensitivity, + do_estimate_model, + do_make_contour_plot, + get_empirical_moments, + get_initial_guess, + make_agent, +) +from estimark.parameters import bootstrap_options, minimize_options +from pathlib import Path + + +# Pathnames to the other files: +# Relative directory for primitive parameter files +tables_dir = "content/tables/min/" +Path(tables_dir).mkdir(parents=True, exist_ok=True) +# Relative directory for primitive parameter files +figures_dir = "content/figures/min/" +Path(figures_dir).mkdir(parents=True, exist_ok=True) + + +def estimate_min( + init_agent_name, + params_to_estimate, + estimate_model=True, + compute_se_bootstrap=False, + compute_sensitivity=False, + make_contour_plot=False, + subjective_stock=False, + subjective_labor=False, +): + """Run the main estimation procedure for SolvingMicroDSOP. + + Parameters + ---------- + estimate_model : bool + Whether to estimate the model using Nelder-Mead. When True, this is a low-time, low-memory operation. + + compute_standard_errors : bool + Whether to compute standard errors on the estiamtion of the model. + + make_contour_plot : bool + Whether to make the contour plot associate with the estiamte. + + Returns + ------- + None + + """ + ############################################################ + # Make agent + ############################################################ + + agent = make_agent( + init_agent_name=init_agent_name, + subjective_stock=subjective_stock, + subjective_labor=subjective_labor, + ) + + ############################################################ + # Get empirical moments + ############################################################ + + emp_moments = get_empirical_moments(agent.name) + + ############################################################ + # Get initial guess + ############################################################ + + initial_guess = get_initial_guess( + agent.name, + params_to_estimate, + tables_dir, + ) + + ############################################################ + # Estimate model + ############################################################ + + if estimate_model: + model_estimate, time_to_estimate = do_estimate_model( + agent, + emp_moments, + initial_guess, + minimize_options=minimize_options, + tables_dir=tables_dir, + ) + + # Compute standard errors by bootstrap + if compute_se_bootstrap: + do_compute_se_boostrap( + agent, + model_estimate, + time_to_estimate, + tables_dir=tables_dir, + **bootstrap_options, + ) + + # Compute sensitivity measure + if compute_sensitivity: + do_compute_sensitivity( + agent, + model_estimate, + initial_guess, + figures_dir=figures_dir, + ) + + # Make a contour plot of the objective function + if make_contour_plot: + do_make_contour_plot( + agent, + model_estimate, + emp_moments, + figures_dir=figures_dir, + ) + + +if __name__ == "__main__": + # Set booleans to determine which tasks should be done + # Which agent type to estimate ("IndShock" or "Portfolio") + local_agent_name = "Portfolio" + local_params_to_estimate = ["CRRA", "DiscFac"] + local_estimate_model = True # Whether to estimate the model + # Whether to get standard errors via bootstrap + local_compute_se_bootstrap = False + # Whether to compute a measure of estimates' sensitivity to moments + local_compute_sensitivity = False + # Whether to make a contour map of the objective function + local_make_contour_plot = False + # Whether to use subjective beliefs + local_subjective_stock = False + local_subjective_labor = False + + estimate_min( + init_agent_name=local_agent_name, + params_to_estimate=local_params_to_estimate, + estimate_model=local_estimate_model, + compute_se_bootstrap=local_compute_se_bootstrap, + compute_sensitivity=local_compute_sensitivity, + make_contour_plot=local_make_contour_plot, + subjective_stock=local_subjective_stock, + subjective_labor=local_subjective_labor, + ) diff --git a/code/estimark/msm.py b/code/estimark/msm.py index 370418c..3134352 100644 --- a/code/estimark/msm.py +++ b/code/estimark/msm.py @@ -1,58 +1,32 @@ -import csv from pathlib import Path from time import time import estimagic as em -import numpy as np from estimark.estimation import ( get_empirical_moments, get_initial_guess, - get_weighted_moments, + get_moments_cov, make_agent, - simulate_moments, save_results, + simulate_moments, ) # Parameters for the consumer type and the estimation from estimark.parameters import ( - age_mapping, init_params_options, minimize_options, ) # SCF 2004 data on household wealth -from estimark.scf import scf_data - -msm_dir = "content/tables/msm/" -Path(msm_dir).mkdir(parents=True, exist_ok=True) - - -def get_moments_cov(agent_name, emp_moments): - moments_cov = em.get_moments_cov( - scf_data, - get_weighted_moments, - moment_kwargs={ - "variable": "wealth_income_ratio", - "weights": "weight", - "groups": "age_group", - "mapping": age_mapping, - }, - ) - - if "Port" in agent_name: - # how many keys in emp_moments contain "_port" - n_port = sum("_port" in key for key in emp_moments.keys()) - share_moments_cov = np.diag(np.ones(n_port)) - - moments_cov = np.block( - [ - [moments_cov, np.zeros((moments_cov.shape[0], n_port))], - [np.zeros((n_port, moments_cov.shape[1])), share_moments_cov], - ], - ) - return moments_cov +# Pathnames to the other files: +# Relative directory for primitive parameter files +tables_dir = "content/tables/msm/" +Path(tables_dir).mkdir(parents=True, exist_ok=True) +# Relative directory for primitive parameter files +figures_dir = "content/figures/msm/" +Path(figures_dir).mkdir(parents=True, exist_ok=True) def estimate_msm( @@ -93,7 +67,7 @@ def estimate_msm( # Get initial guess ############################################################ - initial_guess = get_initial_guess(agent.name, params_to_estimate, msm_dir) + initial_guess = get_initial_guess(agent.name, params_to_estimate, tables_dir) print("Estimating MSM...") @@ -126,13 +100,13 @@ def estimate_msm( print("MSM estimation complete.") - save_results(res, agent.name, time_to_estimate, msm_dir, "_params") + save_results(res, agent.name, time_to_estimate, tables_dir, "_params") if __name__ == "__main__": # Set booleans to determine which tasks should be done # Which agent type to estimate ("IndShock" or "Portfolio") - local_agent_name = "IndShock" + local_agent_name = "Portfolio" # Whether to use subjective beliefs local_subjective_stock = False diff --git a/code/estimark/parameters.py b/code/estimark/parameters.py index 7bc6954..689c420 100644 --- a/code/estimark/parameters.py +++ b/code/estimark/parameters.py @@ -15,7 +15,7 @@ # Assets grid exp_nest = 1 # Number of times to "exponentially nest" when constructing a_grid aXtraMin = 0.001 # Minimum end-of-period "assets above minimum" value -aXtraMax = 20 # Maximum end-of-period "assets above minimum" value +aXtraMax = 100 # Maximum end-of-period "assets above minimum" value aXtraCount = 20 # Number of points in the grid of "assets above minimum" # Artificial borrowing constraint @@ -145,8 +145,10 @@ "algo_options": { "convergence.absolute_params_tolerance": 1e-3, "convergence.absolute_criterion_tolerance": 1e-3, + "stopping.max_iterations": 50, + "stopping.max_criterion_evaluations": 100, + # "n_cores": 12, }, - # "algorithm": "scipy_lbfgsb", # "numdiff_options": {"n_cores": 12}, } diff --git a/code/run_all.py b/code/run_all.py index b0f9565..b122acf 100644 --- a/code/run_all.py +++ b/code/run_all.py @@ -1,6 +1,6 @@ import dask from dask.distributed import Client -from estimark.estimation import estimate +from estimark.min import estimate_min from estimark.options import ( all_replications, high_resource, @@ -70,7 +70,7 @@ def run_replication(): replication_specs["subjective_labor"] = True print("Adding subjective labor market beliefs...") - lazy_result = dask.delayed(estimate)(**replication_specs) + lazy_result = dask.delayed(estimate_min)(**replication_specs) lazy_results.append(lazy_result) dask.compute(*lazy_results) diff --git a/code/tests.py b/code/tests.py index c09474b..bdf5425 100644 --- a/code/tests.py +++ b/code/tests.py @@ -1,32 +1,32 @@ -from estimark.estimation import estimate +from estimark.min import estimate_min from estimark.options import low_resource, medium_resource def test_low_resource(): print("Running low-resource replication...") - estimate(**low_resource) + estimate_min(**low_resource) def test_medium_resource(): print("Running medium-resource replication...") - estimate(**medium_resource) + estimate_min(**medium_resource) def test_portfolio_low_resource(): print("Running medium-resource replication...") - estimate(**low_resource, init_agent_name="Portfolio") + estimate_min(**low_resource, init_agent_name="Portfolio") def test_warmglow_low_resource(): print("Running medium-resource replication...") - estimate(**low_resource, init_agent_name="WarmGlow") + estimate_min(**low_resource, init_agent_name="WarmGlow") def test_warmglowportfolio_low_resource(): print("Running medium-resource replication...") - estimate(**low_resource, init_agent_name="WarmGlowPortfolio") + estimate_min(**low_resource, init_agent_name="WarmGlowPortfolio") def test_wealthportfolio_low_resource(): print("Running medium-resource replication...") - estimate(**low_resource, init_agent_name="WealthPortfolio") + estimate_min(**low_resource, init_agent_name="WealthPortfolio") diff --git a/content/tables/IndShockSub(Labor)Market_estimate_results.csv b/content/tables/IndShockSub(Labor)Market_estimate_results.csv index 0eaee39..72d0504 100644 --- a/content/tables/IndShockSub(Labor)Market_estimate_results.csv +++ b/content/tables/IndShockSub(Labor)Market_estimate_results.csv @@ -1,15 +1,15 @@ CRRA,20.0 DiscFac,1.0 -time_to_estimate,166.9264132976532 +time_to_estimate,124.87122821807861 params,"{'CRRA': 20.0, 'DiscFac': 1.0}" -criterion,562.694967726188 -start_criterion,1091.723914842073 -start_params,"{'CRRA': 5.0, 'DiscFac': 0.95}" +criterion,544.5282150454914 +start_criterion,544.7352756884602 +start_params,"{'CRRA': 20.0, 'DiscFac': 1.0}" algorithm,multistart_scipy_neldermead direction,minimize n_free,2 message,Optimization terminated successfully. success,True -n_criterion_evaluations,24 +n_criterion_evaluations,13 n_derivative_evaluations, -n_iterations,13 +n_iterations,6 diff --git a/content/tables/IndShockSub(Stock)(Labor)Market_estimate_results.csv b/content/tables/IndShockSub(Stock)(Labor)Market_estimate_results.csv index 854948f..b8398a8 100644 --- a/content/tables/IndShockSub(Stock)(Labor)Market_estimate_results.csv +++ b/content/tables/IndShockSub(Stock)(Labor)Market_estimate_results.csv @@ -1,15 +1,15 @@ CRRA,20.0 DiscFac,1.0 -time_to_estimate,166.9813163280487 +time_to_estimate,126.26256227493286 params,"{'CRRA': 20.0, 'DiscFac': 1.0}" -criterion,575.865531975731 -start_criterion,1115.9263844617587 -start_params,"{'CRRA': 5.0, 'DiscFac': 0.95}" +criterion,557.4368802957166 +start_criterion,557.6869633061931 +start_params,"{'CRRA': 20.0, 'DiscFac': 1.0}" algorithm,multistart_scipy_neldermead direction,minimize n_free,2 message,Optimization terminated successfully. success,True -n_criterion_evaluations,24 +n_criterion_evaluations,13 n_derivative_evaluations, -n_iterations,13 +n_iterations,6 diff --git a/content/tables/IndShockSub(Stock)Market_estimate_results.csv b/content/tables/IndShockSub(Stock)Market_estimate_results.csv index 44e0440..85f2c64 100644 --- a/content/tables/IndShockSub(Stock)Market_estimate_results.csv +++ b/content/tables/IndShockSub(Stock)Market_estimate_results.csv @@ -1,15 +1,15 @@ -CRRA,7.02580153071005 -DiscFac,0.9821557198347557 -time_to_estimate,453.12678694725037 -params,"{'CRRA': 7.02580153071005, 'DiscFac': 0.9821557198347557}" -criterion,528.1077787460181 -start_criterion,636.2158488899107 -start_params,"{'CRRA': 5.0, 'DiscFac': 0.95}" +CRRA,6.054570670364653 +DiscFac,0.9862525466473355 +time_to_estimate,407.98607778549194 +params,"{'CRRA': 6.054570670364653, 'DiscFac': 0.9862525466473355}" +criterion,532.5629663834426 +start_criterion,534.9462229937646 +start_params,"{'CRRA': 7.02580153071005, 'DiscFac': 0.9821557198347557}" algorithm,multistart_scipy_neldermead direction,minimize n_free,2 message,Optimization terminated successfully. success,True -n_criterion_evaluations,151 +n_criterion_evaluations,155 n_derivative_evaluations, -n_iterations,75 +n_iterations,72 diff --git a/content/tables/IndShock_estimate_results.csv b/content/tables/IndShock_estimate_results.csv index 31a366f..6f3c268 100644 --- a/content/tables/IndShock_estimate_results.csv +++ b/content/tables/IndShock_estimate_results.csv @@ -1,15 +1,15 @@ -CRRA,7.0792573883887195 -DiscFac,0.9710907218282636 -time_to_estimate,265.2772467136383 -params,"{'CRRA': 7.0792573883887195, 'DiscFac': 0.9710907218282636}" -criterion,497.887755198283 -start_criterion,497.887755198283 -start_params,"{'CRRA': 7.0792573883887195, 'DiscFac': 0.9710907218282636}" -algorithm,multistart_scipy_neldermead -direction,minimize -n_free,2 -message,Optimization terminated successfully. -success,True -n_criterion_evaluations,126 -n_derivative_evaluations, -n_iterations,61 +CRRA,6.526991832288527 +DiscFac,0.9739934841042822 +time_to_estimate,399.25848603248596 +params,"{'CRRA': 6.526991832288527, 'DiscFac': 0.9739934841042822}" +criterion,501.12312447594826 +start_criterion,502.30240594034615 +start_params,"{'CRRA': 7.0792573883887195, 'DiscFac': 0.9710907218282636}" +algorithm,multistart_scipy_neldermead +direction,minimize +n_free,2 +message,Optimization terminated successfully. +success,True +n_criterion_evaluations,149 +n_derivative_evaluations, +n_iterations,69 diff --git a/content/tables/PortfolioSub(Labor)Market_estimate_results.csv b/content/tables/PortfolioSub(Labor)Market_estimate_results.csv new file mode 100644 index 0000000..60faaf5 --- /dev/null +++ b/content/tables/PortfolioSub(Labor)Market_estimate_results.csv @@ -0,0 +1,15 @@ +CRRA,5.865453132577567 +DiscFac,0.5 +time_to_estimate,751.97678399086 +params,"{'CRRA': 5.865453132577567, 'DiscFac': 0.5}" +criterion,0.923070680889991 +start_criterion,5.27642528130259 +start_params,"{'CRRA': 5.0, 'DiscFac': 0.95}" +algorithm,multistart_scipy_neldermead +direction,minimize +n_free,2 +message,Maximum number of iterations has been exceeded. +success,False +n_criterion_evaluations,268 +n_derivative_evaluations, +n_iterations,100 diff --git a/content/tables/PortfolioSub(Stock)(Labor)Market_estimate_results.csv b/content/tables/PortfolioSub(Stock)(Labor)Market_estimate_results.csv index 454324b..8a37dd7 100644 --- a/content/tables/PortfolioSub(Stock)(Labor)Market_estimate_results.csv +++ b/content/tables/PortfolioSub(Stock)(Labor)Market_estimate_results.csv @@ -1,15 +1,15 @@ -CRRA,5.278040599215181 -DiscFac,0.6460704140717104 -time_to_estimate,466.3470206260681 -params,"{'CRRA': 5.278040599215181, 'DiscFac': 0.6460704140717104}" -criterion,0.9586251907598755 -start_criterion,3.236297547891923 -start_params,"{'CRRA': 5.0, 'DiscFac': 0.95}" +CRRA,4.724872715799437 +DiscFac,0.5827256679465178 +time_to_estimate,404.2306773662567 +params,"{'CRRA': 4.724872715799437, 'DiscFac': 0.5827256679465178}" +criterion,0.953237438372669 +start_criterion,3.7130193420488324 +start_params,"{'CRRA': 5.278040599215181, 'DiscFac': 0.6460704140717104}" algorithm,multistart_scipy_neldermead direction,minimize n_free,2 message,Optimization terminated successfully. success,True -n_criterion_evaluations,113 +n_criterion_evaluations,103 n_derivative_evaluations, -n_iterations,58 +n_iterations,50 diff --git a/content/tables/PortfolioSub(Stock)Market_estimate_results.csv b/content/tables/PortfolioSub(Stock)Market_estimate_results.csv index 9d08990..74a770f 100644 --- a/content/tables/PortfolioSub(Stock)Market_estimate_results.csv +++ b/content/tables/PortfolioSub(Stock)Market_estimate_results.csv @@ -1,15 +1,15 @@ -CRRA,4.6378134894615615 +CRRA,3.9886633995822067 DiscFac,0.5 -time_to_estimate,296.98850679397583 -params,"{'CRRA': 4.6378134894615615, 'DiscFac': 0.5}" -criterion,1.177996454996367 -start_criterion,1.7122028387950428 -start_params,"{'CRRA': 5.0, 'DiscFac': 0.95}" +time_to_estimate,285.0257930755615 +params,"{'CRRA': 3.9886633995822067, 'DiscFac': 0.5}" +criterion,1.0425570066466112 +start_criterion,3.7728432111104273 +start_params,"{'CRRA': 4.6378134894615615, 'DiscFac': 0.5}" algorithm,multistart_scipy_neldermead direction,minimize n_free,2 message,Optimization terminated successfully. success,True -n_criterion_evaluations,86 +n_criterion_evaluations,91 n_derivative_evaluations, -n_iterations,42 +n_iterations,47 diff --git a/content/tables/Portfolio_estimate_results.csv b/content/tables/Portfolio_estimate_results.csv new file mode 100644 index 0000000..3b39113 --- /dev/null +++ b/content/tables/Portfolio_estimate_results.csv @@ -0,0 +1,15 @@ +CRRA,3.0761208392259816 +DiscFac,0.5757132378363539 +time_to_estimate,580.4633679389954 +params,"{'CRRA': 3.0761208392259816, 'DiscFac': 0.5757132378363539}" +criterion,2.3565297732828996 +start_criterion,5.266598881640827 +start_params,"{'CRRA': 3.1517962160236057, 'DiscFac': 0.5742414027038963}" +algorithm,multistart_scipy_neldermead +direction,minimize +n_free,2 +message,Maximum number of iterations has been exceeded. +success,False +n_criterion_evaluations,270 +n_derivative_evaluations, +n_iterations,100 diff --git a/content/tables/WarmGlowPortfolioSub(Labor)Market_estimate_results.csv b/content/tables/WarmGlowPortfolioSub(Labor)Market_estimate_results.csv new file mode 100644 index 0000000..96a4200 --- /dev/null +++ b/content/tables/WarmGlowPortfolioSub(Labor)Market_estimate_results.csv @@ -0,0 +1,15 @@ +CRRA,5.865453132577567 +DiscFac,0.5 +time_to_estimate,755.4963464736938 +params,"{'CRRA': 5.865453132577567, 'DiscFac': 0.5}" +criterion,0.923070680889991 +start_criterion,5.276425253120833 +start_params,"{'CRRA': 5.0, 'DiscFac': 0.95}" +algorithm,multistart_scipy_neldermead +direction,minimize +n_free,2 +message,Maximum number of iterations has been exceeded. +success,False +n_criterion_evaluations,268 +n_derivative_evaluations, +n_iterations,100 diff --git a/content/tables/WarmGlowPortfolioSub(Stock)(Labor)Market_estimate_results.csv b/content/tables/WarmGlowPortfolioSub(Stock)(Labor)Market_estimate_results.csv index 0a6536d..3dea548 100644 --- a/content/tables/WarmGlowPortfolioSub(Stock)(Labor)Market_estimate_results.csv +++ b/content/tables/WarmGlowPortfolioSub(Stock)(Labor)Market_estimate_results.csv @@ -1,15 +1,15 @@ -CRRA,5.278040599215181 -DiscFac,0.6460704140717104 -time_to_estimate,463.825003862381 -params,"{'CRRA': 5.278040599215181, 'DiscFac': 0.6460704140717104}" -criterion,0.9586251907598755 -start_criterion,3.236297547641285 -start_params,"{'CRRA': 5.0, 'DiscFac': 0.95}" +CRRA,4.724872715799437 +DiscFac,0.5827256679465178 +time_to_estimate,403.1223566532135 +params,"{'CRRA': 4.724872715799437, 'DiscFac': 0.5827256679465178}" +criterion,0.9532374383726688 +start_criterion,3.7130193420488258 +start_params,"{'CRRA': 5.278040599215181, 'DiscFac': 0.6460704140717104}" algorithm,multistart_scipy_neldermead direction,minimize n_free,2 message,Optimization terminated successfully. success,True -n_criterion_evaluations,113 +n_criterion_evaluations,103 n_derivative_evaluations, -n_iterations,58 +n_iterations,50 diff --git a/content/tables/WarmGlowPortfolioSub(Stock)Market_estimate_results.csv b/content/tables/WarmGlowPortfolioSub(Stock)Market_estimate_results.csv index 11ca5b3..16bab14 100644 --- a/content/tables/WarmGlowPortfolioSub(Stock)Market_estimate_results.csv +++ b/content/tables/WarmGlowPortfolioSub(Stock)Market_estimate_results.csv @@ -1,15 +1,15 @@ -CRRA,4.6378134894615615 +CRRA,3.9886633995822067 DiscFac,0.5 -time_to_estimate,294.00997853279114 -params,"{'CRRA': 4.6378134894615615, 'DiscFac': 0.5}" -criterion,1.1779964549963657 -start_criterion,1.712202832710532 -start_params,"{'CRRA': 5.0, 'DiscFac': 0.95}" +time_to_estimate,284.14713644981384 +params,"{'CRRA': 3.9886633995822067, 'DiscFac': 0.5}" +criterion,1.0425570066465277 +start_criterion,3.7728432111103603 +start_params,"{'CRRA': 4.6378134894615615, 'DiscFac': 0.5}" algorithm,multistart_scipy_neldermead direction,minimize n_free,2 message,Optimization terminated successfully. success,True -n_criterion_evaluations,86 +n_criterion_evaluations,91 n_derivative_evaluations, -n_iterations,42 +n_iterations,47 diff --git a/content/tables/WarmGlowPortfolio_estimate_results.csv b/content/tables/WarmGlowPortfolio_estimate_results.csv new file mode 100644 index 0000000..d1b2e02 --- /dev/null +++ b/content/tables/WarmGlowPortfolio_estimate_results.csv @@ -0,0 +1,15 @@ +CRRA,4.824889380065167 +DiscFac,0.5 +time_to_estimate,553.7847819328308 +params,"{'CRRA': 4.824889380065167, 'DiscFac': 0.5}" +criterion,1.7700699649737257 +start_criterion,3.1144499795897445 +start_params,"{'CRRA': 5.0, 'DiscFac': 0.95}" +algorithm,multistart_scipy_neldermead +direction,minimize +n_free,2 +message,Maximum number of iterations has been exceeded. +success,False +n_criterion_evaluations,254 +n_derivative_evaluations, +n_iterations,100 diff --git a/content/tables/WarmGlowSub(Labor)Market_estimate_results.csv b/content/tables/WarmGlowSub(Labor)Market_estimate_results.csv index 20196c6..f6a6992 100644 --- a/content/tables/WarmGlowSub(Labor)Market_estimate_results.csv +++ b/content/tables/WarmGlowSub(Labor)Market_estimate_results.csv @@ -1,15 +1,15 @@ -CRRA,5.4407958984375 +CRRA,1.1 DiscFac,1.0 -time_to_estimate,427.5443205833435 -params,"{'CRRA': 5.4407958984375, 'DiscFac': 1.0}" -criterion,716.0373514721741 -start_criterion,1041.1181541285023 -start_params,"{'CRRA': 5.0, 'DiscFac': 0.95}" +time_to_estimate,200.14172959327698 +params,"{'CRRA': 1.1, 'DiscFac': 1.0}" +criterion,616.3227769557907 +start_criterion,704.2852785327993 +start_params,"{'CRRA': 5.4407958984375, 'DiscFac': 1.0}" algorithm,multistart_scipy_neldermead direction,minimize n_free,2 message,Optimization terminated successfully. success,True -n_criterion_evaluations,103 +n_criterion_evaluations,33 n_derivative_evaluations, -n_iterations,55 +n_iterations,20 diff --git a/content/tables/WarmGlowSub(Stock)(Labor)Market_estimate_results.csv b/content/tables/WarmGlowSub(Stock)(Labor)Market_estimate_results.csv index e231e8d..7d814d6 100644 --- a/content/tables/WarmGlowSub(Stock)(Labor)Market_estimate_results.csv +++ b/content/tables/WarmGlowSub(Stock)(Labor)Market_estimate_results.csv @@ -1,15 +1,15 @@ -CRRA,6.590661406517029 +CRRA,6.385896487706444 DiscFac,1.0 -time_to_estimate,607.3060421943665 -params,"{'CRRA': 6.590661406517029, 'DiscFac': 1.0}" -criterion,781.5156069337606 -start_criterion,1077.2295229251981 -start_params,"{'CRRA': 5.0, 'DiscFac': 0.95}" +time_to_estimate,614.8144376277924 +params,"{'CRRA': 6.385896487706444, 'DiscFac': 1.0}" +criterion,774.1714126356081 +start_criterion,769.1547323613637 +start_params,"{'CRRA': 6.590661406517029, 'DiscFac': 1.0}" algorithm,multistart_scipy_neldermead direction,minimize n_free,2 -message,Optimization terminated successfully. -success,True -n_criterion_evaluations,180 +message,Maximum number of iterations has been exceeded. +success,False +n_criterion_evaluations,208 n_derivative_evaluations, -n_iterations,85 +n_iterations,100 diff --git a/content/tables/WarmGlowSub(Stock)Market_estimate_results.csv b/content/tables/WarmGlowSub(Stock)Market_estimate_results.csv index 8ee9843..ebe13cb 100644 --- a/content/tables/WarmGlowSub(Stock)Market_estimate_results.csv +++ b/content/tables/WarmGlowSub(Stock)Market_estimate_results.csv @@ -1,15 +1,15 @@ -CRRA,4.985237150336616 -DiscFac,0.9934927501861235 -time_to_estimate,433.9389910697937 -params,"{'CRRA': 4.985237150336616, 'DiscFac': 0.9934927501861235}" -criterion,491.03160837625785 -start_criterion,577.8965828401128 -start_params,"{'CRRA': 5.0, 'DiscFac': 0.95}" +CRRA,3.6766995632322557 +DiscFac,1.0 +time_to_estimate,382.6571476459503 +params,"{'CRRA': 3.6766995632322557, 'DiscFac': 1.0}" +criterion,508.4490874190184 +start_criterion,nan +start_params,"{'CRRA': 4.985237150336616, 'DiscFac': 0.9934927501861235}" algorithm,multistart_scipy_neldermead direction,minimize n_free,2 message,Optimization terminated successfully. success,True -n_criterion_evaluations,143 +n_criterion_evaluations,135 n_derivative_evaluations, -n_iterations,68 +n_iterations,67 diff --git a/content/tables/WarmGlow_estimate_results.csv b/content/tables/WarmGlow_estimate_results.csv index 5422471..4f94c93 100644 --- a/content/tables/WarmGlow_estimate_results.csv +++ b/content/tables/WarmGlow_estimate_results.csv @@ -1,15 +1,15 @@ -CRRA,4.297116224347462 -DiscFac,1.0 -time_to_estimate,445.9531614780426 -params,"{'CRRA': 4.297116224347462, 'DiscFac': 1.0}" -criterion,470.48292496760513 +CRRA,3.2410996113130945 +DiscFac,0.996449988698152 +time_to_estimate,413.6879527568817 +params,"{'CRRA': 3.2410996113130945, 'DiscFac': 0.996449988698152}" +criterion,482.5715668635871 start_criterion,nan -start_params,"{'CRRA': 5.0, 'DiscFac': 0.95}" +start_params,"{'CRRA': 4.297116224347462, 'DiscFac': 1.0}" algorithm,multistart_scipy_neldermead direction,minimize n_free,2 message,Optimization terminated successfully. success,True -n_criterion_evaluations,149 +n_criterion_evaluations,156 n_derivative_evaluations, -n_iterations,70 +n_iterations,79 diff --git a/content/tables/WealthPortfolioSub(Labor)Market_estimate_results.csv b/content/tables/WealthPortfolioSub(Labor)Market_estimate_results.csv index e3db0f8..ea92083 100644 --- a/content/tables/WealthPortfolioSub(Labor)Market_estimate_results.csv +++ b/content/tables/WealthPortfolioSub(Labor)Market_estimate_results.csv @@ -1,15 +1,15 @@ -CRRA,1.2322318491428117 +CRRA,1.1 DiscFac,0.5 -time_to_estimate,403.5017123222351 -params,"{'CRRA': 1.2322318491428117, 'DiscFac': 0.5}" -criterion,6.103508613447084 -start_criterion,1.9056233601020711 -start_params,"{'CRRA': 5.0, 'DiscFac': 0.95}" +time_to_estimate,222.81176948547363 +params,"{'CRRA': 1.1, 'DiscFac': 0.5}" +criterion,6.229663982456266 +start_criterion,4.013578484230534 +start_params,"{'CRRA': 1.1, 'DiscFac': 0.5}" algorithm,multistart_scipy_neldermead direction,minimize n_free,2 message,Optimization terminated successfully. success,True -n_criterion_evaluations,69 +n_criterion_evaluations,27 n_derivative_evaluations, -n_iterations,38 +n_iterations,14 diff --git a/content/tables/WealthPortfolioSub(Stock)(Labor)Market_estimate_results.csv b/content/tables/WealthPortfolioSub(Stock)(Labor)Market_estimate_results.csv index c1136b2..622092d 100644 --- a/content/tables/WealthPortfolioSub(Stock)(Labor)Market_estimate_results.csv +++ b/content/tables/WealthPortfolioSub(Stock)(Labor)Market_estimate_results.csv @@ -1,15 +1,15 @@ -CRRA,1.4163626423462197 +CRRA,1.2462065213787068 DiscFac,0.5 -time_to_estimate,396.4375936985016 -params,"{'CRRA': 1.4163626423462197, 'DiscFac': 0.5}" -criterion,5.627150500685743 -start_criterion,2.1017597844874185 -start_params,"{'CRRA': 5.0, 'DiscFac': 0.95}" +time_to_estimate,384.6623764038086 +params,"{'CRRA': 1.2462065213787068, 'DiscFac': 0.5}" +criterion,5.833521811732498 +start_criterion,4.020725417438446 +start_params,"{'CRRA': 1.4163626423462197, 'DiscFac': 0.5}" algorithm,multistart_scipy_neldermead direction,minimize n_free,2 message,Optimization terminated successfully. success,True -n_criterion_evaluations,66 +n_criterion_evaluations,73 n_derivative_evaluations, -n_iterations,34 +n_iterations,36 diff --git a/content/tables/WealthPortfolioSub(Stock)Market_estimate_results.csv b/content/tables/WealthPortfolioSub(Stock)Market_estimate_results.csv index 927461c..e81c536 100644 --- a/content/tables/WealthPortfolioSub(Stock)Market_estimate_results.csv +++ b/content/tables/WealthPortfolioSub(Stock)Market_estimate_results.csv @@ -1,15 +1,15 @@ CRRA,1.1 DiscFac,0.5 -time_to_estimate,230.61838388442993 +time_to_estimate,184.4830780029297 params,"{'CRRA': 1.1, 'DiscFac': 0.5}" -criterion,6.067050120794328 -start_criterion,1.6900017447749627 -start_params,"{'CRRA': 5.0, 'DiscFac': 0.95}" +criterion,6.244341789694212 +start_criterion,4.01918953565245 +start_params,"{'CRRA': 1.1, 'DiscFac': 0.5}" algorithm,multistart_scipy_neldermead direction,minimize n_free,2 message,Optimization terminated successfully. success,True -n_criterion_evaluations,41 +n_criterion_evaluations,28 n_derivative_evaluations, -n_iterations,22 +n_iterations,14 diff --git a/content/tables/WealthPortfolio_estimate_results.csv b/content/tables/WealthPortfolio_estimate_results.csv index 910bc05..a8fc9c6 100644 --- a/content/tables/WealthPortfolio_estimate_results.csv +++ b/content/tables/WealthPortfolio_estimate_results.csv @@ -1,15 +1,15 @@ CRRA,1.1 DiscFac,0.5 -time_to_estimate,239.4185471534729 +time_to_estimate,183.13626527786255 params,"{'CRRA': 1.1, 'DiscFac': 0.5}" -criterion,6.5458132852367 -start_criterion,1.618676051720708 -start_params,"{'CRRA': 5.0, 'DiscFac': 0.95}" +criterion,6.668610211284288 +start_criterion,4.00846573530044 +start_params,"{'CRRA': 1.1, 'DiscFac': 0.5}" algorithm,multistart_scipy_neldermead direction,minimize n_free,2 message,Optimization terminated successfully. success,True -n_criterion_evaluations,42 +n_criterion_evaluations,28 n_derivative_evaluations, -n_iterations,22 +n_iterations,14 diff --git a/content/tables/msm/Portfolio_estimate_results.csv b/content/tables/msm/Portfolio_estimate_results.csv new file mode 100644 index 0000000..10bd388 --- /dev/null +++ b/content/tables/msm/Portfolio_estimate_results.csv @@ -0,0 +1,3 @@ +CRRA,7.988151380338656 +DiscFac,0.7012415354852454 +time_to_estimate,247.5582902431488