I encountered a bug when running OLGModel10 using the latest toolkit. The error comes from the AgeConditionalStats call. The relevant error messages are shown below.
Unrecognized field name "n_semiz".
Error in CreateGridvals_FnsToEvaluate_FHorz (line 6)
N_semiz=prod(simoptions.n_semiz);
^^^^^^^^^^^^^^^^^^
Error in LifeCycleProfiles_FHorz_Case1_PType (line 480)
[n_z_temp,z_gridvals_J_temp,N_z_temp,l_z_temp,simoptions_temp]=CreateGridvals_FnsToEvaluate_FHorz(n_z_temp,z_grid_temp,N_j_temp,simoptions_temp,Parameters_temp);
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Error in OLGModel10 (line 245)
AgeConditionalStats = LifeCycleProfiles_FHorz_Case1_PType(StationaryDist,Policy,FnsToEvaluate,Params,n_d,n_a,n_z,N_j,N_i,d_grid,a_grid,z_grid,simoptions);
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
By the way, I noticed that in models with permanent types, such as OLGModel10, the initial distribution does not allocate agents across different types. Instead, the distribution is specified only over the other state dimensions as if there were no permanent types. My understanding is that the toolkit automatically further allocates the initial distribution that the user defines on the state-space dimensions according to the distribution of permanent types, similar to a re-normalization process. Is my understanding correct?
[I changed the internals so that instead of the default being that n_e and n_semiz were not created and the code has to check for them, the default is now that they are set =0 if the user does not declare them. Probably cut one-millionth of a second from run times, and just made the internal code a little easier to read and write. I had missed updating this command as part of that.]
VFI Toolkit has three broad options when doing the âjequaloneDistâ over the initial distribution of agents in a model with permanent types (the PType commands).
i) Create âjequaloneDistâ that does not depend in any way on permanent type, this is interpreted as applying to all permanent types (it is the âconditional on permanent typeâ initial distribution, and this is combined with the âpermanent type massesâ parameter).
ii) Create âjequaloneDistâ as a matrix with the final dimension being of length N_i. This is understood as indexing the permanent type, and so jequaloneDist(:,âŚ,:,ii) is understood as the initial distribution for the permanent type ii. When this is used the masses for the permanent types are based on jequaloneDist and a warning is shown telling you that this is being done and that the contents of the âpermanent type massesâ parameter is being ignored.
iii) Create jequaloneDist as a structure. The fieldnames() should be the Names_i.
Note that in models where the different permanent types use different state-spaces obviously only (iii) is possible.
Just to understand, if jequaloneDist is set as an array over the state variables without a permanent type dimension, this means that each type has the same distribution of (a,z,..) at age 1?
So for example, if there are two education types, the college educated and the no college educated have the same distribution of assets at age 1?
Yes, that is what I mean in (i), and the âpermanent type massesâ parameter is also important to this interpretation.
PS. If you are ever unsure how jequaloneDist is being interpreted you can just look in StationaryDist at the age j=1 agents, as this will contain what it was interpreted as.
The ValueFnIter for the permanent type still has a bug there.
>> OLGModel10
Test ValueFnIter
Unrecognized field name "semiz_grid".
Error in ValueFnIter_Case1_FHorz_PType (line 138)
if ~isstruct(vfoptions.semiz_grid)
^^^^^^^^^^^^^^^^^^^^
Error in OLGModel10 (line 163)
[V, Policy]=ValueFnIter_Case1_FHorz_PType(n_d,n_a,n_z,N_j,N_i,d_grid,a_grid,z_grid,pi_z,ReturnFn,Params,DiscountFactorParamNames,vfoptions);
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
I build some tests for FHorz PType so hopefully will have less of this kind of issue in the future. Helps me more easily test that changes are not breaking things.