I am using histval and initval in a perfect foresight simulation of a model starting with certain state variables deviating from the steady state. I am unsure whether I am doing it correctly, and whether there’s an easier way. The model is a bit complicated, so I’ll describe the key issues. There’s a downstream sector that produces consumption and an upstream sector that produces three inputs (labeled z0, z1, and z2) to investment goods. Investment at date t comes from combining z0(t), last period’s z1(t-1), and z2(t-2). (The variables are also distinguished by ‘u’ and ‘d’, hence z0u, z0d, etc.)
The simulation perturbs z2(0) to simulate a sectoral disruption. This has no impact on current investment, which comes from goods already in the pipeline. The direct impact will be on investment at date 2, but there will be intervening responses at date 1. I use histval to set z2(0) below the steady state, but also z2(-1) at the steady state.
The attached code (ModelStrike2.mod) seems to work. I set z2(0) and z2(-1) as above, and all other state variables at their steady states, because I want all the other variables only to be affected starting at t=1. In the initval block I put the steady state model, which from the manual I understand to be the terminal values if histval is used.
I have two questions: (1) Am I using histval correctly for this purpose? (In other words, can I trust the results?) And (2) Is there an easier way to assign the steady state values to the all the state variables in the histval block? What I did was first solve for the steady state, and then enter the numbers
for each state variable, as histval doesn’t seem to allow for equations the way initval does. This means if I change a parameter I have to reenter all the new steady state values in the histval block.
Also, for some versions of this model (specifically the attached ModelStrike4.mod, which has 5 stages instead of 3), the solver fails. I get output
Iter: 1, err. = 1.03475, time = 0.113
Iter: 2, err. = Inf, time = 0.09
Warning: Matrix is singular to working precision.
Even though I can compute the steady state, and if I run the code without the solver (just the setup) it runs just fine. So I’m at a loss as to what the problem is, since the basic setup is the same as in the three-stage case that seems to work.
Thank you in advance for your help.
ModelStrike2.mod (4.4 KB)
ModelStrike4.mod (5.8 KB)