Page 1 of 1

Time-Varying risk

PostPosted: Wed Jun 20, 2012 9:07 am
by rteconomics
Hi guys! I'm working to an SOE model with time-varying risk of the form:

Code: Select all
a=rho*a(-1)+sigma_a*e;
sigma_a=(1-rho_z)*sigma_ss+rho_z*sigma_a(-1)+kappa_a*u;


After specifying the dll option in the 'model' block, I was asked to choose a compiler:

Code: Select all
Select a compiler:
[1] Lcc-win32 C 2.4.1 in I:\w5\MATLAB~3\sys\lcc
 
[0] None


I chose 1 (btw, what is the difference?). As a result, I get this error (and it seems I cannot change to 'None' anymore):

Code: Select all
Error time_var_dynamic.c: 1058  expression too complicated
Error time_var_dynamic.c: 1058  expression too complicated
Error time_var_dynamic.c: 1058  expression too complicated
Error time_var_dynamic.c: 1058  expression too complicated
Error time_var_dynamic.c: 1058  expression too complicated
5 errors, 0 warnings
 
  I:\W5\MATLAB~3\BIN\MEX.PL: Error: Compile of 'time_var_dynamic.c' failed.
 
??? Error using ==> mex at 221
Unable to complete successfully.

Error in ==> time_var at 71
    eval('mex -O PRELINK_CMDS1="echo EXPORTS > mex.def & echo
    mexFunction >> mex.def & echo Dynamic >> mex.def"
    time_var_dynamic.c')

Error in ==> dynare at 132
evalin('base',fname) ;


The same happens with the code posted here (viewtopic.php?f=1&t=2829) by MichelJuillard.

I attach my code.
Could anyone please help? Thanks!
Ciao,
RT

Re: Time-Varying risk

PostPosted: Wed Jun 20, 2012 3:27 pm
by rteconomics
I forgot to tell you that I'm using the 4.1.3 version. Does this matter? Thanks. RT

Re: Time-Varying risk

PostPosted: Thu Jun 21, 2012 7:09 am
by jpfeifer
Please upgrade to a newer version. There have been some bugs discovered since then. Moreover, in more recent versions, the use_dll option is not required anymore.

Re: Time-Varying risk

PostPosted: Thu Jun 21, 2012 2:24 pm
by rteconomics
Hello!
Thank you for your reply. I did it this morning and the code seems to work fine now. However, I still have a little issue (this is an issue that other might have faced).
I specified the TFP process as:

Code: Select all
sigma_e = rho_sigma_e*sigma_e(-1) + (1-rho_sigma_e)*mean_sigma_e + sigma_eta*eta_e;
a = rho_a*a(-1) + sigma_e*e;


and the 'shocks' block as (I took this from a code MJ posted, see my original post above):

Code: Select all
shocks;
var e = 1;
var eta_e = 1;
end;
stoch_simul(order=3, periods=1000, irf=10);

ex_ = zeros(40,2);
ex_(1,2) = 1;
irf2 = simult_(oo_.steady_state,oo_.dr,ex_,2);

figure;
plot(irf2(2,:)-oo_.steady_state(3));
title('Consumption');


The output are the IRFs relative to e (standard TFP level shock):
[img]
IRFs(lev).pdf
[/img]

to eta (shock to the second moment):
[img]
IRFs(var).pdf
[/img]

and the IRF of consumption:
[img]
consumption.pdf
[/img]

I have 2 questions:
1) Is there a way to smooth the IRFs coming from shocks to eta?
2) What is exactly the difference between the IRF of consumption and the IRF of c in the 'eta shock' case (basically in the second and third figure)? Why are they different and which one is the true one?

Re: Time-Varying risk

PostPosted: Tue Jun 26, 2012 12:20 pm
by rteconomics
Hi guys!
Any news on this issue?
Thank you!
RT

Re: Time-Varying risk

PostPosted: Fri Jun 29, 2012 6:37 pm
by jpfeifer
1. If you don't do the IRFs in the way the authors of the AER paper proposed, the only way would be to run really many replications, see e.g. http://www.imf.org/external/pubs/ft/wp/2010/wp10249.pdf. Note that pruning also helps but is not implemented for higher orders than 2

2. There is no right or wrong. The ways to compute them are different. stoch_simul generates IRFs as described in http://www.dynare.org/DynareWiki/IrFs. During the whole simulation period there are random shocks hitting the system. The difference between the baseline and the shocked series is a shock at time t=101. IRFs are plotted as the percentage difference between the shocked series and the baseline simulation.

In contrast, by using
Code: Select all
ex_ = zeros(40,2);
ex_(1,2) = 1;

you have 40 periods without any shock except for the first shocks at period 1. Then you compare this shocked series to the deterministic steady state.