DSGE
DSGE
Dynamic Stochastic General Equilibrium (DSGE) model.
This class specifies a DSGE model structure. The model must be previously computed using Dynare. It provides access to the Dynare output structures.
Properties
M_
(struct): Model structure returned by Dynare.options_
(struct): Options structure from Dynare.oo_
(struct): Output structure with results from Dynare.
Notes
- The model must have already been solved in Dynare.
- This class serves as a wrapper to interface with Dynare output.
getShockNames
returns a vector of shock names.
getShockSize_
Obtain the standard deviation of a specified shock.
shockSize = getShockSize_(shockName, M_)
computes the standard deviation (size) of a specified shock in a DSGE model estimated using Dynare.
Arguments
shockName
(string): The name of the shock whose size and index are required.M_
(struct): Returned by Dynare.
Returns
shockSize
(double): The standard deviation of the specified shock.
transmission
Compute transmission effects in a DSGE model.
effects = transmission(obj, shock, condition, order, maxHorizon)
computes the transmission effects for a shock
under a condition
based on order
, up to maxHorizon
.
Arguments
obj
(DSGE): DSGE model object.shock
(char or int): Shock name or index.condition
(Q): Transmission condition object.order
(cell array or vector): Variable ordering.maxHorizon
(integer): Maximum forecast horizon.
Returns
effects
(3D array): Transmission effects over horizons:- First dimension: Endogenous variables.
- Second dimension: Selected shock.
- Third dimension: Horizon.
Notes
shock
andorder
can be provided by name or index.
See also DSGE.through
, DSGE.notThrough
checkDynare_
Ensure Dynare is properly loaded and available.
varmaIrfs_
Compute structural impulse response functions (IRFs) for a VARMA model.
irfs = varmaIrfs_(Phi0, As, Psis, horizon)
computes the structural impulse response functions (IRFs) of a VARMA model, given the structural shock impact matrix, autoregressive (AR) coefficients, and moving average (MA) coefficients.
Model Specification
The VARMA model is defined as: \[ y_t = \sum_{i=1}^{p} A_i y_{t-i} + \sum_{j=1}^{q} \Psi_j u_{t-j} + u_t, \] where: - \(u_t = \Phi_0 \varepsilon_t\), with \(\varepsilon_t\) being structural shocks.
Arguments
Phi0
(matrix): Impact matrix linking structural shocks to reduced-form errors.As
(cell array): AR coefficient matrices{A_1, A_2, ..., A_p}
.Psis
(cell array): MA coefficient matrices{Psi_1, Psi_2, ..., Psi_q}
.horizon
(integer): Number of periods for which IRFs are computed.horizon=0
means only contemporaneous impulses are computed which are the same asPhi0
.
Returns
irfs
(3D array): Structural IRFs of size(n, m, horizon+1)
, wheren
is the number of endogenous variables,m
is the number of shocks, assumed to satisfym=n
. The IRFs capture the dynamic response of each variable to a unit shock over the specified horizon.
defineOrder_
Determine the ordering of observed variables.
defineOrder_(vars, options_)
returns an ordering vector order
that maps the variables in vars
to their corresponding positions in the list of observed variables of a DSGE model estimated using Dynare. It defines the transmission matrix and can be used in makeB
, makeOmega
, makeSystemsForm
, makeConditionY
, notThrough
, through
, and transmission
.
Arguments
vars
(vector): A list of observed variable names.options_
(struct): Options structure returned by Dynare.
Returns
order
(vector): Indices ofvars
in the original observed variable list.
See also transmission
, through
, notThrough
, makeSystemsForm
.
getShockSize
Get size (standard deviation) of a structural shock.
shockSize = getShockSize(obj, shockname)
returns the standard deviation of the specified structural shock.
Arguments
obj
(DSGE): DSGE model object.shockname
(char): Name of the structural shock.
Returns
shockSize
(number): Standard deviation of the shock.
See also getVariableIdx
, getShockIdx
getVariableIdx
Get index of an observed variable in DSGE model.
idx = getVariableIdx(obj, varname)
returns the index of varname
in the list of observed variables of a DSGE model.
Arguments
obj
(DSGE): DSGE model object.varname
(char): Name of the observed variable.
Returns
idx
(integer): Index of the observed variable.
See also getShockIdx
, getShockSize
dynareToVarma_
Transform a DSGE model into VARMA representation.
[Phi0, As, Psis, p, q] = dynareToVarma_(M_, oo_, options_, maxKappa)
converts a linearized DSGE model estimated using Dynare into a VARMA form, following the method of Morris (2016).
Arguments
M_
(struct): Model structure returned by Dynare.oo_
(struct): Output structure returned by Dynare.options_
(struct): Options structure returned by Dynare.maxKappa
(integer, optional): Tuning parameter related to maximum AR order viamaxArOrder = maxKappa + 1
. Defaults to 20.
Returns
Phi0
(matrix): Impact matrix linking shocks to reduced-form errors.As
(cell array): AR coefficient matrices{A_1, ..., A_p}
.Psis
(cell array): MA coefficient matrices{Psi_1, ..., Psi_q}
.p
(integer): Determined autoregressive order.q
(integer): Determined moving average order.
Methodology
The function follows the approach outlined in Morris (2016) and returns a VARMA of the form: \[ y_t = \sum_{i=1}^{p} A_i y_{t-i} + \sum_{j=1}^{q} \Psi_j u_{t-j} + u_t, \] where: - \(u_t = \Phi_0 \varepsilon_t\), with \(\varepsilon_t\) being structural shocks.
Reference
- Morris, S. D. (2016). “VARMA representation of DSGE models.” Economics Letters, 138, 30–33. https://doi.org/10.1016/j.econlet.2015.11.027
See also getABCD_
, varmaIrfs_
.
getShockIdx
Get index of a structural shock in DSGE model.
idx = getShockIdx(obj, shockname)
returns the index of shockname
in the list of shocks of a DSGE model.
Arguments
obj
(DSGE): DSGE model object.shockname
(char): Name of the structural shock.
Returns
idx
(integer): Index of the structural shock.
See also getVariableIdx
, getShockSize
coeffs
Return VARMA coefficients from the DSGE model.
[Phi0, As, Psis] = coeffs(obj)
computes and returns the VARMA coefficients of the DSGE model.
Returns
Phi0
(matrix): Contemporaneous impact effects of structural shocks.As
(cell array): Reduced-form AR coefficient matrices.Psis
(cell array): Reduced-form MA coefficient matrices.
Notes
- Internally calls
dynareToVarma_
to extract VARMA form. - The method follows Morris (2016) for VARMA approximation.
See also DSGE.dynareToVarma_
getABCD_
Obtain the ABCD state-space representation of a DSGE model.
[A, B, C, D] = getABCD_(M_, oo_, options_)
computes the state-space representation $$
\[\begin{split}
x_t &= Ax_{t-1} + B\varepsilon_t \\
y_t &= Cx_{t-1} + D\varepsilon_t
\end{split}\]
of a DSGE model estimated using Dynare. Only the minimal state representation is returned.
Arguments
M_
(struct): Returned by Dynare.oo_
(struct): Returned by Dynare.options_
(struct): Returned by Dynare.
Returns
A
(matrix): State transition matrix. See above equation.B
(matrix): Control input matrix capturing exogenous shocks. See above equation.C
(matrix): Observation matrix mapping state variables to observed variables. See above equation.D
(matrix): Observation noise matrix. See above equation.
Notes
- Requires MATLAB’s Control System Toolbox.
IRF
Compute impulse response functions for DSGE model.
irfObj = IRF(obj, maxHorizon)
computes IRFs of the DSGE model up to horizon maxHorizon
.
Arguments
obj
(DSGE): DSGE model object.maxHorizon
(integer): Maximum forecast horizon.
Returns
irfObj
(IRFContainer): Container with computed IRFs.
Notes
- Uses VARMA representation for IRF computation.
See also coeffs
, dynareToVarma_
, varmaIrfs_