| 1 |
// --+ options: stochastic,transform_unary_ops,json=compute +-- |
| 2 |
|
| 3 |
var foo x1 x2 x1bar x2bar; |
| 4 |
|
| 5 |
varexo ex1 ex2 ex1bar ex2bar; |
| 6 |
|
| 7 |
parameters a_x1_0 a_x1_0_ a_x1_1 a_x1_2 a_x1_x2_1 a_x1_x2_2 |
| 8 |
a_x2_0 a_x2_1 a_x2_2 a_x2_x1_1 a_x2_x1_2 |
| 9 |
beta ; |
| 10 |
|
| 11 |
a_x1_0 = -.9; |
| 12 |
a_x1_0_ = -.8; |
| 13 |
a_x1_1 = .4; |
| 14 |
a_x1_2 = .3; |
| 15 |
a_x1_x2_1 = .1; |
| 16 |
a_x1_x2_2 = .2; |
| 17 |
|
| 18 |
|
| 19 |
a_x2_0 = -.9; |
| 20 |
a_x2_1 = .2; |
| 21 |
a_x2_2 = -.1; |
| 22 |
a_x2_x1_1 = -.1; |
| 23 |
a_x2_x1_2 = .2; |
| 24 |
|
| 25 |
@#include "example1/model/var-expectations/varexp-parameters.inc" |
| 26 |
|
| 27 |
beta = 1/(1+.02); |
| 28 |
|
| 29 |
model; |
| 30 |
|
| 31 |
[name='eq:x1', data_type='nonstationary'] |
| 32 |
diff(x1) = a_x1_0*(x1(-1)-x1bar(-1))+a_x1_0_*(x2(-1)-x2bar(-1)) + a_x1_1*diff(x1(-1)) + a_x1_2*diff(x1(-2)) + + a_x1_x2_1*diff(x2(-1)) + a_x1_x2_2*diff(x2(-2)) + ex1; |
| 33 |
|
| 34 |
[name='eq:x2', data_type='nonstationary'] |
| 35 |
diff(x2) = a_x2_0*(x2(-1)-x2bar(-1)) + a_x2_1*diff(x1(-1)) + a_x2_2*diff(x1(-2)) + + a_x2_x1_1*diff(x2(-1)) + a_x2_x1_2*diff(x2(-2)) + ex2; |
| 36 |
|
| 37 |
[name='eq:x1bar', data_type='nonstationary'] |
| 38 |
x1bar = x1bar(-1) + ex1bar; |
| 39 |
|
| 40 |
[name='eq:x2bar', data_type='nonstationary'] |
| 41 |
x2bar = x2bar(-1) + ex2bar; |
| 42 |
|
| 43 |
foo = .5*foo(-1) + |
| 44 |
@#include "example1/model/var-expectations/varexp-expression.inc" |
| 45 |
; |
| 46 |
end; |
| 47 |
|
| 48 |
shocks; |
| 49 |
var ex1 = .01; |
| 50 |
var ex2 = .01; |
| 51 |
var ex1bar = .02; |
| 52 |
var ex2bar = .02; |
| 53 |
end; |
| 54 |
|
| 55 |
|
| 56 |
verbatim; |
| 57 |
initialconditions =zeros(4,5); |
| 58 |
initialconditions(4,1) = .10; % foo(-1) |
| 59 |
initialconditions(4,2) = .20; % x1(-1) |
| 60 |
initialconditions(3,2) = .22; % x1(-2) |
| 61 |
initialconditions(2,2) = .24; % x1(-3) |
| 62 |
initialconditions(4,3) = .30; % x2(-1) |
| 63 |
initialconditions(3,3) = .32; % x2(-2) |
| 64 |
initialconditions(2,3) = .34; % x2(-3) |
| 65 |
initialconditions(4,4) = .25; % x1bar(-1) |
| 66 |
initialconditions(4,5) = .25; % x2bar(-1) |
| 67 |
initialconditions = ... |
| 68 |
dseries(initialconditions, dates('2000Q1'), {'foo', 'x1','x2', 'x1bar', 'x2bar'}); |
| 69 |
set_dynare_seed('default'); |
| 70 |
ts = simul_backward_model(initialconditions, 100); |
| 71 |
ex = load('example1.mat'); |
| 72 |
delete('example1.mat') |
| 73 |
if max(abs(ex.foo-ts.foo.data))>1e-12 |
| 74 |
error('Simulations do not match!') |
| 75 |
end |
| 76 |
end; |