Semi-exogenous state

Hi Robert,

I am trying to solve a partial equilibrium, life-cycle model of a single agent who is subject to idiosyncratic employment shocks (there are no aggregate shocks). The separation probability is exogenous but the job finding rate depends on search effort. [This is a stripped down version of the joint research project with Haomin]

For users interested in this type of models, two useful references are:

  1. Rasmus Lentz, 2009. “Optimal Unemployment Insurance in an Estimated Job Search Model with Savings ,” Review of Economic Dynamics, Elsevier for the Society for Economic Dynamics, vol. 12(1), pages 37-57, January
  2. Haomin Wang, 2019. “Intra-Household Risk Sharing and Job Search over the Business Cycle ,” Review of Economic Dynamics, Elsevier for the Society for Economic Dynamics, vol. 34, pages 165-182, October.

In terms of the toolkit, we have one semi-exogenous shock semiz and no purely exogenous shocks. Therefore I set

n_z=0;
z_grid = ;
pi_z = ;

and then I set

semiz_grid = [1,0]';
vfoptions.n_semiz = n_semiz;
vfoptions.semiz_grid = gpuArray(semiz_grid);
% Define the transition probabilities of the semi-exogenous states
vfoptions.SemiExoStateFn=@(semiz,semizprime,s,delta,lambdaB) LifeCycleModelV3_SemiExoStateFn(semiz,semizprime,s,delta,lambdaB);

The VFI works fine but when I call the distribution I get the error

Then following the suggestion in the error message, I tried to fool the toolkit by adding a fake z variable

n_z=1;
z_grid = 1;
pi_z = 1;

and modifying the functions accordingly (z is never used of course). But then I get another error

vfoptions =

struct with fields:

                verbose: 1
                n_semiz: 2
             semiz_grid: [2×1 gpuArray]
         SemiExoStateFn: [function_handle]
               parallel: 2
           returnmatrix: 2
              lowmemory: 0
               paroverz: 0
        incrementaltype: 0
            polindorval: 1
policy_forceintegertype: 0
             outputkron: 0
      exoticpreferences: 'None'
                dynasty: 0
        experienceasset: 0
             riskyasset: 0
          residualasset: 0

Error using ValueFnIter_Case1_FHorz
Have not implemented semi-exogenous shocks without at least two decision variables (one of which is
that which determines the semi-exog transitions)

Error in main (line 123)
[V, Policy]=ValueFnIter_Case1_FHorz(n_d,n_a,n_z,N_j,d_grid,a_grid,z_grid,pi_z,ReturnFn,Params,DiscountFactorParamNames,,vfoptions);

I wanted to generate some life-cycle profiles to test the model, that’s why I tried to compute the stationary distribution. For now I will try to get the profiles via panel simulations

I tried to simulate a panel using the following command:

jequalOneDist = zeros([n_a,n_semiz],‘gpuArray’);
jequaloneDist(1,round((n_semiz+1)/2))=1;

simoptions.n_semiz = vfoptions.n_semiz;
simoptions.semiz_grid = vfoptions.semiz_grid;
simoptions.SemiExoStateFn = vfoptions.SemiExoStateFn;

SimPanelValues=SimPanelValues_FHorz_Case1(jequalOneDist,Policy,FnsToEvaluate,,Params,n_d,n_a,n_z,N_j,d_grid,a_grid,z_grid,pi_z,simoptions);

but I got this error message:

Unrecognized function or variable ‘z_gridvals’.

Error in SimPanelValues_FHorz_Case1 (line 81)
fullgridvals(jj).z_gridvals=z_gridvals;

Error in main (line 159)
SimPanelValues=SimPanelValues_FHorz_Case1(jequalOneDist,Policy,FnsToEvaluate,,Params,n_d,n_a,n_z,N_j,d_grid,a_grid,z_grid,pi_z,simoptions);

Just to clarify, the z_grid that is passed as input to SimPanelValues_FHorz_Case1 is an empty vector, since in this model there is only one semi-exo shock, and the semi-exo inputs are included in simoptions

Just back from holidays. I will have this fixed sometime this week.

1 Like

Fixed. And reversed the order so it is now (semiz,z).

1 Like