## time varying volatility

This forum is closed. You can read the posts but cannot write. We have migrated the forum to a new location where you will have to reset your password.
Forum rules
This forum is closed. You can read the posts but cannot write. We have migrated the forum to a new location (https://forum.dynare.org) where you will have to reset your password.

### 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!
econactually

Posts: 6
Joined: Wed Mar 28, 2012 1:03 am

### Re: time varying volatility

You need to enter a fully nonlinear model and in stoch_simul you must put order=3.
------------
Johannes Pfeifer
University of Cologne
jpfeifer

Posts: 6940
Joined: Sun Feb 21, 2010 4:02 pm
Location: Cologne, Germany

### Re: time varying volatility

econactually

Posts: 6
Joined: Wed Mar 28, 2012 1:03 am

### Re: time varying volatility

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!
Attachments
IRF.pdf
econactually

Posts: 6
Joined: Wed Mar 28, 2012 1:03 am

### Re: 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.
------------
Johannes Pfeifer
University of Cologne
jpfeifer

Posts: 6940
Joined: Sun Feb 21, 2010 4:02 pm
Location: Cologne, Germany

### Re: time varying volatility

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

Posts: 9
Joined: Mon Jun 06, 2011 2:45 pm

### Re: time varying volatility

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 u;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.
rteconomics

Posts: 41
Joined: Wed Jan 04, 2012 11:29 am

### Re: time varying volatility

Hello guys,
Any news on this?
Thanks!
RT
rteconomics

Posts: 41
Joined: Wed Jan 04, 2012 11:29 am

### Re: time varying volatility

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.
------------
Johannes Pfeifer
University of Cologne
jpfeifer

Posts: 6940
Joined: Sun Feb 21, 2010 4:02 pm
Location: Cologne, Germany

### Re: time varying volatility

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

Code: Select all
`ergo_mean = mean(oo_.endo_simul,2);out = simult_(ergo_mean,oo_.dr,ex_,3);`

However, in anothjer post (http://www.dynare.org/phpBB3/viewtopic.php?f=1&t=2829), MJ suggested to compute the impulse response from the steady state:

Code: Select all
`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
ambropo

Posts: 9
Joined: Mon Jun 06, 2011 2:45 pm

### Re: time varying volatility

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 (http://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.
------------
Johannes Pfeifer
University of Cologne
jpfeifer

Posts: 6940
Joined: Sun Feb 21, 2010 4:02 pm
Location: Cologne, Germany

### Re: time varying volatility

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:

while the IRFs comnputed from the ergodic mean are:
IRF_ErgoMean.pdf
IRF from Ergodic Mean

- Why does the level of the tehnology shock (A) move in the case of the ergodic mean?
- 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?
- The IRFs display sensible differences. Do you have any intuition for why this is the case?

You find attached the mod file I am using.

Thanks much
Attachments
rbc_forum.mod
RBC with stochastic volatility of echnology process
ambropo

Posts: 9
Joined: Mon Jun 06, 2011 2:45 pm

### Re: time varying volatility

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.
------------
Johannes Pfeifer
University of Cologne
jpfeifer

Posts: 6940
Joined: Sun Feb 21, 2010 4:02 pm
Location: Cologne, Germany

### Re: time varying volatility

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?
ambropo

Posts: 9
Joined: Mon Jun 06, 2011 2:45 pm

### Re: time varying volatility

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
KTS

Posts: 1
Joined: Sun Jul 22, 2012 8:53 am

Next