Time-Varying risk

Hi guys! I’m working to an SOE model with time-varying risk of the form:

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 a compiler:
[1] Lcc-win32 C 2.4.1 in I:\w5\MATLAB~3\sys\lcc

[0] None [/code]

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]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) ;[/code]

The same happens with the code posted here (Impulse responses with multiple shocks) by MichelJuillard.

I attach my code.
Could anyone please help? Thanks!
Ciao,
RT
soe_timevar.mod (11.1 KB)

I forgot to tell you that I’m using the 4.1.3 version. Does this matter? Thanks. RT

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.

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:

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]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’);[/code]

The output are the IRFs relative to e (standard TFP level shock):
[/attachment]

to eta (shock to the second moment):
[/attachment]

and the IRF of consumption:
[/attachment]

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?
    IRFs(var).pdf (6.44 KB)
    IRFs(lev).pdf (6.25 KB)
    consumption.pdf (3.4 KB)

Hi guys!
Any news on this issue?
Thank you!
RT

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

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.