Error in SimPanelValues_FHorz_Case1

I have found the error reported below when running the following line:

sim_panel = SimPanelValues_FHorz_Case1(jequaloneDist,Policy,FnsToEval,Params,[],n_d,n_a,n_z,N_j,d_grid,a_grid,z_grid,pi_z_J,simoptions);
Error using gpuArray/reshape
Number of elements must not change. Use [] as one of the size inputs to automatically calculate
the appropriate size for that dimension.

Error in KronPolicyIndexes_FHorz_Case1 (line 11)
Policy=reshape(Policy,[size(Policy,1),N_a,N_z,N_j]);
       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Error in SimPanelValues_FHorz_Case1 (line 78)
PolicyIndexes=KronPolicyIndexes_FHorz_Case1(Policy, n_d, n_a, n_z, N_j,simoptions); % Create it here as want it both here and inside SimPanelIndexes_FHorz_Case1 (which will recognise that it is already in this form)
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

My model has this “action space“: (d,aprime,a,semiz1,semiz2,semiz3,z)

I have to calculate some statistics such as the average change in wage conditional on unemployment spells of different duration and is complicated/I don’t know to do this with the agents distribution

This should be fixed now.

Actually I need to implement the simulate panel data commands with grid interpolation layer. Will try find time to do that at some point.

1 Like

Thanks, now it works!

Small comment: if I call SimPanelValues_FHorz_Case1 with gridinterplayer=1, the code returns an error message that is not very helpful (see below), whereas it should give a message like “panel simulation does not work yet with gridinterplayer=1“

Error using reshape
Number of elements must not change. Use  as one of the size inputs to automatically calculate the appropriate
size for that dimension.
Error in CreateGridvals_PolicyKron (line 35)
PolicyKron=reshape(PolicyKron,[2,N_a*N_z]);
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Error in SimPanelValues_FHorz_Case1 (line 159)
[dPolicy_gridvals_j,aprimePolicy_gridvals_j]=CreateGridvals_PolicyKron(Policy(:,:,:,jj),n_d,n_a,n_a,n_semizze,d_grid,a_grid,1, 1);