Cocco Gomes and Maenhaout

The code to replicate Cocco et al breaks down after value function iteration,

Operator ‘==’ is not supported for operands of type ‘struct’.

Error in LifeCycleProfiles_FHorz_Case1_PType (line 581)
if simoptions.whichstats(1)==1
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Error in CoccoGomesMaenhout2005 (line 413)
AgeConditionalStats=LifeCycleProfiles_FHorz_Case1_PType(StationaryDist,Policy, FnsToEvaluate, Params,n_d,n_a,n_z,N_j,Names_i,d_grid,a_grid,z_grid_J, simoptions);
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

2 Likes

Hi, are you referring to the code on Robert’s OLGReadingList on Github (see below) or something else?
If I have time later I will run the code on my computer

2 Likes

I suspect it should say simoptions_temp instead of simoptions, didn’t error with other models but does for CGM2005 because N_j differs by permanent type (is the only model that does). I am however away from my computer until about 28th May so cannot fix it until then I’m afraid. [Is not just that one line, would be 10 or 20 lines that need that same change.]

I’ll let you know once I get a chance to fix this.

2 Likes

Hi @jake88, I have confirmed the mistake. It actually happens after the stationary distribution, in line 581 of LifeCycleProfiles_FHorz_Case1_PType

This is the relevant part of code:

if simoptions.whichstats(1)==1
                    AgeConditionalStats.(FnsToEvalNames{ff}).(Names_i{ii}).Mean=nan(1,length(simoptions_temp.agegroupings),'gpuArray');
                end
2 Likes

Fixed now, thanks for letting me know about it. You need to update to lastest toolkit from github.

(was the simoptions vs simoptions_temp thing I mentioned; is something that only exists internally)

1 Like