Debian Codegraph @

tests/optimizers/fs2000.common.inc

raw
1 /*
2 * This file replicates (except for a small difference in the priors)the estimation of
3 * the cash in advance model described Frank Schorfheide (2000): "Loss function-based
4 * evaluation of DSGE models", Journal of Applied Econometrics, 15(6), 645-670.
5 *
6 * The data are in file "fs2000/fsdat_simul.m", and have been artificially generated.
7 * They are therefore different from the original dataset used by Schorfheide.
8 *
9 * The equations are taken from J. Nason and T. Cogley (1994): "Testing the
10 * implications of long-run neutrality for monetary business cycle models",
11 * Journal of Applied Econometrics, 9, S37-S70.
12 * Note that there is an initial minus sign missing in equation (A1), p. S63.
13 *
14 * This implementation was written by Michel Juillard. Please note that the
15 * following copyright notice only applies to this Dynare implementation of the
16 * model.
17 */
18
19 /*
20 * Copyright © 2004-2017 Dynare Team
21 *
22 * This file is part of Dynare.
23 *
24 * Dynare is free software: you can redistribute it and/or modify
25 * it under the terms of the GNU General Public License as published by
26 * the Free Software Foundation, either version 3 of the License, or
27 * (at your option) any later version.
28 *
29 * Dynare is distributed in the hope that it will be useful,
30 * but WITHOUT ANY WARRANTY; without even the implied warranty of
31 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
32 * GNU General Public License for more details.
33 *
34 * You should have received a copy of the GNU General Public License
35 * along with Dynare. If not, see <https://www.gnu.org/licenses/>.
36 */
37
38 var m P c e W R k d n l gy_obs gp_obs y dA;
39 varexo e_a e_m;
40
41 parameters alp bet gam mst rho psi del;
42
43 alp = 0.33;
44 bet = 0.99;
45 gam = 0.003;
46 mst = 1.011;
47 rho = 0.7;
48 psi = 0.787;
49 del = 0.02;
50
51 model;
52 dA = exp(gam+e_a);
53 log(m) = (1-rho)*log(mst) + rho*log(m(-1))+e_m;
54 -P/(c(+1)*P(+1)*m)+bet*P(+1)*(alp*exp(-alp*(gam+log(e(+1))))*k^(alp-1)*n(+1)^(1-alp)+(1-del)*exp(-(gam+log(e(+1)))))/(c(+2)*P(+2)*m(+1))=0;
55 W = l/n;
56 -(psi/(1-psi))*(c*P/(1-n))+l/n = 0;
57 R = P*(1-alp)*exp(-alp*(gam+e_a))*k(-1)^alp*n^(-alp)/W;
58 1/(c*P)-bet*P*(1-alp)*exp(-alp*(gam+e_a))*k(-1)^alp*n^(1-alp)/(m*l*c(+1)*P(+1)) = 0;
59 c+k = exp(-alp*(gam+e_a))*k(-1)^alp*n^(1-alp)+(1-del)*exp(-(gam+e_a))*k(-1);
60 P*c = m;
61 m-1+d = l;
62 e = exp(e_a);
63 y = k(-1)^alp*n^(1-alp)*exp(-alp*(gam+e_a));
64 gy_obs = dA*y/y(-1);
65 gp_obs = (P/P(-1))*m(-1)/dA;
66 end;
67
68
69 shocks;
70 var e_a; stderr 0.014;
71 var e_m; stderr 0.005;
72 end;
73
74 steady_state_model;
75 dA = exp(gam);
76 gst = 1/dA;
77 m = mst;
78 khst = ( (1-gst*bet*(1-del)) / (alp*gst^alp*bet) )^(1/(alp-1));
79 xist = ( ((khst*gst)^alp - (1-gst*(1-del))*khst)/mst )^(-1);
80 nust = psi*mst^2/( (1-alp)*(1-psi)*bet*gst^alp*khst^alp );
81 n = xist/(nust+xist);
82 P = xist + nust;
83 k = khst*n;
84
85 l = psi*mst*n/( (1-psi)*(1-n) );
86 c = mst/P;
87 d = l - mst + 1;
88 y = k^alp*n^(1-alp)*gst^alp;
89 R = mst/bet;
90 W = l/n;
91 ist = y-c;
92 q = 1 - d;
93
94 e = 1;
95
96 gp_obs = m/dA;
97 gy_obs = dA;
98 end;
99
100 steady;
101
102 check;
103
104 estimated_params;
105 alp, beta_pdf, 0.356, 0.02;
106 @#ifndef SPEED_UP_TESTSUITE
107 bet, beta_pdf, 0.993, 0.002;
108 gam, normal_pdf, 0.0085, 0.003;
109 mst, normal_pdf, 1.0002, 0.007;
110 @#endif
111 /*
112 * The prior on the autoregressive parameter rho is different from the one considered in the original paper.
113 * We lowered the prior variance to ensure that the prior does not have an asymptote at zero, which causes
114 * troubles for some optimizers. For instance, mode_compute=12 (which relies on Mathworks' particleswarm
115 * routine) finds a posterior at zero for rho (with a much higher posterior density than the one reported
116 * by csminwell or other optimization routines). Because zero is on the boundary of the prior, this is an
117 * an issue when we have to compute the hessian matrix (which is not full rank) at the mode or if we try to
118 * use this solution as an initial guess for csminwell.
119 */
120 rho, beta_pdf, 0.129, 0.100;
121 psi, beta_pdf, 0.65, 0.05;
122 del, beta_pdf, 0.01, 0.005;
123 stderr e_a, inv_gamma_pdf, 0.035449, inf;
124 stderr e_m, inv_gamma_pdf, 0.008862, inf;
125 end;
126
127 varobs gp_obs gy_obs;
128 options_.plot_priors=0;