Strange results with second order approximation

Dear Dynare people,

I have played a bit with DYNARE and I think it is great. Now I have encountered a strange result, however. The enclosed file contains a dynamic model of a firm setting price and investment. One of the outcome variables is dividends, DIV. Everything looked fine but then I wanted to calculate the present value of dividens so I added an equation


Since PV does not enter anywhere else it is a recursívely determined jump variable. Consider the effect of a demand shock (yshock). When I use the first order taylor approximation in DYNARE I get results which are consistent with this equation, but when I use the second order approximation I get a value of PV in the first period which is clearly inconsistent with this equation.


Subsequent values for the IRF are ok. As it happends when I change from first to second order I do not think it has anything to do with my program …

Nils Gottfries
PANDI.mod (1.58 KB)

I’m not sure that I understand. How did you compute DIV(0), PV(0) and PV(1)?
Remember that the equation is really



By DIV(0) I mean the value for period zero in the impulse responce function for a yshock. If you look at the impulse response functions you see that DIV goes up a lot in the first period while PV is higher in period 1 than in period 0. This is inconsistent with the above equation.

Nils Gottfries

This has to do with the way the IRFs are computed for 2nd order. I turn to it below, but let me first confirm that the simulation is correct. With option periods=2100, you create one Monte Carlos simulation for 2100 periods.
I added variable EPV=PV(+1) to store the expected value of next period PV.
For the first three periods, we have indeed correct results (the two first periods are steady state values required by the initial lags on two periods). If you type

after running the model, you get indeed

The problem with the IRFs is that in a nonlinear model, they will depend of the state of the model when the shock takes place and the expected value of the trejectory back to equilibrium is a nonlinear function of future shocks.

So Dynare computes an average Impulse Response Function in the following way. Assume, you want a 40 period IRF.

  1. draw one history of shocks for 140 periods. Make two copies of it
  2. In the second copy, add an extra 1 std err shock in period 101 on the exogenous variable that you want to compute IRF for.
  3. Run a dynamic simulation with the two shock histories, starting at steady state
  4. Compute the difference between the two trajectories of each endogenous variables
  5. Repeat 1)-4) 50 times (Dynare default for option replic) and average the individual IRFs

a) the first 100 periods before the deterministic 1 std err shock do that the shock takes place at a random state for the economy
b) the next 40 periods shocks give one possible history after the deterministic shock
c) averaging over 50 different histories provide an average IRFs over state and future shocks (after the deterministic impulsion)

This explains why the IRFs may not statisfy the equation of the model.

Kind regards