Error in StationaryDist_Case1

There is an error if I run my repo on the Pijoan-Mas model, available here: PijoanMasTaxes/main.m at main · aledinola/PijoanMasTaxes · GitHub

If I run main.m, I get an error at line 173:

% --- Stationary distribution
StatDist=StationaryDist_Case1(Policy,n_d,n_a,n_z,pi_z, simoptions);

The error message is:

Error using  + 
Arrays have incompatible sizes of 700 and 7 in dimension 2. In each dimension, the sizes must be
equal or one of the arrays must have size 1.

Error in StationaryDist_InfHorz_IterationTan_raw (line 11)
Policy_aprimez=Policy_aprime+N_a*(0:1:N_z-1);
                            ^
Error in StationaryDist_Case1 (line 310)
                StationaryDist=StationaryDist_InfHorz_IterationTan_raw(StationaryDist,Policy_aprime,N_a,N_z,pi_z,simoptions);
                               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Error in main (line 173)
StatDist=StationaryDist_Case1(Policy,n_d,n_a,n_z,pi_z, simoptions);
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Related documentation

Just run main.m as it is, and you will get the error. It used to work.

Should be fixed (was minor typo I left in when adding functionality for other setups). Thanks for letting me know.

1 Like

All good now, thanks for fixing the bug.

There is a new error in line 183 of main.m of my Pijoan-Mas repo (you can find the link above).
Line 183:

AllStats = EvalFnOnAgentDist_AllStats_Case1(StatDist, Policy, FnsToEvaluate, Params, [], n_d, n_a, n_z, d_grid, a_grid, z_grid,simoptions);

Error message:

Dot indexing is not supported for variables of this type.

Error in CreateGridvals_Policy (line 34)
if simoptions.gridinterplayer==1
   ^^^^^^^^^^^^^^^^^^^^^^^^^^
Error in EvalFnOnAgentDist_AllStats_Case1 (line 183)
    [d_gridvals, aprime_gridvals]=CreateGridvals_Policy(Policy,n_d,n_a,n_a,n_z,d_grid,a_grid,1, 2);
                                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Error in main (line 183)
AllStats = EvalFnOnAgentDist_AllStats_Case1(StatDist, Policy, FnsToEvaluate, Params, [], n_d, n_a, n_z, d_grid, a_grid, z_grid,simoptions);
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 

What is this error: simoptions should be a structure but instead it is a scalar double. Of course the indexing simoptions.something returns an error.

Important: the error happens only on the CPU (on my other laptop with GPU all is good).

AllStats is not presently supported by cpu (although maybe I need a better error message).

That said, if you think cpu support for AllStats is important just tell me and I will add it.

1 Like

No, not important for me, thanks!

Cool. I might clean up the error msg, but otherwise will just leave it :slight_smile:

1 Like

AllStats should now throw an error to complain that there is no gpu (when your matlab does not have gpu).

1 Like