Thanks for your reply, Robert! I sent to your email a Dropbox link.
Please run main.m with line 36 commented out:
%simoptions.whichstats = [1,1,1,2,0,0,0];
All is good and the screen output on my machine is:
Check pi_zh_J.low...
Check pi_zh_J.high...
Check pi_z_J.low...
Check pi_z_J.high...
Test ValueFnIter
Check size of value function
n_a, n_z(1), n_z(2), n_e, Age
201 7 2 5 80
201 7 2 5 80
Check size of policy function
2, n_a, n_z(1), n_z(2), n_e, Age
2 201 7 2 5 80
2 201 7 2 5 80
errV =
5.6843e-13
errP =
0
err_D =
8.6736e-19
ans =
'Possible Warning: Number of columns of n_z is the same as the number of permanent types.
This may just be coincidence as number of z variables is equal to number of permanent types.
If they are intended to be permanent types then n_z should have them as different rows (not columns).
'
> In EvalFnOnAgentDist_ValuesOnGrid_FHorz_Case1_PType (line 164)
In fun_model_moments (line 45)
In main (line 307)
ans =
'Possible Warning: Number of columns of n_z is the same as the number of permanent types.
This may just be coincidence as number of z variables is equal to number of permanent types.
If they are intended to be permanent types then n_z should have them as different rows (not columns).
'
> In EvalFnOnAgentDist_ValuesOnGrid_FHorz_Case1_PType (line 164)
In fun_model_moments (line 45)
In main (line 307)
ans =
logical
0
ans =
logical
0
ans =
logical
0
ans =
logical
0
RUNNING TIMES
VFI toolkit = 1.188982
VFI cpu = 3.514840
AgeStats = 17.585771
AllStats = 1.328889
Moments (my code) = 0.338687
If you uncomment line 36, on my machine I get the following error (after I run VFI and distribution…):
Check pi_zh_J.low...
Check pi_zh_J.high...
Check pi_z_J.low...
Check pi_z_J.high...
Test ValueFnIter
Check size of value function
n_a, n_z(1), n_z(2), n_e, Age
201 7 2 5 80
201 7 2 5 80
Check size of policy function
2, n_a, n_z(1), n_z(2), n_e, Age
2 201 7 2 5 80
2 201 7 2 5 80
errV =
5.6843e-13
errP =
0
err_D =
8.6736e-19
Error using gpuArray/interp1
Interpolation requires at least two sample points in each dimension.
Error in StatsFromWeightedGrid (line 158)
temp=interp1(CumSumSortedWeights2,CumSumSortedWeightedValues(u1index),llvec(1:end-1));
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Error in EvalFnOnAgentDist_AllStats_FHorz_Case1_PType (line 407)
AllStats.(CondlRestnFnNames{rr}).(FnsToEvalNames{ff}).(Names_i{ii})=StatsFromWeightedGrid(SortedValues,RestrictedSortedWeights,simoptions.npoints,simoptions.nquantiles,simoptions.tolerance,1,simoptions.whichstats); % 1 is presorted
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Error in main (line 303)
AllStats=EvalFnOnAgentDist_AllStats_FHorz_Case1_PType(StatDist,Policy,FnsToEval,Params,n_d,n_a,n_z,N_j,N_i,d_grid,a_grid,z_grid_J,simoptions);
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^