Page 1 of 2

Impulse response figures not show up

PostPosted: Thu Oct 17, 2013 3:50 pm
by maxzhao
Hi,

I have a simple NK model: sticky wage and price, only labor in production, and standard utility function. The only one unusual feature is that the volatility of TFP shock is time varying. I solve the model use second order approximation. I have a problem that the figure for impulse response not coming up even I specify stoch_simul(order=2,irf=40).

I think the problem may be related with the time varying volatility, because when I use only constant volatiliy, there is no problem, but I am not sure how this is related. Please help me explain. Thanks.

Re: Impulse response figures not show up

PostPosted: Fri Oct 18, 2013 2:06 am
by maxzhao
Anyone knows what the variables oo_.dr.gx, oo_.dr.Gy, and oo_.dr.fuu are? I checked dynare mannul, no explaination for those variables. Is this related with the above problems?

Re: Impulse response figures not show up

PostPosted: Fri Oct 18, 2013 8:40 am
by jpfeifer
They are intermediate results used in computations about which you should not bother. If the IRFs do not show, try using pruning.

Re: Impulse response figures not show up

PostPosted: Fri Oct 18, 2013 3:56 pm
by maxzhao
Thanks for the clearification. Two more questions:
1. Why there are less state variables displayed in the window than in oo_.dr.npred.
2. What's the real variables that correspond to those AUX_ENDO_LAG or AUX_ENDO_LEAD variables

Re: Impulse response figures not show up

PostPosted: Fri Oct 18, 2013 8:45 pm
by jpfeifer
1. Which window? If you are referring to IRFs: Dynare omitts any variable from IRFs that does not move in response to a shock. For example, TFP won't move for a preference shock and will not be displayed.
2. See http://www.dynare.org/DynareWiki/AuxiliaryVariables

Re: Impulse response figures not show up

PostPosted: Sun Oct 20, 2013 2:39 am
by maxzhao
Thanks, jpfeifer.

I went through the link you provided for question2. Its clear that Aux var for endogenous with lag >= 2, I can find the index of the original endogenous variable in M_.aux_vars(i).orig_index . But how about Aux var for endogenous with lead >= 2? The M_.aux_vars(i).orig_index is empty!! Where can I find the the index of the original endogenous variable?

Re: Impulse response figures not show up

PostPosted: Sun Oct 20, 2013 4:37 pm
by jpfeifer
Could you provide me with the mod-file and tell me where the issue is?

Re: Impulse response figures not show up

PostPosted: Mon Oct 21, 2013 2:24 pm
by maxzhao
Thanks, jpfeifer. The problem solved I guess. One more question, when I have time-varying volatility for TFP, I need to solve the model using third order approximation, right?

Re: Impulse response figures not show up

PostPosted: Tue Oct 22, 2013 9:08 am
by jpfeifer
Yes. See e.g. Appendix B.4 to Born/Pfeifer (2013) http://papers.ssrn.com/sol3/papers.cfm?abstract_id=2302490 for a detailed explanation why.

Re: Impulse response figures not show up

PostPosted: Tue Oct 22, 2013 4:04 pm
by maxzhao
Hi jpfeifer, your online appendix is much complicated. Could you give me a rought idea why 3rd order needed?

Re: Impulse response figures not show up

PostPosted: Tue Oct 22, 2013 5:11 pm
by jpfeifer
I meant B5. As it says
As is well known, a first-order approximation exhibits certainty equivalence. [...] For a second-order approximation, it is well known from Schmitt-Grohé and Uribe (2004) for the homoscedastic case that uncertainty only enters the policy function through a constant term [...]. Only in the third-order approximation do the volatility shocks enter the policy function
separately from the level shocks in a non-constant form.

Re: Impulse response figures not show up

PostPosted: Tue Oct 22, 2013 6:38 pm
by maxzhao
Thanks jpfeifer,
(i)if I have time-varying volatility, but the volatility itself is not a stochastich process, it is determined by some predetermined variable in the model. Do I still need 3rd order approximation?
(ii) In case I need to do 3rd order approximation, dynare don't have impulse response output, right? Do I have to simulate the impulse response function with my own matlab code?

Re: Impulse response figures not show up

PostPosted: Tue Oct 22, 2013 9:05 pm
by maxzhao
(iii) when I trying to do the simulation using my own matlab code, all variables go to infinite and explode, the results is NaN for all the elements after certain periods. Do you know why this happened?

This is the main part of the code for 2nd order approximation:
[T,dim] = size(a);
All_Var = zeros(73,T);


Exo_Var = [a,z,u,conf,ddl];

for i = 2:T
tempLState = All_Var(25:57,i-1);
tempExo = Exo_Var(i,:)';
tempLStateLState = kron(tempLState-SS_S,tempLState-SS_S);
tempExoExo = kron(tempExo,tempExo);
tempLStateExo = kron(tempLState-SS_S,tempExo);
All_Var(:,i) = SS_All + 0.5*Delta2 + A*(tempLState-SS_S) + B*tempExo + 0.5*C*tempLStateLState + 0.5*D*tempExoExo + E*tempLStateExo;
end

Re: Impulse response figures not show up

PostPosted: Sat Oct 26, 2013 9:02 am
by jpfeifer
i) Without knowing the model, this is impossible to tell. But you should be able to see this in the IRFs.
ii) Dynare has GIRFs at order=3. But you will need really a lot of replication (replic) and must use pruning, which is only available in the unstable version.
iii) Seems the pruning is missing

Re: Impulse response figures not show up

PostPosted: Thu Dec 08, 2016 9:29 pm
by farukakbal
Dear Pfefier,
I am trying to obtain IRF responses for volatility shock under 3rd order approximation with standard Gali-NK Model. I have used your approach at "Risk Matters" yet i have observed random jumps in the IRF of volatility shock. I used pruning as you suggested.
Here is my ,mod file. Can you help me on the issue?
Best