DSGE Instruction |
DSGE( options ) list of target series<<initial values
DSGE takes a model (possibly nonlinear) with expectational elements and solves it for a state space form. For a nonlinear model, this is done by expanding around a steady state.
Parameters
target series |
List of series which are the endogenous variables in the model. The number of series should match the number of equations in the model. |
initial values |
(Optional) You can use the syntax "series<<value" to provide an initial guess value for the expansion point for some or all of the target series. |
Options
MODEL=MODEL to be solved
This must take the form shown in “Form for Model”.
EXPAND=[NONE]/LINEAR/LOGLINEAR
This indicates the type of expansion required. The default (EXPAND=NONE) is used when the model is fully linear. EXPAND=LINEAR does a linear expansion around the steady state, and EXPAND=LOGLINEAR does a log-linear expansion around the steady state.
INITIAL=VECTOR of initial guess values [0’s or 1’s]
ITERS=iteration limit for solution algorithm [50]
CVCRIT=convergence criterion [.00001]
STEADYSTATE=VECTOR of final converged values [not used]
SOLVEBY=[LU]/SVD
TRACE/[NOTRACE]
These apply if the model is non-linear and thus needs expansion, and are used in computing a steady state expansion point. The algorithm used is the standard Newton’s method if EXPAND=LINEAR or a log-linearized version if EXPAND=LOGLINEAR. You can input an expansion vector by providing it with INITIAL and setting ITERS=0. You can retrieve the final values with the STEADYSTATE option. The VECTORS for both INITIAL and STEADYSTATE are in the order listed in the list of target series. SOLVEBY selects between LU decomposition, which is faster but fails for unit roots, or the slower but more robust Singular Value Decomposition. TRACE provides trace output detailing the estimation process.
CUTOFF=value or formula giving stable vs unstable roots cutoff [1.0]
See “Algorithm (Solving for State Space Representation)”
A=(output) A matrix for state space model
Z=(output) Z matrix for state space model
F=(output) F matrix for state space model
These are the output arrays from DSGE which describe the state space model which solves the (possibly expanded) model. This takes the form
\({{\bf{X}}_t} = {\bf{A}}{\kern 1pt} {{\bf{X}}_{t - 1}} + {\bf{Z}} + {\bf{F}}{\kern 1pt} {{\bf{W}}_t}\)
The first components of \(\bf{X}\) are the target series from the DSGE instruction in order (except with the CONTROLS option below). It may have more components to handle additional lags and auxiliary variables for the expectational terms. \(\bf{W}\) has dimension equal to the number of non-identities in the model—if you have more than one shock, they are ordered based upon the order of listing in the GROUP instruction that creates the model.
ROOTS=(output) VECTOR of (absolute values) of the roots of the model
Saves the roots of the model to a vector.
ETZ=(output) VECTOR/RECTANGULAR] with three components
Use this option to have DSGE create a vector of rectangular arrays with components for computing effect of future exogenous shocks. In Sims (2002), the general form of the solution to the (linearized) DSGE is
\(y(t) = {\Theta _1}y(t - 1) + {\Theta _c} + {\Theta _0}z(t) + {\Theta _y}\sum\limits_{s = 1}^\infty {\Theta _f^{s - 1}{\Theta _z}{E_t}z\left( {t + s} \right)} \)
You can retrieve \(\Theta _1\) using the A option, \(\Theta _c\) with the Z option and \(\Theta _0\) with the F option. The final term drops out if the \(z\) process is serially uncorrelated. If it isn’t, or if you want to predict the effect of (known) future shocks to \(z\), you can use the ETZ option to obtain the three matrices needed for that. After ETZ=THETA, THETA(1) has \(\Theta _y\), THETA(2) has \(\Theta _f\) and THETA(3) has \(\Theta _z\). Note that the infinite sum in the final term will rarely simplify easily, so the sum will generally have to be approximated with a finite number of terms.
Options for Multiple Stage Solutions
These options allow you to do the analysis of the model in stages.
ANALYZE=[FULL]/OUTPUT/INPUT
FORM=[SIMS]/SECOND/FIRST
COMPONENTS=(output/input) VECT[RECT] of components
CONTROLS=# of controls [0]
ANALYZE=FULL gives the standard behavior of the DSGE instruction. The ANALYZE=OUTPUT option generates the components of the model for the form selected by the FORM option, saving the results in the variable provided on the COMPONENTS option. ANALYZE=INPUT takes as input the components provided using the COMPONENTS option and solves out the model. For FORM=FIRST and FORM=SECOND, the COMPONENTS vector has the five \(\Gamma\) matrices from the following representation in order and with sign conventions shown:
\({\Gamma _0}{y_t} = {\Gamma _l}{y_{t - 1}} + {\Gamma _f}{E_t}{y_{t + 1}} + {\Gamma _\varepsilon }{\varepsilon _t} + {\Gamma _c}\)
FORM=FIRST is a “first-order” representation, where the states are defined so this can be done with \({\Gamma _l}\) as zero. In FORM=SIMS, the middle term takes the form \({\Gamma _f}{\eta _t}\) where \({E_t}{\eta _{t + 1}} = 0\).
The CONTROLS option controls the positioning of the states for the final set of series listed on the DSGE instruction. Ordinarily, all augmenting states (leads and extra lags) are included after all the original series. However, with the CONTROLS option, those final series are placed at the end of the state vector so you can easily separate them from the remainder of the states.
The model is a set of FRML’s which are to take the value zero at a solution. Expectational terms are handled by using leads of the series involved: a lead represents an expectation given information at time t. For instance, a standard condition for optimal consumption in a very simple model is
\({E_t}\left( {\beta {R_t}{C_t}/{C_{t + 1}}} \right) = 1\)
This would be represented by
frml(identity) f1 = beta*r*c/c{-1}-1.0
where R and C are series and BETA is a real-valued parameter.
It’s very important to declare formulas as identities if they are not subject to time t shocks. Each non-identity is assumed to be subject to a separate time t shock which will be one of the components of \(\bf{W}\).
You may need to make adjustments to your original model to put it into this particular form.
Algorithm (Solving for Steady State)
In the steady state, all lags or leads (thus expectations) of each dependent variable are assumed to be represented by a single common value. If x represents the vector of steady state values, then the solution is the vector which solves F(x)=0. Newton’s method updates using:
\({{\bf{x}}_{n + 1}} = {{\bf{x}}_n} - F'{({{\bf{x}}_n})^{ - 1}}F({{\bf{x}}_n})\)
until convergence.
If the model is being subject to log-linear expansion, the update is
\(\log {{\bf{x}}_{n + 1}} = \log {{\bf{x}}_n} - {\left( {diag({{\bf{x}}_n})F'({{\bf{x}}_n})} \right)^{ - 1}}F({{\bf{x}}_n})\)
This is repeated until the maximum of the absolute values of the components of the adjustment vectors is less than the convergence criterion.
The default initial guess values are a vector of zeros if a linear expansion is used, and a vector of ones if a log-linear expansion is used. There’s a good chance that you’ll need to provide a better set of values than these. That can be done either with the << fields on the DSGE instruction or with the INITIAL option.
Algorithm (Solving for State Space Representation)
This applies the algorithm described in Sims (2002), based upon the generalized Schur (QZ) decomposition. If the model is non-linear, this uses the linearized or log-linearized version. Derivatives are computed analytically. The CUTOFF option is used to control which roots will be considered stable (and solved backwards) and which will be unstable (and solved forwards). The default for the CUTOFF option is actually 1 + a small value to allow for possible roundoff error in computing roots that should be exactly one.
If you are using DSGE to solve out to a standard state-space form a model which has no expectational terms, it will still solve forwards any unstable roots. (See CASSKOOPMANS.RPF for an example). If you really want such a model to have explosive behavior, use CUTOFF=%NA. (Any CUTOFF value above the largest root will do, but %NA means any root is solved backwards).
Variables Defined
%CONVERGED |
1 or 0. Takes the value 1 if the solution for the steady state converged, 0 otherwise. |
%CVCRIT |
Final convergence criterion (if steady state solution is needed) |
Example
This creates a log linear expansion of a seven variable model with one (technology) shock. The shock is indicated by the one FRML that isn't an identity. Because n (hours) is measured fractionally, it's important to input guess values for solving for the steady-state as the default of 1's for all causes a divide by zero in the F1 formula. The output from DSGE are the A and F matrices describing the (log-linearized) state space model. That's run through the @DLMIRF procedure to compute the responses to the shock.
compute eta=1.0 ;* Log utility
compute alpha=.58 ;* Labor's share
compute nbar=.2 ;* Steady state level of hours
compute gamma=1.004 ;* Rate of technological progress
compute delta=.025 ;* Depreciation rate for capital (quarterly)
compute rq=.065/4 ;* Quarterly steady state interest rate
compute rho=1.00 ;* AR coefficient in technical change
compute lrstd=.01 ;* Long-run standard deviation of output
compute zbar=1.0 ;* Mean of technology process
compute theta=3.29 ;* Preference parameter for leisure
compute beta=gamma/(1+rq)
declare series y c invst n r z k
frml(identity) f1 = theta/(1-n)-c^(-eta)*alpha*y/n
frml(identity) f2 = 1-beta*gamma^(1-eta)*c/c{-1}*r{-1}
frml(identity) f3 = gamma*r-(1-alpha)*y/k{1}-1+delta
frml(identity) f4 = c+invst-y
frml(identity) f5 = gamma*k-invst-(1-delta)*k{1}
frml(identity) f6 = y-z*k{1}^(1-alpha)*n**alpha
frml f7 = log(z)-(1-rho)*log(zbar)-rho*log(z{1})
group swmodel f1 f2 f3 f4 f5 f6 f7
dsge(model=swmodel,expand=loglinear,a=a,f=f,$
initial=||1.0,0.5,0.5,nbar,1+rq,1.0,1.0||) y c invst n r k z
@dlmirf(a=a,f=f,labels=||"Technology"||,$
vlab=||"Output","Consumption","Investment","Hours"||,graph=byvar)
Other Examples
casskoopmans.rpf solves a deterministic linear dynamic model with an unstable root (which is solved forwards)
simplerbc.rpf solves a simple non-linear RBC (real business cycle) model
cagan.rpf estimates the parameters of small dynamic model using observable data.
Copyright © 2024 Thomas A. Doan