By running the simple Aiyagari example on the toolkit webpage, I found out that the default option for
vfoptions.howardsgreedy
is not set correctly. Howards greedy works well with small problems. I would change this block
if N_a<400 || N_z<20 % iterated (aka modified-Policy Fn Iteration) or greedy (aka Policy Fn Iteration)
vfoptions.howardsgreedy=1; % small one endogenous state models, use Howards greedy, everything else uses Howards iterations
else
vfoptions.howardsgreedy=0;
end
as
if N_a<400 && N_z<20 % iterated (aka modified-Policy Fn Iteration) or greedy (aka Policy Fn Iteration)
vfoptions.howardsgreedy=1; % small one endogenous state models, use Howards greedy, everything else uses Howards iterations
else
vfoptions.howardsgreedy=0;
end
You want to use Howards greedy if the number of grid points for a and for z is sufficiently small, and the criterion N_a<400 .AND. N_z<20 seems ok, but now the criterion is N_a<400 .OR. N_z<20 The code sets Howards greedy=1 if for example N_a=1200 and N_z=11 (my test case). This makes the code very slow
Grid sizes are: 1200 points for assets, and 11 points for exogenous shock
vfoptions.howardsgreedy = 0
Compute value function and stationary distribution
Time vfi: 0.330606
Time stat distrib: 0.109806
Time agg variables: 0.016426
With the default options we get
Grid sizes are: 1200 points for assets, and 11 points for exogenous shock
vfoptions.howardsgreedy = 1
Compute value function and stationary distribution
Time vfi: 12.047372
Time stat distrib: 0.111783
Time agg variables: 0.007656
At first I thought my GPU broke down ![]()