 # Time varying volatility

Hi,
I have a very basic question about time varying volatility. I want to solve a basic new keynesian model with time varying interest rate volatility and cannot figure out how to write the dynare codes. Do I need to write the model without linearization, just ss equations with shock processes or should I wirte the codes for a linearized model as we always do? I know I need to do third order perturbation but how will I do it?

I will appreciate if you answer this question. Thanks!

You need to enter a fully nonlinear model and in stoch_simul you must put order=3.

Thank you for your response.

Hi,

I write the basic new Keynesian Model equations with time varying interest rate volatility in dynare. I used third order approximation to solve the model and get the impulse responses when the economy is hit by a volatility shock. But these impulse responses make no sense, you can see them below. Do you think the problem is on the parameter values or does it seem like more a-modeling kind of a problem?

Thank you!
IRF.pdf (5.35 KB)

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.

Hello,
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.

Hello guys,
Any news on this?
Thanks!
RT

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?

Thanks

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.

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.

Thanks

KTS

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)