/FUES_EGM

EGM using fast upper-envelope scan

Primary LanguagePython

FUES_EGM

The Endogenous grid method (EGM) using fast upper-envelope scan (FUES).

Initial beta replication material for `Fast upper-envelope scan for discrete-continuous dynamic programming' by Dobrescu and Shanker (2023).

See slides....pdf for overview of upper envelope scan.

Example use of FUES

Suppose we have the following arrays: an unrefined endogenous grid x_hat, the value correspondence on the unrefined grid v_hat and two policy functions, c_hat and a_prime_hat.

from FUES.FUES import FUES

x_clean, vf_clean, c_clean, a_prime_clean, dela \
        = FUES(x_hat, v_hat, c_hat, a_prime_hat, M_bar = 2, LB = 10)

The outputs are the refined grids, M_bar is the jump detection threshold and LB is the number of steps to take in the forward and backward scans.

Application 1

Plots

Consumption policy function generated using Ishkakov et al (2017) params and no smoothing:

ret_cons_all

Upper envelope generation using FUES and Ishkakov et al (2017) params (age 17):

ret_vf_aprime_all_17

Upper envelope and policy functions for Ishkakov et al (2017) params and smoothing param = 0.05:

ret_vf_aprime_all_17_sigma

ret_cons_all_sigma

Comparison with DC-EGM (age 17):

ret_vf_aprime_all_2000_cf_17

Comparison to DC-EGM

The following code block in retirement_plot.py compares DC-EGM with FUES across an array of parameter values:

https://github.com/akshayshanker/FUES_EGM/blob/fa725a6285fee9def7e8ad07606603a658cdccf6/retirement_plot.py#L381-L470

To perform the comparison, we first solve the full model using FUES, which gives the final solution computed using FUES and also the unrefined endogenous grids for each age. For a given age, we then compute the upper envelope using DC-EGM and FUES. The upper envelopes are compared on the optimal endogenous grid points as determined by DC-EGM.

(Compared on optimal points to avoid picking up errors arising from different interpolation steps used by DC-EGM and FUES. DC-EGM interpolates line segments on the unrefined grid while FUES first calculates the optimal points then interpolates over the unrefined grid.)

Test DC-EGM vs. FUES on uniform grid of 1000 parameters:
 beta: (0.85,0.98), y: (10,25), delta: (0.5,1.5)
Avg. error between DC-EGM and FUES: 0.000000
Timings:
 Avg. FUES time (secs): 0.001375
 Avg. worker iteration time (secs): 0.004314