Time varying volatility

Look at the appendix of Fernandez-Villaverde et al. (2011) in the AER (not the WP-version) to see how they generate IRFs. If you do it with packaged Dynare routines they will always look wiggly.

Econactually, can you please share your mod file? I’m also interested in understanding how such volatility shocks work. Thanks in advance.

According to the on-line Appendix of Villaverde et al., they get the IRFs following these steps:

  1. We simulate the model, starting from its steady state, for 2096 periods. We disregard the Örst 2000 periods as a burn-in.
  2. Based on the last 96 periods, we compute the mean of the ergodic distribution for each variable in our model. Adding more periods has essentially no impact on the mean.
  3. Starting from the ergodic mean and in the absence of shocks, we hit the model with a one-standard-deviation shock to the volatility process ue;t.
  4. We report the resulting impulse responses as percentage deviations from the variablesí ergodic means.

My question is: is there a way to implement this in Dynare? Thank you.

1 Like

Hello guys,
Any news on this?

Yes, and no.
You could use the stoch_simul command to generate a simulated series to compute the ergodic mean which you then feed into simult_ and use as the baseline for computations. The problem is that in their paper they use pruning which is not implemented in simult_ for order 3.

Thanks for the reply.

As you suggested, I computed the ergodic mean from the simulated series and then fed them into simult_ command:

ergo_mean = mean(oo_.endo_simul,2);
out = simult_(ergo_mean,oo_.dr,ex_,3);

However, in anothjer post ([Impulse responses with multiple shocks)), MJ suggested to compute the impulse response from the steady state:

out = simult_(oo_.steady_state,oo_.dr,ex_,3);

These procedures yield very different results. I have 2 questions:

  1. Which is the correct one?
  2. What is the difference between the two approaches?


  1. There is no right or wrong. Both are way to generate nonlinear IRFs, but have been proposed by different people (with one of them published in the AER). In my own work (ideas.repec.org/p/bon/bonedp/bgse06_2011.html), I also use the version proposed in the AER paper.

  2. One IRF is relative to the ergodic mean and the other to the determinstic steady state.

Dear Johannes,

Thanks for your reply, I’m a bit puzzled by the differences between the IRFs computed from the ergodic mean and from the steady state.

I wrote a simple RBC model with only one first moment shock driving the economy (A, the technology process) and a second moment shock (StdA, the stochastic volatility of the technology shock). I solved the model with third order approximation and computed the IRFs as discussed in the previous posts.

The IRFs computed from the steady state are: IRF_SteadyState.pdf (11 KB)
while the IRFs comnputed from the ergodic mean are: IRF_ErgoMean.pdf (11.7 KB)

[ul] - Why does the level of the tehnology shock (A) move in the case of the ergodic mean?[/ul]
[ul] - Why does the “uncertainty shock” has permanent effects on real variables? I thought the system was meant to come back to its steady state, am I wrong?[/ul]
[ul] - The IRFs display sensible differences. Do you have any intuition for why this is the case?[/ul]

You find attached the mod file I am using.

Thanks much
rbc_forum.mod (1.76 KB)

The reason is the difference between a deterministic steady state and the mean of the ergodic distribution. They are totally different concepts. The first is the one to where the system returns if you turn off all shock forever, while the other is the mean of distribution where the system stays when it is continually hit by shocks. The same thing happens if you compute IRFs from Value Function Iteration. Here the IRFs also do not go back to the deterministic steady state.

1 Like

I understand your point. However, the above impulse responses were computed by turning of all shocks apart from an impulse in period 1 (from different initial conditions --the ergodic mean and the steady state, respectively). The matrix of shocks would look like (in the example posted above rbc_Forum.mod):

