Page 1 of 3

time varying volatility

PostPosted: Wed Apr 04, 2012 2:48 am
by econactually
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!

Re: time varying volatility

PostPosted: Wed Apr 18, 2012 6:47 pm
by jpfeifer
You need to enter a fully nonlinear model and in stoch_simul you must put order=3.

Re: time varying volatility

PostPosted: Thu Apr 19, 2012 1:31 pm
by econactually
Thank you for your response.

Re: time varying volatility

PostPosted: Thu Apr 26, 2012 2:41 pm
by econactually
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!

Re: time varying volatility

PostPosted: Thu Apr 26, 2012 6:59 pm
by jpfeifer
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.

Re: time varying volatility

PostPosted: Wed Jun 20, 2012 6:18 pm
by ambropo
Econactually, can you please share your mod file? I'm also interested in understanding how such volatility shocks work. Thanks in advance.

Re: time varying volatility

PostPosted: Thu Jun 21, 2012 2:42 pm
by rteconomics
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.

Re: time varying volatility

PostPosted: Tue Jun 26, 2012 12:20 pm
by rteconomics
Hello guys,
Any news on this?
Thanks!
RT

Re: time varying volatility

PostPosted: Fri Jun 29, 2012 6:47 pm
by jpfeifer
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.

Re: time varying volatility

PostPosted: Fri Jul 06, 2012 11:09 am
by ambropo
Thanks for the reply.

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

Re: time varying volatility

PostPosted: Sat Jul 07, 2012 12:07 pm
by jpfeifer
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.

Re: time varying volatility

PostPosted: Fri Jul 20, 2012 3:40 pm
by ambropo
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
IRF from Steady State
(11.02 KiB) Downloaded 440 times

while the IRFs comnputed from the ergodic mean are:
IRF_ErgoMean.pdf
IRF from Ergodic Mean
(11.73 KiB) Downloaded 448 times


    - 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

Re: time varying volatility

PostPosted: Fri Jul 20, 2012 5:11 pm
by jpfeifer
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.

Re: time varying volatility

PostPosted: Fri Jul 20, 2012 6:27 pm
by ambropo
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?

Re: time varying volatility

PostPosted: Sun Jul 22, 2012 9:28 am
by KTS
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