| 1 |
/* |
| 2 |
* This file is based on the cash in advance model described |
| 3 |
* Frank Schorfheide (2000): "Loss function-based evaluation of DSGE models", |
| 4 |
* Journal of Applied Econometrics, 15(6), 645-670. |
| 5 |
* |
| 6 |
* The equations are taken from J. Nason and T. Cogley (1994): "Testing the |
| 7 |
* implications of long-run neutrality for monetary business cycle models", |
| 8 |
* Journal of Applied Econometrics, 9, S37-S70. |
| 9 |
* Note that there is an initial minus sign missing in equation (A1), p. S63. |
| 10 |
* |
| 11 |
* This implementation was written by Michel Juillard. Please note that the |
| 12 |
* following copyright notice only applies to this Dynare implementation of the |
| 13 |
* model. |
| 14 |
*/ |
| 15 |
|
| 16 |
/* |
| 17 |
* Copyright © 2004-2016 Dynare Team |
| 18 |
* |
| 19 |
* This file is part of Dynare. |
| 20 |
* |
| 21 |
* Dynare is free software: you can redistribute it and/or modify |
| 22 |
* it under the terms of the GNU General Public License as published by |
| 23 |
* the Free Software Foundation, either version 3 of the License, or |
| 24 |
* (at your option) any later version. |
| 25 |
* |
| 26 |
* Dynare is distributed in the hope that it will be useful, |
| 27 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 28 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 29 |
* GNU General Public License for more details. |
| 30 |
* |
| 31 |
* You should have received a copy of the GNU General Public License |
| 32 |
* along with Dynare. If not, see <https://www.gnu.org/licenses/>. |
| 33 |
*/ |
| 34 |
|
| 35 |
var m ${m}$ (long_name='Money Stock') |
| 36 |
P ${P}$ (long_name='Price Level') |
| 37 |
c ${c}$ (long_name='Consumption') |
| 38 |
e ${e}$ (long_name='exp(Tech. Shock)') |
| 39 |
W ${W}$ (long_name='Nominal Wage') |
| 40 |
R ${R}$ (long_name='Nominal Rental Rate of Capital') |
| 41 |
k ${k}$ (long_name='Capital') |
| 42 |
d ${d}$ (long_name='Deposits') |
| 43 |
n ${n}$ (long_name='Hours worked') |
| 44 |
l ${l}$ (long_name='Loans') |
| 45 |
gy_obs ${\Delta y^{obs}}$ (long_name='Observed growth rate of output') |
| 46 |
gp_obs ${\Delta m^{obs}}$ (long_name='Observed growth rate of prices') |
| 47 |
y ${y}$ (long_name='Output') |
| 48 |
dA ${\Delta A}$ (long_name='Labor Augm. Techn. Growth Rate') |
| 49 |
; |
| 50 |
varexo e_a ${\varepsilon_a}$ (long_name='Technology shock') |
| 51 |
e_m ${\varepsilon_m}$ (long_name='Observed money growth rate') |
| 52 |
; |
| 53 |
|
| 54 |
parameters alp ${\alpha}$ (long_name='capital share') |
| 55 |
bet ${\beta}$ (long_name='discount factor') |
| 56 |
gam ${\gamma}$ (long_name='Average technology growth') |
| 57 |
mst ${\bar m}$ (long_name='Average money stock') |
| 58 |
rho ${\rho}$ (long_name='Autocorrelation money process') |
| 59 |
psi ${\psi}$ (long_name='Leisure weight in utility') |
| 60 |
del ${\delta}$ (long_name='depreciation') |
| 61 |
; |
| 62 |
|
| 63 |
alp = 0.33; |
| 64 |
bet = 0.99; |
| 65 |
gam = 0.003; |
| 66 |
mst = 1.011; |
| 67 |
rho = 0.7; |
| 68 |
psi = 0.787; |
| 69 |
del = 0.02; |
| 70 |
|
| 71 |
model; |
| 72 |
[name='technology growth: $\Delta A_{t}$', eq='\#1'] |
| 73 |
dA = exp(gam+e_a); |
| 74 |
[name='money supply rule'] |
| 75 |
log(m) = (1-rho)*log(mst) + rho*log(m(-1))+e_m; |
| 76 |
-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; |
| 77 |
W = l/n; |
| 78 |
-(psi/(1-psi))*(c*P/(1-n))+l/n = 0; |
| 79 |
R = P*(1-alp)*exp(-alp*(gam+e_a))*k(-1)^alp*n^(-alp)/W; |
| 80 |
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; |
| 81 |
c+k = exp(-alp*(gam+e_a))*k(-1)^alp*n^(1-alp)+(1-del)*exp(-(gam+e_a))*k(-1); |
| 82 |
P*c = m; |
| 83 |
m-1+d = l; |
| 84 |
e = exp(e_a); |
| 85 |
[name='Production function'] |
| 86 |
y = k(-1)^alp*n^(1-alp)*exp(-alp*(gam+e_a)); |
| 87 |
[name='observed output growth'] |
| 88 |
gy_obs = dA*y/y(-1); |
| 89 |
[name='observed inflation'] |
| 90 |
gp_obs = (P/P(-1))*m(-1)/dA; |
| 91 |
end; |
| 92 |
|
| 93 |
steady_state_model; |
| 94 |
dA = exp(gam); |
| 95 |
gst = 1/dA; |
| 96 |
m = mst; |
| 97 |
khst = ( (1-gst*bet*(1-del)) / (alp*gst^alp*bet) )^(1/(alp-1)); |
| 98 |
xist = ( ((khst*gst)^alp - (1-gst*(1-del))*khst)/mst )^(-1); |
| 99 |
nust = psi*mst^2/( (1-alp)*(1-psi)*bet*gst^alp*khst^alp ); |
| 100 |
n = xist/(nust+xist); |
| 101 |
P = xist + nust; |
| 102 |
k = khst*n; |
| 103 |
|
| 104 |
l = psi*mst*n/( (1-psi)*(1-n) ); |
| 105 |
c = mst/P; |
| 106 |
d = l - mst + 1; |
| 107 |
y = k^alp*n^(1-alp)*gst^alp; |
| 108 |
R = mst/bet; |
| 109 |
W = l/n; |
| 110 |
ist = y-c; |
| 111 |
q = 1 - d; |
| 112 |
|
| 113 |
e = 1; |
| 114 |
|
| 115 |
gp_obs = m/dA; |
| 116 |
gy_obs = dA; |
| 117 |
end; |
| 118 |
|
| 119 |
varobs gp_obs gy_obs; |
| 120 |
|
| 121 |
shocks; |
| 122 |
var e_a; stderr 0.014; |
| 123 |
var e_m; stderr 0.005; |
| 124 |
corr gy_obs,gp_obs = 0.5; |
| 125 |
end; |
| 126 |
|
| 127 |
steady; |
| 128 |
|
| 129 |
stoch_simul(order=1,irf=20,graph_format=eps,periods=1000,contemporaneous_correlation,conditional_variance_decomposition=[1,3],tex); |
| 130 |
options_.rplottype=0; |
| 131 |
rplot y e_a gy_obs; |
| 132 |
options_.rplottype=1; |
| 133 |
rplot l e_m gp_obs; |
| 134 |
options_.rplottype=2; |
| 135 |
rplot n e_a e_m m; |
| 136 |
stoch_simul(order=1,irf=20,graph_format=eps,periods=0,contemporaneous_correlation,conditional_variance_decomposition=[1,3]); |
| 137 |
|
| 138 |
write_latex_original_model; |
| 139 |
write_latex_static_model; |
| 140 |
write_latex_dynamic_model(write_equation_tags); |
| 141 |
write_latex_parameter_table; |
| 142 |
write_latex_definitions; |
| 143 |
write_latex_steady_state_model; |
| 144 |
|
| 145 |
estimated_params; |
| 146 |
alp, 0.356; |
| 147 |
gam, 0.0085; |
| 148 |
del, 0.01; |
| 149 |
stderr e_a, 0.035449; |
| 150 |
stderr e_m, 0.008862; |
| 151 |
corr e_m, e_a, 0; |
| 152 |
stderr gp_obs, 1; |
| 153 |
stderr gy_obs, 1; |
| 154 |
corr gp_obs, gy_obs,0; |
| 155 |
end; |
| 156 |
|
| 157 |
estimation(order=1,mode_compute=4,silent_optimizer,datafile='../fs2000/fsdat_simul',brooks_gelman_plotrows=4, mode_check,smoother,filter_covariance,filter_decomposition,forecast = 8,filtered_vars,filter_step_ahead=[1,3],irf=20,contemporaneous_correlation) m P c e W R k d y gy_obs; |
| 158 |
|
| 159 |
|
| 160 |
|
| 161 |
estimated_params(overwrite); |
| 162 |
//alp, beta_pdf, 0.356, 0.02; |
| 163 |
gam, normal_pdf, 0.0085, 0.003; |
| 164 |
//del, beta_pdf, 0.01, 0.005; |
| 165 |
stderr e_a, inv_gamma_pdf, 0.035449, inf; |
| 166 |
stderr e_m, inv_gamma_pdf, 0.008862, inf; |
| 167 |
corr e_m, e_a, normal_pdf, 0, 0.2; |
| 168 |
stderr gp_obs, inv_gamma_pdf, 0.001, inf; |
| 169 |
stderr gy_obs, inv_gamma_pdf, 0.001, inf; |
| 170 |
corr gp_obs, gy_obs,normal_pdf, 0, 0.2; |
| 171 |
end; |
| 172 |
|
| 173 |
write_latex_prior_table; |
| 174 |
|
| 175 |
estimation(mode_compute=8,silent_optimizer,order=1,datafile='../fs2000/fsdat_simul',mode_check,smoother,filter_decomposition,mh_replic=4000, mh_nblocks=1, mh_jscale=0.8,forecast = 8,bayesian_irf,filtered_vars,filter_step_ahead=[1,3],irf=20, |
| 176 |
moments_varendo,contemporaneous_correlation,conditional_variance_decomposition=[1 2 4],smoothed_state_uncertainty,raftery_lewis_diagnostics) m P c e W R k d y gy_obs; |
| 177 |
|
| 178 |
trace_plot(options_,M_,estim_params_,'PosteriorDensity',1); |
| 179 |
trace_plot(options_,M_,estim_params_,'StructuralShock',1,'e_a') |
| 180 |
|
| 181 |
shock_decomposition y W R; |
| 182 |
|
| 183 |
stoch_simul(order=1,irf=20,graph_format=eps,periods=0,contemporaneous_correlation,conditional_variance_decomposition=[1,3]); |
| 184 |
|
| 185 |
collect_latex_files; |
| 186 |
|
| 187 |
//identification(advanced=1,max_dim_cova_group=3,prior_mc=250); |
| 188 |
[status, cmdout]=system(['pdflatex -halt-on-error -interaction=nonstopmode ' M_.fname '_TeX_binder.tex']); |
| 189 |
if status |
| 190 |
cmdout |
| 191 |
error('TeX-File did not compile.') |
| 192 |
end |