exogenous_shocks = [0 0 … 0;
[1 0 … 0];

Therefore, given that I turned off all the shocks, I expected the system to come back to steady state. Am I wrong?

I’m working on time varying volatility in NK SOE.
This thread is very helpful for me to understand how to implement time varying volatility shock in dynare.
Thanks for jpfeifer and others.

I have two questions:

First, I use very small volatility shock to avoid explosion in IRFs.
Anybody has a code or algorithm for pruning in third order approximation?
Very technical papers would not be helpful for me.

Second, wll IRFs (start from ergodic mean) converge to ergodic mean in the end?
In my case, the IRFs go to around ergodic mean but not “exactly” to the ergodic mean.

I calculate the ergodic mean as follows:
1. simulate the model 500 times with “simult_” from “steady state” under randomly generated volatility shocks
2. in each simulation, simulate 2,096 periods, drop first 2000 periods for burn-in, and take means of variables for left 96 periods.
3. calculate ergodic mean by taking mean of the 500 means.

I found some IRFs in Fernandez-Villaverde et al (2009) and Born-Pfeifer (2011) seem not to converge to ergodic mean.



An IRF cannot converge to the ergodic mean. They always converge to 0 as the model is stationary and the effect of a shock thus dies out over time.

I use basic DNK model to model time varying interest rate volatility. I wrote the code in dynare and plot impolse responses as percentage deviations from the variables’ ergodic means. By using the same model I also wrote the code in mathematica in a way compatible with Eric Swanson’s Perturbation aim codes and again plot impolse responses as percentage deviations from the variables’ ergodic means. The two results are different. Do you know what would cause this particularly? Thanks!

Hi all, could any of you experts tell me whether I got it right on how to implement the uncertainty shocks and get their IRFs?

For practicing I used the Ireland model “Technology shocks in the New Keynesian model”, adding shocks to the TFP volatility and try to plot the IRFs following what’s been told on this thread.

Thanks a lot
Ireland_uncertainty.mod (2.97 KB)

For more on this, see the appendix and the replication files to Born/Pfeifer (2014): “Risk Matters: A comment” on my homepage.

1 Like

Dear all,

I have a question concerning the calculation of IRFs from the Stochastic Steady State (SSS) as done in Basu and Bundick (2015). Brent Bundick has uploaded his code on his website and what they do is basically:
“simulating” (with simult_) the model with zero shocks (starting at the deterministics steady state) for a burn in period of say 2000, then at time 2001 there’s the uncertainty shock hitting (simulation continues up until period 2020, so to get an IRF of 20 periods).

What I was doing before instead, was to run once simult_ with zero shocks for to back out the SSS, then run a second simulation with simult_ starting at the SSS to obtain the IRF.

I thought the IRFs would deliver the same result, but surprisingly (to me) they don’t. Can anyone explain me why this is the case? Moreover, what’s the correct way of doing it? Thanks in advance
IRF_Basu.pdf (8.84 KB)
IRF_mine.pdf (8.7 KB)

1 Like

Could you please explain what exactly you did?

That’s what I did:

  1. “simulate” the model with simult_ with zero shocks for 2000 periods and take the variables at T=2000 as the Stochastic Steady State (SSS)
  2. Simulate once again the model with simult_ (for T=length IRF) starting from the SSS, hitting the economy with an uncertainty shock at time 1 and zero shocks afterwards
  3. Calculate percentage deviations from SSS.

Basu and Bundick do the following:

Let T1= burnin
T2= length IRF

  1. “simulate” the model with simult_ for T=T1+T2 with zero shocks for T1 periods and a 1 std shock to uncertainty at t=T1+1.
  2. Calculate percentage deviations from SSS (value of the variables at t=T1)

I don’t know what exactly you did, but the outlined approach should be correct and should yield the Basu/Bundick IRFs (apart from a small difference related to them not actually starting at the stochastic steady state, because the burnin is insufficient)
I have replicated their IRFs using my own codes. Your differences are puzzling. Did you correctly deal with percentage deviations? If the model is in logs, you must use log differences instead of actual ratios.

ADDENDUM: What I said before only applies to the case without pruning. With pruning, there is an augmented state space. Basu/Bundick with their long series set yhat1 to yhat3 to the values at the stochastic steady state. However, when you restart the simulations at the stochastic steady state, you set yhat1 to yhat1+yhat2+yhat3 and yhat2=yhat3=0.

1 Like

Thanks a lot for the addendum, Johannes. It’s been very helpful