Debian Codegraph @

tests/ecb/backward-models/solow_forecast.mod

raw
1 close all
2
3 var Efficiency $A$
4 EfficiencyGrowth $X$
5 Population $L$
6 PopulationGrowth $N$
7 Output $Y$
8 PhysicalCapitalStock $K$ ;
9
10 varexo e_x $\varepsilon_x$
11 e_n $\varepsilon_n$;
12
13 parameters alpha $\alpha$
14 delta $\delta$
15 s $s$
16 rho_x $\rho_x$
17 rho_n $\rho_n$
18 EfficiencyGrowth_ss $X^{\star}$
19 PopulationGrowth_ss $N^{\star}$ ;
20
21 alpha = .33;
22 delta = .02;
23 s = .20;
24 rho_x = .90;
25 rho_n = .95;
26 EfficiencyGrowth_ss = 1.02;
27 PopulationGrowth_ss = 1.02;
28
29 model;
30 Efficiency = EfficiencyGrowth*Efficiency(-1);
31 EfficiencyGrowth/EfficiencyGrowth_ss = (EfficiencyGrowth(-1)/EfficiencyGrowth_ss)^(rho_x)*exp(e_x);
32 Population = PopulationGrowth*Population(-1);
33 PopulationGrowth/PopulationGrowth_ss = (PopulationGrowth(-1)/PopulationGrowth_ss)^(rho_n)*exp(e_n);
34 Output = PhysicalCapitalStock(-1)^alpha*(Efficiency*Population)^(1-alpha);
35 PhysicalCapitalStock = (1-delta)*PhysicalCapitalStock(-1) + s*Output;
36 end;
37
38
39 shocks;
40 var e_x = 0.005;
41 var e_n = 0.001;
42 end;
43
44 // Set initial condition for the forecast (we simulate a sample, forecast will start at the end of the sample)
45
46 histval;
47 Efficiency(0) = 1;
48 EfficiencyGrowth(0) = .5;
49 Population(0) = 1;
50 PopulationGrowth(0) = .5;
51 PhysicalCapitalStock(0) = 1;
52 end;
53
54 [simulation__, errorflag] = simul_backward_nonlinear_model([], 10, options_, M_, oo_);
55
56 initialcondition = dseries(simulation__.data(10,1:M_.endo_nbr), 2017Q1, M_.endo_names);
57
58
59 /* REMARKS
60 **
61 ** dseries object initialcondition may have more variable than required.
62 */
63
64 // Define the variables for which we want to compute the IRFs
65 listofvariables = {'Efficiency', 'Output'};
66
67 /* REMARKS
68 **
69 ** If possible do not forecasts all the endogenous variables (this is the default).
70 */
71
72 // Compute the forecasts
73 forecasts = backward_model_forecast(initialcondition, listofvariables, 16, true);
74
75 /* REMARKS
76 **
77 ** - The third argument is the number of periods for the forecast. Default is 8.
78 ** - The last argument is for computing (or not) the confidence bands. If false (default), only point forecast is produced.
79 ** - forecasts is a structure, each field is a dseries object for the point forecast (ie forecasts without innovations in the future),
80 ** the mean forecast, the median forecast, the standard deviation of the predictive distribution and the lower/upper bounds of the
81 ** interval containing 95% of the predictive distribution.
82 */
83
84 // Plot forecast for output
85 plot(forecasts.meanforecast.Output, '-k', 'linewidth', 2)
86 hold on
87 plot(forecasts.lb.Output,'-r')
88 plot(forecasts.ub.Output,'-r')
89 hold off
90
91 /* REMARKS
92 **
93 ** In this model there is no steady state (only a stable balanced growth paths), this explains the
94 ** shape of the forecast for Output.
95 */