# Dynamic Stochastic General Equilibrium¶

## Lecture Notes and Assignments¶

The main notes for this section are found in DSGE2013.pdf.

There is also a supplementary file in DSGE2013extra.pdf.

The homework associated with this section can be found in Econ_Week2.pdf.

You will need the python version of Uhlig’s toolkit. It can be found in uhlig.py.

Below we will show the documentation for it.

### Documentation for Python Uhlig¶

Python module for using the method outlined by Uhlig (1997) to solve a log-linearized RBC model for policy functions.

Original adaptation of MATLAB code done by Spencer Lyon in May 2012

Additional work has been done by Chase Coleman

byumcl.uhlig.uhlig.solvePQRS(AA=None, BB=None, CC=None, DD=None, FF=None, GG=None, HH=None, JJ=None, KK=None, LL=None, MM=None, NN=None)

This function mimics the behavior of Harald Uhlig’s solve.m and calc_qrs.m files in Uhlig’s toolkit.

In order to use this function, the user must have log-linearized the model they are dealing with to be in the following form (assume that y corresponds to the model’s “jump variables”, z represents the exogenous state variables and x is for endogenous state variables. nx, ny, nz correspond to the number of variables in each category.) The inputs to this function are the matrices found in the following equations.

$Ax_t + Bx_t-1 + Cy_t + Dz_t = 0$$E\{Fx_{t+1} + Gx_t + Hx_{t-1} + Jy_{t+1} + Ky_t + Lz_{t+1} Mz_t \} = 0$

The purpose of this function is to find the recursive equilibrium law of motion defined by the following equations.

$X_t = PX_{t-1} + Qz_t$$Y_t = RY_{t-1} + Sz_t$

Following outline given in Uhhlig (1997), we solve for $$P$$ and $$Q$$ using the following set of equations:

$FP^2 + Gg + H =0$$FQN + (FP+G)Q + (LN + M)=0$

Once $$P$$ and $$Q$$ are known, one ca solve for $$R$$ and $$S$$ using the following equations:

$R = -C^{-1}(AP + B)$$S = - C^{-1}(AQ + D)$
Parameters : AA : array_like, dtype=float, shape=(ny, nx) The matrix represented above by $$A$$. It is the matrix of derivatives of the Y equations with repsect to $$X_t$$ BB : array_like, dtype=float, shape=(ny, nx) The matrix represented above by $$B$$. It is the matrix of derivatives of the Y equations with repsect to $$X_{t-1}$$. CC : array_like, dtype=float, shape=(ny, ny) The matrix represented above by $$C$$. It is the matrix of derivatives of the Y equations with repsect to $$Y_t$$ DD : array_like, dtype=float, shape=(ny, nz) The matrix represented above by $$C$$. It is the matrix of derivatives of the Y equations with repsect to $$Z_t$$ FF : array_like, dtype=float, shape=(nx, nx) The matrix represetned above by $$F$$. It the matrix of derivatives of the model’s characterizing equations with respect to $$X_{t+1}$$ GG : array_like, dtype=float, shape=(nx, nx) The matrix represetned above by $$G$$. It the matrix of derivatives of the model’s characterizing equations with respect to $$X_t$$ HH : array_like, dtype=float, shape=(nx, nx) The matrix represetned above by $$H$$. It the matrix of derivatives of the model’s characterizing equations with respect to $$X_{t-1}$$ JJ : array_like, dtype=float, shape=(nx, ny) The matrix represetned above by $$J$$. It the matrix of derivatives of the model’s characterizing equations with respect to $$Y_{t+1}$$ KK : array_like, dtype=float, shape=(nx, ny) The matrix represetned above by $$K$$. It the matrix of derivatives of the model’s characterizing equations with respect to $$Y_t$$ LL : array_like, dtype=float, shape=(nx, nz) The matrix represetned above by $$L$$. It the matrix of derivatives of the model’s characterizing equations with respect to $$Z_{t+1}$$ MM : array_like, dtype=float, shape=(nx, nz) The matrix represetned above by $$M$$. It the matrix of derivatives of the model’s characterizing equations with respect to $$Z_t$$ NN : array_like, dtype=float, shape=(nz, nz) The autocorrelation matrix for the exogenous state vector z. P : array_like, dtype=float, shape=(nx, nx) The matrix $$P$$ in the law of motion for endogenous state variables described above. Q : array_like, dtype=float, shape=(nx, nz) The matrix $$P$$ in the law of motion for endogenous state variables described above. R : array_like, dtype=float, shape=(ny, nx) The matrix $$P$$ in the law of motion for endogenous state variables described above. S : array_like, dtype=float, shape=(ny, nz) The matrix $$P$$ in the law of motion for endogenous state variables described above.

References

 [R1] Uhlig, H. (1999): “A toolkit for analyzing nonlinear dynamic stochastic models easily,” in Computational Methods for the Study of Dynamic Economies, ed. by R. Marimon, pp. 30-61. Oxford University Press.