Debian Codegraph @

tests/ecb/partial-estimation/estimation_of_a_single_equation.mod

raw
1 // --+ options: json=compute +--
2
3 // Declare the endogenous variables.
4 var ffr, unrate, cpi;
5
6 // Declare the exogenous variables.
7 varexo e_ffr, e_unrate, e_cpi;
8
9 parameters p_ffr_ffr_lag_1 p_ffr_ffr_lag_2 p_ffr_ffr_lag_3 p_ffr_unrate_lag_1 p_ffr_unrate_lag_2 p_ffr_unrate_lag_4 p_ffr_unrate_lag_5 p_ffr_cpi_lag_4 p_unrate_cpi_lag_1 p_unrate_cpi_lag_2 p_unrate_cpi_lag_3 p_unrate_cpi_lag_4 p_unrate_cpi_lag_5 p_unrate_cpi_lag_6 p_cpi_ffr_lag_1 p_cpi_ffr_lag_2 p_cpi_cpi_lag_2;
10
11 // Declare the model.
12 model(linear);
13
14 [name='ffr']
15 ffr = p_ffr_ffr_lag_1*ffr_lag_1 + p_ffr_ffr_lag_2*ffr_lag_2 + p_ffr_ffr_lag_3*ffr_lag_3
16 + p_ffr_unrate_lag_1*unrate_lag_1 + p_ffr_cpi_lag_4*cpi_lag_4 + e_ffr;
17
18 [name='unrate']
19 unrate = unrate(-4)*p_ffr_unrate_lag_4 + unrate(-2)*p_ffr_unrate_lag_2 + unrate(-5)*p_ffr_unrate_lag_5 + cpi(-1)*p_unrate_cpi_lag_1 + cpi(-2)*p_unrate_cpi_lag_2 + cpi(-3)*p_unrate_cpi_lag_3 + cpi(-4)*p_unrate_cpi_lag_4 + cpi(-5)*p_unrate_cpi_lag_5 + cpi(-6)*p_unrate_cpi_lag_6 + e_unrate;
20
21 [name='cpi']
22 cpi = ffr(-1)*p_cpi_ffr_lag_1 + ffr(-2)*p_cpi_ffr_lag_2 + cpi(-2)*p_cpi_cpi_lag_2 + e_cpi;
23
24 end;
25
26 // Set true values for the parameters (randomly, I write directly in M_.params
27 // because I am too lazy to write all the parameter names).
28 M_.params = .1*randn(M_.param_nbr, 1);
29
30 shocks;
31 var e_ffr; stderr .01;
32 var e_unrate; stderr .01;
33 var e_cpi; stderr .01;
34 end;
35
36 // Create a dataset by simulating the model.
37 oo_ = simul_backward_model([], 1000, options_, M_, oo_);
38
39 // Put all the simulated data in a dseries object.
40 ds1 = dseries(transpose(oo_.endo_simul), 1900Q1, M_.endo_names);
41
42
43 // Select a subsample for estimation
44 ds1 = ds1(1951Q1:1990Q1);
45
46
47 // Print true values of the parameters (for comparison with the estimation results).
48 dyn_table('True values for the parameters (DGP)', {}, {}, cellstr(M_.param_names), ...
49 {'Parameter Value'}, 4, M_.params);
50
51
52 /* Run the estimation of equation ffr and display the results. Note that the corresponding
53 ** values in M_.params will be updated.
54 **
55 ** estimate command
56 ** ----------------
57 **
58 ** First argument is used to specify the estimation method
59 ** Second argument is used to specify the dataset (an existing dseries object).
60 ** Third argument (and following) is(are) the name(s) of equation(s) to be estimated.
61 */
62
63 estimate method(ols) data(ds1) ffr;