# Input exogenous variables

Dear all,

I tried to input deterministic shocks using the command “shocks” by changing the “example1.mod”. This is following code. However, this code didn’t work. Please tell me that the way of inputing determistic shocks (exogenous variables) in stochastic simulation.

Best Wishes,

*************************************************************// example 1 from Collard’s guide to Dynare
var y, c, k, a, h, b;
varexo u;
varexo_det e;

parameters beta, rho, beta, alpha, delta, theta, psi, tau;

alpha = 0.36;
rho = 0.95;
tau = 0.025;
beta = 0.99;
delta = 0.025;
psi = 0;
theta = 2.95;

phi = 0.1;

model;
cthetah^(1+psi)=(1-alpha)y;
k = beta
(((exp(b)c)/(exp(b(+1))c(+1)))
(exp(b(+1))alphay(+1)+(1-delta)k));
y = exp(a)
(k(-1)^alpha)
(h^(1-alpha));
k = exp(b)
(y-c)+(1-delta)k(-1);
a = rho
a(-1)+tau
b(-1) + e;
b = taua(-1)+rhob(-1) + u;
end;

initval;
y = 1.08068253095672;
c = 0.80359242014163;
h = 0.29175631001732;
k = 5;
a = 0;
b = 0;
e = 0;
u = 0;
end;

shocks(shock_file=shocks1);
//var e; stderr 0.009;
//var u; stderr 0.009;
//var e, u = phi0.0090.009;
//var e, u = phi0.0090.009;
var e;
periods 1:5;
values 0.01;
end;

stoch_simul(linear);

Naohisa Hirakata
Macro Modelling
Research and Statistics Department
Bank of Japan
TEL: +81-3-3279-1111 (ext. 3847)
FAX: +81-3-5255-6758
EMAIL: naohisa.hirakata@boj.or.jp

There are three problems:

1. You refer to file shocks1, but don’t seem to use it. Drop the shock_fille option

2. You need at least one stochastic shock. Declare some stdandard deviation for u

3. You won’t see the effect of the deterministic shocks, unless you ask for forecast. For example:
forecast(periods=40);

Best

Michel

Dear Professor Juillard,

This program worked, thank to your reply. I succeded in inputing the exogenous variable.

Naohisa

[quote=“MichelJuillard”]There are three problems:

1. You refer to file shocks1, but don’t seem to use it. Drop the shock_fille option

2. You need at least one stochastic shock. Declare some stdandard deviation for u

3. You won’t see the effect of the deterministic shocks, unless you ask for forecast. For example:

forecast(periods=40);

Best

Michel[/quote]

Michel, I did what you said. When I simulate the stochastic model with and without the deterministic shock, the chart generated by the forecast command looks different.

But, the time series for the exogenous variables in both cases are exactly the same. Why does it happens?

[quote=“diego.gomes”]
But, the time series for the exogenous variables in both cases are exactly the same. Why does it happens?[/quote]

You mean the stochastic exogenous, or the deterministic exogenous? Because if it’s the former, then this is normal, because stochastic and deterministic exogenous shocks are independent with each other.