Page 1 of 1

how to write good shock code in dynare

PostPosted: Tue Jul 11, 2006 12:16 pm
by Bernie
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?

PostPosted: Tue Jul 11, 2006 1:46 pm
by MichelJuillard
Dear Bernie,

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

Thanks

Michel

PostPosted: Tue Jul 11, 2006 2:59 pm
by Bernie
// 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+si*i;
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

PostPosted: Wed Jul 12, 2006 11:34 am
by Bernie
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

PostPosted: Wed Jul 12, 2006 12:14 pm
by MichelJuillard
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

PostPosted: Wed Jul 12, 2006 12:56 pm
by Bernie
Dear Professor

I understand!

thanks a lot

PostPosted: Wed Jul 12, 2006 4:47 pm
by Bernie
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

PostPosted: Wed Jul 12, 2006 4:55 pm
by MichelJuillard
Yes, it is. In a stationary model. The variables always go back to equilibrium after a temporary shock.

Regards

Michel

PostPosted: Wed Jul 12, 2006 5:19 pm
by Bernie
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

PostPosted: Wed Jul 12, 2006 7:43 pm
by MichelJuillard
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

PostPosted: Thu Jul 13, 2006 11:12 am
by Bernie
Professor

thanks a lot