| 1 |
% this is the Smets and Wouters (2007) model for which Komunjer and Ng (2011) |
| 2 |
% derived the minimal state space system. In Dynare, however, we use more |
| 3 |
% powerful minreal function |
| 4 |
/* |
| 5 |
* This file provides replication files for |
| 6 |
* Smets, Frank and Wouters, Rafael (2007): "Shocks and Frictions in US Business Cycles: A Bayesian |
| 7 |
* DSGE Approach", American Economic Review, 97(3), 586-606, that are compatible with Dynare 4.5 onwards |
| 8 |
* |
| 9 |
* To replicate the full results, you have to get back to the original replication files available at |
| 10 |
* https://www.aeaweb.org/articles.php?doi=10.1257/aer.97.3.586 and include the respective estimation commands and mode-files. |
| 11 |
* |
| 12 |
* Notes: |
| 13 |
* - The consumption Euler equation in the paper, equation (2), premultiplies the risk premium process \varepsilon_t^b, |
| 14 |
* denoted by b in this code, by the coefficient c_3. In the code this prefactor is omitted by setting the |
| 15 |
* coefficient to 1. As a consequence, b in this code actually is b:=c_3*\varepsilon_t^b. As a consequence, in |
| 16 |
* the arbitrage equation for the value of capital in the paper, equation (4), the term 1*\varepsilon_t^b |
| 17 |
* is replaced by 1/c_3*b, which is equal to \varepsilon_t^b given the above redefinition. This rescaling also explains why the |
| 18 |
* standard deviation of the risk premium shock in the AR(1)-process for b has a different standard deviation than reported |
| 19 |
* in the paper. However, the results are unaffected by this scaling factor (except for the fact that the posterior distribution |
| 20 |
* reported in the paper cannot be directly translated to the present mod-file due to parameter correlation in the posterior. |
| 21 |
* - As pointed out in Del Negro/Schorfheide (2012): "Notes on New-Keynesian Models" |
| 22 |
* in the code implementation of equation (8) for both the flex price and the sticky price/wage economy, |
| 23 |
* there is a (1/(1+cbetabar*cgamma)) missing in the i_2 in front of q_t (denoted qs in the code). |
| 24 |
* Equation (8) in the paper reads: |
| 25 |
* (1-(1-delta)/gamma)*(1+beta*gamma^(1-sigma))*gamma^2*varphi |
| 26 |
* which translates to the code snippet: |
| 27 |
* (1-(1-ctou)/cgamma)*(1+cbetabar*cgamma)*cgamma^2*csadjcost |
| 28 |
* But the code implements |
| 29 |
* (1-(1-ctou)/cgamma)*cgamma^2*csadjcost |
| 30 |
* which corresponds to an equation reading |
| 31 |
* (1-(1-delta)/gamma)*gamma^2*varphi |
| 32 |
* - Chib/Ramamurthy (2010): "Tailored randomized block MCMC methods with application to DSGE models", Journal of Econometrics, 155, pp. 19-38 |
| 33 |
* have pointed out that the mode reported in the original Smets/Wouters (2007) paper is not actually the mode. \bar \pi (constepinf) is estimated lower |
| 34 |
* while \bar \l (constelab) is higher. |
| 35 |
* - Note that at the prior mean, [cmap,crhopinf] and [cmaw,crhow] are pairwise collinear. Thus, running identification at the prior |
| 36 |
* mean will return a warning. But this is only a local issue. These parameters are only indistinguishable at the prior mean, but not |
| 37 |
* at different points. |
| 38 |
* - In the prior Table 1A in the paper, the |
| 39 |
* - habit parameter $\lambda$ is erroneously labeled h |
| 40 |
* - the fixed cost parameter $\phi_p$ is labeled $\Phi$ |
| 41 |
* - Table 1B claims that $\rho_{ga}$ follows a beta prior with B(0.5,0.2^2), but the code shows that it actually |
| 42 |
* follows a normal distribution with N(0.5,0.25^2) |
| 43 |
* |
| 44 |
* This file was originally written by Frank Smets and Rafeal Wouters and has been updated by |
| 45 |
* Johannes Pfeifer. |
| 46 |
* |
| 47 |
* Please note that the following copyright notice only applies to this Dynare |
| 48 |
* implementation of the model |
| 49 |
*/ |
| 50 |
|
| 51 |
/* |
| 52 |
* Copyright © 2007-2013 Frank Smets and Raf Wouters |
| 53 |
* Copyright © 2013-15 Johannes Pfeifer |
| 54 |
* Copyright © 2020 Dynare Team |
| 55 |
* |
| 56 |
* This is free software: you can redistribute it and/or modify |
| 57 |
* it under the terms of the GNU General Public License as published by |
| 58 |
* the Free Software Foundation, either version 3 of the License, or |
| 59 |
* (at your option) any later version. |
| 60 |
* |
| 61 |
* This file is distributed in the hope that it will be useful, |
| 62 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 63 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 64 |
* GNU General Public License for more details. |
| 65 |
* |
| 66 |
* You can receive a copy of the GNU General Public License |
| 67 |
* at <https://www.gnu.org/licenses/>. |
| 68 |
*/ |
| 69 |
|
| 70 |
var labobs ${lHOURS}$ (long_name='log hours worked') |
| 71 |
robs ${FEDFUNDS}$ (long_name='Federal funds rate') |
| 72 |
pinfobs ${dlP}$ (long_name='Inflation') |
| 73 |
dy ${dlGDP}$ (long_name='Output growth rate') |
| 74 |
dc ${dlCONS}$ (long_name='Consumption growth rate') |
| 75 |
dinve ${dlINV}$ (long_name='Investment growth rate') |
| 76 |
dw ${dlWAG}$ (long_name='Wage growth rate') |
| 77 |
ewma ${\eta^{w,aux}}$ (long_name='Auxiliary wage markup moving average variable') |
| 78 |
epinfma ${\eta^{p,aux}}$ (long_name='Auxiliary price markup moving average variable') |
| 79 |
zcapf ${z^{flex}}$ (long_name='Capital utilization rate flex price economy') |
| 80 |
rkf ${r^{k,flex}}$ (long_name='rental rate of capital flex price economy') |
| 81 |
kf ${k^{s,flex}}$ (long_name='Capital services flex price economy') |
| 82 |
pkf ${q^{flex}}$ (long_name='real value of existing capital stock flex price economy') |
| 83 |
cf ${c^{flex}}$ (long_name='Consumption flex price economy') |
| 84 |
invef ${i^{flex}}$ (long_name='Investment flex price economy') |
| 85 |
yf ${y^{flex}}$ (long_name='Output flex price economy') |
| 86 |
labf ${l^{flex}}$ (long_name='hours worked flex price economy') |
| 87 |
wf ${w^{flex}}$ (long_name='real wage flex price economy') |
| 88 |
rrf ${r^{flex}}$ (long_name='real interest rate flex price economy') |
| 89 |
mc ${\mu_p}$ (long_name='gross price markup') |
| 90 |
zcap ${z}$ (long_name='Capital utilization rate') |
| 91 |
rk ${r^{k}}$ (long_name='rental rate of capital') |
| 92 |
k ${k^{s}}$ (long_name='Capital services') |
| 93 |
pk ${q}$ (long_name='real value of existing capital stock') |
| 94 |
c ${c}$ (long_name='Consumption') |
| 95 |
inve ${i}$ (long_name='Investment') |
| 96 |
y ${y}$ (long_name='Output') |
| 97 |
lab ${l}$ (long_name='hours worked') |
| 98 |
pinf ${\pi}$ (long_name='Inflation') |
| 99 |
w ${w}$ (long_name='real wage') |
| 100 |
r ${r}$ (long_name='nominal interest rate') |
| 101 |
a ${\varepsilon_a}$ (long_name='productivity process') |
| 102 |
b ${c_2*\varepsilon_t^b}$ (long_name='Scaled risk premium shock') |
| 103 |
g ${\varepsilon^g}$ (long_name='Exogenous spending') |
| 104 |
qs ${\varepsilon^i}$ (long_name='Investment-specific technology') |
| 105 |
ms ${\varepsilon^r}$ (long_name='Monetary policy shock process') |
| 106 |
spinf ${\varepsilon^p}$ (long_name='Price markup shock process') |
| 107 |
sw ${\varepsilon^w}$ (long_name='Wage markup shock process') |
| 108 |
kpf ${k^{flex}}$ (long_name='Capital stock flex price economy') |
| 109 |
kp ${k}$ (long_name='Capital stock') |
| 110 |
; |
| 111 |
|
| 112 |
varexo ea ${\eta^a}$ (long_name='productivity shock') |
| 113 |
eb ${\eta^b}$ (long_name='Investment-specific technology shock') |
| 114 |
eg ${\eta^g}$ (long_name='Spending shock') |
| 115 |
eqs ${\eta^i}$ (long_name='Investment-specific technology shock') |
| 116 |
em ${\eta^m}$ (long_name='Monetary policy shock') |
| 117 |
epinf ${\eta^{p}}$ (long_name='Price markup shock') |
| 118 |
ew ${\eta^{w}}$ (long_name='Wage markup shock') |
| 119 |
; |
| 120 |
|
| 121 |
parameters curvw ${\varepsilon_w}$ (long_name='Curvature Kimball aggregator wages') |
| 122 |
cgy ${\rho_{ga}}$ (long_name='Feedback technology on exogenous spending') |
| 123 |
curvp ${\varepsilon_p}$ (long_name='Curvature Kimball aggregator prices') |
| 124 |
constelab ${\bar l}$ (long_name='steady state hours') |
| 125 |
constepinf ${\bar \pi}$ (long_name='steady state inflation rate') |
| 126 |
constebeta ${100(\beta^{-1}-1)}$ (long_name='time preference rate in percent') |
| 127 |
cmaw ${\mu_w}$ (long_name='coefficient on MA term wage markup') |
| 128 |
cmap ${\mu_p}$ (long_name='coefficient on MA term price markup') |
| 129 |
calfa ${\alpha}$ (long_name='capital share') |
| 130 |
czcap ${\psi}$ (long_name='capacity utilization cost') |
| 131 |
csadjcost ${\varphi}$ (long_name='investment adjustment cost') |
| 132 |
ctou ${\delta}$ (long_name='depreciation rate') |
| 133 |
csigma ${\sigma_c}$ (long_name='risk aversion') |
| 134 |
chabb ${\lambda}$ (long_name='external habit degree') |
| 135 |
ccs ${d_4}$ (long_name='Unused parameter') |
| 136 |
cinvs ${d_3}$ (long_name='Unused parameter') |
| 137 |
cfc ${\phi_p}$ (long_name='fixed cost share') |
| 138 |
cindw ${\iota_w}$ (long_name='Indexation to past wages') |
| 139 |
cprobw ${\xi_w}$ (long_name='Calvo parameter wages') |
| 140 |
cindp ${\iota_p}$ (long_name='Indexation to past prices') |
| 141 |
cprobp ${\xi_p}$ (long_name='Calvo parameter prices') |
| 142 |
csigl ${\sigma_l}$ (long_name='Frisch elasticity') |
| 143 |
clandaw ${\phi_w}$ (long_name='Gross markup wages') |
| 144 |
crdpi ${r_{\Delta \pi}}$ (long_name='Unused parameter') |
| 145 |
crpi ${r_{\pi}}$ (long_name='Taylor rule inflation feedback') |
| 146 |
crdy ${r_{\Delta y}}$ (long_name='Taylor rule output growth feedback') |
| 147 |
cry ${r_{y}}$ (long_name='Taylor rule output level feedback') |
| 148 |
crr ${\rho}$ (long_name='interest rate persistence') |
| 149 |
crhoa ${\rho_a}$ (long_name='persistence productivity shock') |
| 150 |
crhoas ${d_2}$ (long_name='Unused parameter') |
| 151 |
crhob ${\rho_b}$ (long_name='persistence risk premium shock') |
| 152 |
crhog ${\rho_g}$ (long_name='persistence spending shock') |
| 153 |
crhols ${d_1}$ (long_name='Unused parameter') |
| 154 |
crhoqs ${\rho_i}$ (long_name='persistence risk premium shock') |
| 155 |
crhoms ${\rho_r}$ (long_name='persistence monetary policy shock') |
| 156 |
crhopinf ${\rho_p}$ (long_name='persistence price markup shock') |
| 157 |
crhow ${\rho_w}$ (long_name='persistence wage markup shock') |
| 158 |
ctrend ${\bar \gamma}$ (long_name='net growth rate in percent') |
| 159 |
cg ${\frac{\bar g}{\bar y}}$ (long_name='steady state exogenous spending share') |
| 160 |
; |
| 161 |
|
| 162 |
// fixed parameters |
| 163 |
ctou=.025; |
| 164 |
clandaw=1.5; |
| 165 |
cg=0.18; |
| 166 |
curvp=10; |
| 167 |
curvw=10; |
| 168 |
|
| 169 |
// estimated parameters initialisation |
| 170 |
calfa=.24; |
| 171 |
cbeta=.9995; |
| 172 |
csigma=1.5; |
| 173 |
cfc=1.5; |
| 174 |
cgy=0.51; |
| 175 |
|
| 176 |
csadjcost= 6.0144; |
| 177 |
chabb= 0.6361; |
| 178 |
cprobw= 0.8087; |
| 179 |
csigl= 1.9423; |
| 180 |
cprobp= 0.6; |
| 181 |
cindw= 0.3243; |
| 182 |
cindp= 0.47; |
| 183 |
czcap= 0.2696; |
| 184 |
crpi= 1.488; |
| 185 |
crr= 0.8762; |
| 186 |
cry= 0.0593; |
| 187 |
crdy= 0.2347; |
| 188 |
|
| 189 |
crhoa= 0.9977; |
| 190 |
crhob= 0.5799; |
| 191 |
crhog= 0.9957; |
| 192 |
crhols= 0.9928; |
| 193 |
crhoqs= 0.7165; |
| 194 |
crhoas=1; |
| 195 |
crhoms=0; |
| 196 |
crhopinf=0; |
| 197 |
crhow=0; |
| 198 |
cmap = 0; |
| 199 |
cmaw = 0; |
| 200 |
|
| 201 |
constelab=0; |
| 202 |
|
| 203 |
%% Added by JP to provide full calibration of model before estimation |
| 204 |
constepinf=0.7; |
| 205 |
constebeta=0.7420; |
| 206 |
ctrend=0.3982; |
| 207 |
|
| 208 |
model(linear); |
| 209 |
//deal with parameter dependencies; taken from usmodel_stst.mod |
| 210 |
#cpie=1+constepinf/100; %gross inflation rate |
| 211 |
#cgamma=1+ctrend/100 ; %gross growth rate |
| 212 |
#cbeta=1/(1+constebeta/100); %discount factor |
| 213 |
|
| 214 |
#clandap=cfc; %fixed cost share/gross price markup |
| 215 |
#cbetabar=cbeta*cgamma^(-csigma); %growth-adjusted discount factor in Euler equation |
| 216 |
#cr=cpie/(cbeta*cgamma^(-csigma)); %steady state net real interest rate |
| 217 |
#crk=(cbeta^(-1))*(cgamma^csigma) - (1-ctou); %R^k_{*}: steady state rental rate |
| 218 |
#cw = (calfa^calfa*(1-calfa)^(1-calfa)/(clandap*crk^calfa))^(1/(1-calfa)); %steady state real wage |
| 219 |
//cw = (calfa^calfa*(1-calfa)^(1-calfa)/(clandap*((cbeta^(-1))*(cgamma^csigma) - (1-ctou))^calfa))^(1/(1-calfa)); |
| 220 |
#cikbar=(1-(1-ctou)/cgamma); %k_1 in equation LOM capital, equation (8) |
| 221 |
#cik=(1-(1-ctou)/cgamma)*cgamma; %i_k: investment-capital ratio |
| 222 |
#clk=((1-calfa)/calfa)*(crk/cw); %labor to capital ratio |
| 223 |
#cky=cfc*(clk)^(calfa-1); %k_y: steady state output ratio |
| 224 |
#ciy=cik*cky; %consumption-investment ratio |
| 225 |
#ccy=1-cg-cik*cky; %consumption-output ratio |
| 226 |
#crkky=crk*cky; %z_y=R_{*}^k*k_y |
| 227 |
#cwhlc=(1/clandaw)*(1-calfa)/calfa*crk*cky/ccy; %W^{h}_{*}*L_{*}/C_{*} used in c_2 in equation (2) |
| 228 |
#cwly=1-crk*cky; %unused parameter |
| 229 |
|
| 230 |
#conster=(cr-1)*100; %steady state federal funds rate ($\bar r$) |
| 231 |
|
| 232 |
// flexible economy |
| 233 |
|
| 234 |
[name='FOC labor with mpl expressed as function of rk and w, flex price economy'] |
| 235 |
0*(1-calfa)*a + 1*a = calfa*rkf+(1-calfa)*(wf) ; |
| 236 |
[name='FOC capacity utilization, flex price economy'] |
| 237 |
zcapf = (1/(czcap/(1-czcap)))* rkf ; |
| 238 |
[name='Firm FOC capital, flex price economy'] |
| 239 |
rkf = (wf)+labf-kf ; |
| 240 |
[name='Definition capital services, flex price economy'] |
| 241 |
kf = kpf(-1)+zcapf ; |
| 242 |
[name='Investment Euler Equation, flex price economy'] |
| 243 |
invef = (1/(1+cbetabar*cgamma))* ( invef(-1) + cbetabar*cgamma*invef(1)+(1/(cgamma^2*csadjcost))*pkf ) +qs ; |
| 244 |
[name='Arbitrage equation value of capital, flex price economy'] |
| 245 |
pkf = -rrf-0*b+(1/((1-chabb/cgamma)/(csigma*(1+chabb/cgamma))))*b +(crk/(crk+(1-ctou)))*rkf(1) + ((1-ctou)/(crk+(1-ctou)))*pkf(1) ; |
| 246 |
[name='Consumption Euler Equation, flex price economy'] |
| 247 |
cf = (chabb/cgamma)/(1+chabb/cgamma)*cf(-1) + (1/(1+chabb/cgamma))*cf(+1) +((csigma-1)*cwhlc/(csigma*(1+chabb/cgamma)))*(labf-labf(+1)) - (1-chabb/cgamma)/(csigma*(1+chabb/cgamma))*(rrf+0*b) + b ; |
| 248 |
[name='Aggregate Resource Constraint, flex price economy'] |
| 249 |
yf = ccy*cf+ciy*invef+g + crkky*zcapf ; |
| 250 |
[name='Aggregate Production Function, flex price economy'] |
| 251 |
yf = cfc*( calfa*kf+(1-calfa)*labf +a ); |
| 252 |
[name='Wage equation, flex price economy'] |
| 253 |
wf = csigl*labf +(1/(1-chabb/cgamma))*cf - (chabb/cgamma)/(1-chabb/cgamma)*cf(-1) ; |
| 254 |
[name='Law of motion for capital, flex price economy (see header notes)'] |
| 255 |
kpf = (1-cikbar)*kpf(-1)+(cikbar)*invef + (cikbar)*(cgamma^2*csadjcost)*qs ; |
| 256 |
|
| 257 |
// sticky price - wage economy |
| 258 |
[name='FOC labor with mpl expressed as function of rk and w, SW Equation (9)'] |
| 259 |
mc = calfa*rk+(1-calfa)*(w) - 1*a - 0*(1-calfa)*a ; |
| 260 |
[name='FOC capacity utilization, SW Equation (7)'] |
| 261 |
zcap = (1/(czcap/(1-czcap)))* rk ; |
| 262 |
[name='Firm FOC capital, SW Equation (11)'] |
| 263 |
rk = w+lab-k ; |
| 264 |
[name='Definition capital services, SW Equation (6)'] |
| 265 |
k = kp(-1)+zcap ; |
| 266 |
[name='Investment Euler Equation, SW Equation (3)'] |
| 267 |
inve = (1/(1+cbetabar*cgamma))* (inve(-1) + cbetabar*cgamma*inve(1)+(1/(cgamma^2*csadjcost))*pk ) +qs ; |
| 268 |
[name='Arbitrage equation value of capital, SW Equation (4)'] |
| 269 |
pk = -r+pinf(1)-0*b |
| 270 |
+ (1/((1-chabb/cgamma)/(csigma*(1+chabb/cgamma))))*b |
| 271 |
+ (crk/(crk+(1-ctou)))*rk(1) |
| 272 |
+ ((1-ctou)/(crk+(1-ctou)))*pk(1) ; |
| 273 |
[name='Consumption Euler Equation, SW Equation (2)'] |
| 274 |
c = (chabb/cgamma)/(1+chabb/cgamma)*c(-1) |
| 275 |
+ (1/(1+chabb/cgamma))*c(+1) |
| 276 |
+((csigma-1)*cwhlc/(csigma*(1+chabb/cgamma)))*(lab-lab(+1)) |
| 277 |
- (1-chabb/cgamma)/(csigma*(1+chabb/cgamma))*(r-pinf(+1) + 0*b) +b ; |
| 278 |
[name='Aggregate Resource Constraint, SW Equation (1)'] |
| 279 |
y = ccy*c+ciy*inve+g + 1*crkky*zcap ; |
| 280 |
[name='Aggregate Production Function, SW Equation (5)'] |
| 281 |
y = cfc*( calfa*k+(1-calfa)*lab +a ); |
| 282 |
[name='New Keynesian Phillips Curve, SW Equation (10)'] |
| 283 |
pinf = (1/(1+cbetabar*cgamma*cindp)) * ( cbetabar*cgamma*pinf(1) +cindp*pinf(-1) |
| 284 |
+((1-cprobp)*(1-cbetabar*cgamma*cprobp)/cprobp)/((cfc-1)*curvp+1)*(mc) ) + spinf ; |
| 285 |
[name='Wage Phillips Curve, SW Equation (13), with (12) plugged for mu_w'] |
| 286 |
w = (1/(1+cbetabar*cgamma))*w(-1) |
| 287 |
+(cbetabar*cgamma/(1+cbetabar*cgamma))*w(1) |
| 288 |
+(cindw/(1+cbetabar*cgamma))*pinf(-1) |
| 289 |
-(1+cbetabar*cgamma*cindw)/(1+cbetabar*cgamma)*pinf |
| 290 |
+(cbetabar*cgamma)/(1+cbetabar*cgamma)*pinf(1) |
| 291 |
+(1-cprobw)*(1-cbetabar*cgamma*cprobw)/((1+cbetabar*cgamma)*cprobw)*(1/((clandaw-1)*curvw+1))* |
| 292 |
(csigl*lab + (1/(1-chabb/cgamma))*c - ((chabb/cgamma)/(1-chabb/cgamma))*c(-1) -w) |
| 293 |
+ 1*sw ; |
| 294 |
[name='Taylor rule, SW Equation (14)'] |
| 295 |
r = crpi*(1-crr)*pinf |
| 296 |
+cry*(1-crr)*(y-yf) |
| 297 |
+crdy*(y-yf-y(-1)+yf(-1)) |
| 298 |
+crr*r(-1) |
| 299 |
+ms ; |
| 300 |
[name='Law of motion for productivity'] |
| 301 |
a = crhoa*a(-1) + ea; |
| 302 |
[name='Law of motion for risk premium'] |
| 303 |
b = crhob*b(-1) + eb; |
| 304 |
[name='Law of motion for spending process'] |
| 305 |
g = crhog*(g(-1)) + eg + cgy*ea; |
| 306 |
[name='Law of motion for investment specific technology shock process'] |
| 307 |
qs = crhoqs*qs(-1) + eqs; |
| 308 |
[name='Law of motion for monetary policy shock process'] |
| 309 |
ms = crhoms*ms(-1) + em; |
| 310 |
[name='Law of motion for price markup shock process'] |
| 311 |
spinf = crhopinf*spinf(-1) + epinfma - cmap*epinfma(-1); |
| 312 |
epinfma=epinf; |
| 313 |
[name='Law of motion for wage markup shock process'] |
| 314 |
sw = crhow*sw(-1) + ewma - cmaw*ewma(-1) ; |
| 315 |
ewma=ew; |
| 316 |
[name='Law of motion for capital, SW Equation (8) (see header notes)'] |
| 317 |
kp = (1-cikbar)*kp(-1)+cikbar*inve + cikbar*cgamma^2*csadjcost*qs ; |
| 318 |
|
| 319 |
// measurement equations |
| 320 |
[name='Observation equation output'] |
| 321 |
dy=y-y(-1)+ctrend; |
| 322 |
[name='Observation equation consumption'] |
| 323 |
dc=c-c(-1)+ctrend; |
| 324 |
[name='Observation equation investment'] |
| 325 |
dinve=inve-inve(-1)+ctrend; |
| 326 |
[name='Observation equation real wage'] |
| 327 |
dw=w-w(-1)+ctrend; |
| 328 |
[name='Observation equation inflation'] |
| 329 |
pinfobs = 1*(pinf) + constepinf; |
| 330 |
[name='Observation equation interest rate'] |
| 331 |
robs = 1*(r) + conster; |
| 332 |
[name='Observation equation hours worked'] |
| 333 |
labobs = lab + constelab; |
| 334 |
|
| 335 |
end; |
| 336 |
|
| 337 |
steady_state_model; |
| 338 |
dy=ctrend; |
| 339 |
dc=ctrend; |
| 340 |
dinve=ctrend; |
| 341 |
dw=ctrend; |
| 342 |
pinfobs = constepinf; |
| 343 |
robs = (((1+constepinf/100)/((1/(1+constebeta/100))*(1+ctrend/100)^(-csigma)))-1)*100; |
| 344 |
labobs = constelab; |
| 345 |
end; |
| 346 |
|
| 347 |
shocks; |
| 348 |
var ea; |
| 349 |
stderr 0.4618; |
| 350 |
var eb; |
| 351 |
stderr 1.8513; |
| 352 |
var eg; |
| 353 |
stderr 0.6090; |
| 354 |
var eqs; |
| 355 |
stderr 0.6017; |
| 356 |
var em; |
| 357 |
stderr 0.2397; |
| 358 |
var epinf; |
| 359 |
stderr 0.1455; |
| 360 |
var ew; |
| 361 |
stderr 0.2089; |
| 362 |
end; |
| 363 |
|
| 364 |
|
| 365 |
estimated_params; |
| 366 |
// PARAM NAME, INITVAL, LB, UB, PRIOR_SHAPE, PRIOR_P1, PRIOR_P2, PRIOR_P3, PRIOR_P4, JSCALE |
| 367 |
// PRIOR_SHAPE: BETA_PDF, GAMMA_PDF, NORMAL_PDF, INV_GAMMA_PDF |
| 368 |
stderr ea,0.4618,0.01,3,INV_GAMMA_PDF,0.1,2; |
| 369 |
stderr eb,0.1818513,0.025,5,INV_GAMMA_PDF,0.1,2; |
| 370 |
stderr eg,0.6090,0.01,3,INV_GAMMA_PDF,0.1,2; |
| 371 |
stderr eqs,0.46017,0.01,3,INV_GAMMA_PDF,0.1,2; |
| 372 |
stderr em,0.2397,0.01,3,INV_GAMMA_PDF,0.1,2; |
| 373 |
stderr epinf,0.1455,0.01,3,INV_GAMMA_PDF,0.1,2; |
| 374 |
stderr ew,0.2089,0.01,3,INV_GAMMA_PDF,0.1,2; |
| 375 |
crhoa,.9676 ,.01,.9999,BETA_PDF,0.5,0.20; |
| 376 |
crhob,.2703,.01,.9999,BETA_PDF,0.5,0.20; |
| 377 |
crhog,.9930,.01,.9999,BETA_PDF,0.5,0.20; |
| 378 |
crhoqs,.5724,.01,.9999,BETA_PDF,0.5,0.20; |
| 379 |
crhoms,.3,.01,.9999,BETA_PDF,0.5,0.20; |
| 380 |
crhopinf,.8692,.01,.9999,BETA_PDF,0.5,0.20; |
| 381 |
crhow,.9546,.001,.9999,BETA_PDF,0.5,0.20; |
| 382 |
cmap,.7652,0.01,.9999,BETA_PDF,0.5,0.2; |
| 383 |
cmaw,.8936,0.01,.9999,BETA_PDF,0.5,0.2; |
| 384 |
csadjcost,6.3325,2,15,NORMAL_PDF,4,1.5; |
| 385 |
csigma,1.2312,0.25,3,NORMAL_PDF,1.50,0.375; |
| 386 |
chabb,0.7205,0.001,0.99,BETA_PDF,0.7,0.1; |
| 387 |
cprobw,0.7937,0.3,0.95,BETA_PDF,0.5,0.1; |
| 388 |
csigl,2.8401,0.25,10,NORMAL_PDF,2,0.75; |
| 389 |
cprobp,0.7813,0.5,0.95,BETA_PDF,0.5,0.10; |
| 390 |
cindw,0.4425,0.01,0.99,BETA_PDF,0.5,0.15; |
| 391 |
cindp,0.3291,0.01,0.99,BETA_PDF,0.5,0.15; |
| 392 |
czcap,0.2648,0.01,1,BETA_PDF,0.5,0.15; |
| 393 |
cfc,1.4672,1.0,3,NORMAL_PDF,1.25,0.125; |
| 394 |
crpi,1.7985,1.0,3,NORMAL_PDF,1.5,0.25; |
| 395 |
crr,0.8258,0.5,0.975,BETA_PDF,0.75,0.10; |
| 396 |
cry,0.0893,0.001,0.5,NORMAL_PDF,0.125,0.05; |
| 397 |
crdy,0.2239,0.001,0.5,NORMAL_PDF,0.125,0.05; |
| 398 |
constepinf,0.7,0.1,2.0,GAMMA_PDF,0.625,0.1;//20; |
| 399 |
constebeta,0.7420,0.01,2.0,GAMMA_PDF,0.25,0.1;//0.20; |
| 400 |
constelab,1.2918,-10.0,10.0,NORMAL_PDF,0.0,2.0; |
| 401 |
ctrend,0.3982,0.1,0.8,NORMAL_PDF,0.4,0.10; |
| 402 |
cgy,0.05,0.01,2.0,NORMAL_PDF,0.5,0.25; |
| 403 |
calfa,0.24,0.01,1.0,NORMAL_PDF,0.3,0.05; |
| 404 |
end; |
| 405 |
|
| 406 |
stoch_simul(order=1,irf=0,periods=0); |
| 407 |
options_.qz_criterium = 1; |
| 408 |
|
| 409 |
indx = [M_.nstatic+(1:M_.nspred)]'; |
| 410 |
indy = 1:M_.endo_nbr'; |
| 411 |
|
| 412 |
SS.A = oo_.dr.ghx(indx,:); |
| 413 |
SS.B = oo_.dr.ghu(indx,:); |
| 414 |
SS.C = oo_.dr.ghx(indy,:); |
| 415 |
SS.D = oo_.dr.ghu(indy,:); |
| 416 |
|
| 417 |
[CheckCO,minnx,minSS] = identification.get_minimal_state_representation(SS,0); |
| 418 |
|
| 419 |
Sigmax_full = lyapunov_symm(SS.A, SS.B*M_.Sigma_e*SS.B', options_.lyapunov_fixed_point_tol, options_.qz_criterium, options_.lyapunov_complex_threshold, 1, options_.debug); |
| 420 |
Sigmay_full = SS.C*Sigmax_full*SS.C' + SS.D*M_.Sigma_e*SS.D'; |
| 421 |
|
| 422 |
Sigmax_min = lyapunov_symm(minSS.A, minSS.B*M_.Sigma_e*minSS.B', options_.lyapunov_fixed_point_tol, options_.qz_criterium, options_.lyapunov_complex_threshold, 1, options_.debug); |
| 423 |
Sigmay_min = minSS.C*Sigmax_min*minSS.C' + minSS.D*M_.Sigma_e*minSS.D'; |
| 424 |
|
| 425 |
([Sigmay_full(:) - Sigmay_min(:)]'); |
| 426 |
sqrt(([diag(Sigmay_full), diag(Sigmay_min)]')); |
| 427 |
dx = norm( Sigmay_full - Sigmay_min, Inf); |
| 428 |
if dx > 3e-8 |
| 429 |
error(sprintf('something wrong with minimal state space computations, as numerical error is %d',dx)) |
| 430 |
else |
| 431 |
fprintf('numerical error for moments computed from minimal state system is %d\n',dx) |
| 432 |
end |