How to write good shock code in dynare

Dear all,
If my model has three shocks, I writed the code below

shocks;
var epif; stderr 0.007;
var etheta; stderr 0.007;
var eif; stderr 0.007;
end;

stoch_simul(dr_algo=1,drop=200,order=1);

and I don’t know why DYNARE show the “bad shock” result.

How can I write code to show “good shock” result?

Dear Bernie,

can you show the whole example (the whole *.mod file) that triggers the “bad shock” message?

Thanks

Michel

// example of solving Hansen(1985) model
var y, c, k, a, n, i;
varexo e;

parameters beta, rho, alpha, delta, psi, PSI,sc,si;

alpha = 0.36;
rho = 0.95;
beta = 0.99;
delta = 0.025;
psi = 0;
PSI = 2.5;
sc=0.2564;
si=0.7436;

model(linear);
y=(1+psi)n+c;
y=a+alpha
k(-1)+(1-alpha)n;
y=sc
c+sii;
k=delta
i+(1-delta)k(-1);
c-c(+1)+(1-beta
(1-delta))(y(+1)-k);
a=rho
a(-1)+e;
end;

steady;
initval;
y=0;
c=0;
i=0;
k=0;
a=0;
n=0;
e=0;
end;

shocks;
var e; stderr 0.007;
end;

stoch_simul(dr_algo=1,drop=200,order=1);

I want the variable “a” upward.

but the result show the variable “a” downward.

thanks Professor

Dear Professor
sorry!
my English is very poor
I dont know what you mean
so I write out hansen model’s code

please help me to solve this question

thank you

Dear Bernie,

I believe that you are refering to the Impulse Response Function of variable ‘a’ following a one standard deviation shock on ‘e’

This curve is downward sloping and it is what we expect.

From its specification, variable ‘a’ has zero mean. What the IRF curve shows is that after an initial shock of 0.007 (stderr e), variable ‘a’ goes back to its mean of zero.

This is to be expected in a stationary model. If you expect to see a growing curve for ‘a’, you are thinking about a growth model, but it isn’t the model that you have written in Dynare.

Because growth models are nonstationary, it is easier to work with the stationarized version of such models. If you know the trend, you can always add it after the simulation of the stationary components of the variables.

Hope it helps

Michel

Dear Professor

I understand!

thanks a lot

Dear Professor
I have another question.

Q:these picture result
the shock impact this model then “a” goes up and downward sloping mean that “a” return to original position.

Is this right?

thanks

Yes, it is. In a stationary model. The variables always go back to equilibrium after a temporary shock.

Regards

Michel

Dear Professor

Q1:
If I want to see permanent shock result, how can I write the code?

Q2:
If my another model has three shock, I write down the code below
shocks;
var epif; stderr 0.007;
var etheta; stderr 0.007;
var eif; stderr 0.007;
end;

stoch_simul(dr_algo=1,drop=200,order=1);

the numerical result mean all shock together affect my model.
Is it right?

thank a lot

Q1: to study a permanent shock
a) use a deterministic model with initval and endval (see the manual)
b) un permanent shock in stochastic model means that the exogenous process in integrated of order 1 (nonstationary). Write the stationarized version of the model, perform the simulation, then add back the nonstationary components to the results. If you are not familiar with the handling of nonstationary models, you probably need to ask for help at your local university.

Kind regards

Michel

Professor

thanks a lot