From f544d42fe30fda1adeafe3b689eb5bbb080ffbc6 Mon Sep 17 00:00:00 2001 From: Alan Lujan Date: Thu, 1 Feb 2024 10:02:51 -0500 Subject: [PATCH] update results by starting from previous results --- code/estimark/estimation.py | 15 ++++++++++++++- code/tables/IndShock_estimate_results.csv | 2 +- code/tables/Portfolio_estimate_results.csv | 4 ++-- .../tables/WarmGlowPortfolio_estimate_results.csv | 4 ++-- code/tables/WarmGlow_estimate_results.csv | 4 ++-- code/tables/WealthPortfolio_estimate_results.csv | 4 ++-- 6 files changed, 23 insertions(+), 10 deletions(-) diff --git a/code/estimark/estimation.py b/code/estimark/estimation.py index 222ca5c..c4d360c 100644 --- a/code/estimark/estimation.py +++ b/code/estimark/estimation.py @@ -22,6 +22,8 @@ ) from time import time # Timing utility +from pathlib import Path + import matplotlib.pyplot as plt import numpy as np # Numeric Python @@ -562,7 +564,18 @@ def estimate( targeted_moments = get_targeted_moments() - initial_guess = [parameters.DiscFacAdj_start, parameters.CRRA_start] + # start from previous estimation results if available + try: + csv_file_path = ( + Path(__file__).resolve().parent + / ".." + / "tables" + / (estimation_agent + "_estimate_results.csv") + ) + + initial_guess = np.genfromtxt(csv_file_path, skip_header=1, delimiter=",") + except: + initial_guess = [parameters.DiscFacAdj_start, parameters.CRRA_start] # Estimate the model using Nelder-Mead if estimate_model: diff --git a/code/tables/IndShock_estimate_results.csv b/code/tables/IndShock_estimate_results.csv index bac1e3f..b0f1419 100644 --- a/code/tables/IndShock_estimate_results.csv +++ b/code/tables/IndShock_estimate_results.csv @@ -1,2 +1,2 @@ DiscFacAdj,CRRA -0.8783572029816282,3.5160942263466355 +0.8689011612165243,3.796066262763537 diff --git a/code/tables/Portfolio_estimate_results.csv b/code/tables/Portfolio_estimate_results.csv index 5e40dc4..7f0ff3a 100644 --- a/code/tables/Portfolio_estimate_results.csv +++ b/code/tables/Portfolio_estimate_results.csv @@ -1,2 +1,2 @@ -DiscFacAdj,CRRA -0.866131986228827,3.7557510682554494 +DiscFacAdj,CRRA +0.8193095309029956,4.5574205165556725 diff --git a/code/tables/WarmGlowPortfolio_estimate_results.csv b/code/tables/WarmGlowPortfolio_estimate_results.csv index 492161a..c963817 100644 --- a/code/tables/WarmGlowPortfolio_estimate_results.csv +++ b/code/tables/WarmGlowPortfolio_estimate_results.csv @@ -1,2 +1,2 @@ -DiscFacAdj,CRRA -0.8642073648151234,3.8055353724199676 +DiscFacAdj,CRRA +0.8246562094500894,4.4642643726332185 diff --git a/code/tables/WarmGlow_estimate_results.csv b/code/tables/WarmGlow_estimate_results.csv index d50a9a0..04bca98 100644 --- a/code/tables/WarmGlow_estimate_results.csv +++ b/code/tables/WarmGlow_estimate_results.csv @@ -1,2 +1,2 @@ -DiscFacAdj,CRRA -0.8764224065671837,3.505877643073127 +DiscFacAdj,CRRA +0.8755702129442734,3.6158511660969577 diff --git a/code/tables/WealthPortfolio_estimate_results.csv b/code/tables/WealthPortfolio_estimate_results.csv index 94a3833..c8c4e32 100644 --- a/code/tables/WealthPortfolio_estimate_results.csv +++ b/code/tables/WealthPortfolio_estimate_results.csv @@ -1,2 +1,2 @@ -DiscFacAdj,CRRA -0.6013593197374101,5.031896157976007 +DiscFacAdj,CRRA +0.6326006490726698,5.943630057453893