| 1 |
/* |
| 2 |
* Example 1 from F. Collard (2001): "Stochastic simulations with DYNARE: |
| 3 |
* A practical guide" (see "guide.pdf" in the documentation directory). |
| 4 |
*/ |
| 5 |
|
| 6 |
/* |
| 7 |
* Copyright © 2001-2022 Dynare Team |
| 8 |
* |
| 9 |
* This file is part of Dynare. |
| 10 |
* |
| 11 |
* Dynare is free software: you can redistribute it and/or modify |
| 12 |
* it under the terms of the GNU General Public License as published by |
| 13 |
* the Free Software Foundation, either version 3 of the License, or |
| 14 |
* (at your option) any later version. |
| 15 |
* |
| 16 |
* Dynare is distributed in the hope that it will be useful, |
| 17 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 18 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 19 |
* GNU General Public License for more details. |
| 20 |
* |
| 21 |
* You should have received a copy of the GNU General Public License |
| 22 |
* along with Dynare. If not, see <https://www.gnu.org/licenses/>. |
| 23 |
*/ |
| 24 |
|
| 25 |
|
| 26 |
var y, c, k, a, h, b; |
| 27 |
varexo e, u; |
| 28 |
|
| 29 |
parameters beta, rho, alpha, delta, theta, psi, tau; |
| 30 |
|
| 31 |
alpha = 0.36; |
| 32 |
rho = 0.95; |
| 33 |
tau = 0.025; |
| 34 |
beta = 0.99; |
| 35 |
delta = 0.025; |
| 36 |
psi = 0; |
| 37 |
theta = 2.95; |
| 38 |
|
| 39 |
phi = 0.1; |
| 40 |
|
| 41 |
model; |
| 42 |
exp(c)*theta*exp(h)^(1+psi)=(1-alpha)*exp(y); |
| 43 |
exp(k) = beta*(((exp(b)*exp(c))/(exp(b(+1))*exp(c(+1)))) |
| 44 |
*(exp(b(+1))*alpha*exp(y(+1))+(1-delta)*exp(k))); |
| 45 |
exp(y) = exp(a)*(exp(k(-1))^alpha)*(exp(h)^(1-alpha)); |
| 46 |
exp(k) = exp(b)*(exp(y)-exp(c))+(1-delta)*exp(k(-1)); |
| 47 |
a = rho*a(-1)+tau*b(-1) + e; |
| 48 |
b = tau*a(-1)+rho*b(-1) + u; |
| 49 |
end; |
| 50 |
|
| 51 |
initval; |
| 52 |
y = log(1.08068253095672); |
| 53 |
c = log(0.80359242014163); |
| 54 |
h = log(0.29175631001732); |
| 55 |
k = log(11.08360443260358); |
| 56 |
a = 0; |
| 57 |
b = 0; |
| 58 |
end; |
| 59 |
resid; |
| 60 |
shocks; |
| 61 |
var e; stderr 0.009; |
| 62 |
var u; stderr 0.009; |
| 63 |
var e, u = phi*0.009*0.009; |
| 64 |
end; |
| 65 |
|
| 66 |
histval; |
| 67 |
k(0) = log(11.08); |
| 68 |
a(0) = log(1.2); |
| 69 |
b(0) = log(1); |
| 70 |
end; |
| 71 |
|
| 72 |
stoch_simul(order=1,periods=1000); |
| 73 |
forecast; |
| 74 |
|
| 75 |
forecast; |
| 76 |
conditional_forecast_paths; |
| 77 |
var a; |
| 78 |
periods 1 2 ; |
| 79 |
values 0.01 -0.02; |
| 80 |
var b; |
| 81 |
periods 1 2; |
| 82 |
values 0.05 0; |
| 83 |
end; |
| 84 |
|
| 85 |
conditional_forecast(parameter_set=calibration, controlled_varexo=(u,e)); |
| 86 |
|
| 87 |
oo_exp=oo_; |
| 88 |
conditional_forecasts_exp=oo_.conditional_forecast; |
| 89 |
|
| 90 |
oo_exp=oo_; |
| 91 |
save results_exp_histval.mat oo_exp conditional_forecasts_exp |