RATS 10.1
RATS 10.1

Procedures /

DSGECONTROL Procedure

Home Page

← Previous Next →

@DSGECONTROL is a procedure for doing optimal control on a linear rational expectations model. The algorithm is from Dennis(2007). To use this, you first have to use DSGE with the options FORM=SECOND, COMPONENTS=VECT[RECT] that you define, and CONTROLS=number of variables that are controls. This does a partial solution of the system, leaving it in a form that can be further processed by the procedure:

 

\({\Gamma _0}{\bf{y}_t} = {\Gamma _l}{\bf{y}_{t - 1}} + {\Gamma _f}{E_t}{\bf{y}_{t + 1}} + {\Gamma _\varepsilon }{\varepsilon _t} + {\Gamma _c}\)

 

The five components of the VECT[RECT] are the \(\Gamma\) matrices in the order shown in the formula. You have to arrange the variables on the DSGE instructions so the controls are at the end—DSGE will then make sure that any augmenting variables for the \(\bf{y}\) vector are inserted before the controls so the controls remain at the end of \(\bf{y}\) vector. You need to repeat the same value for the number of controls in the NX option on @DSGECONTROL.

 

The problem being solved is to minimize over choices of the controls \(\bf{x}\) the cost functional

 

\({E_{{t_0}}}\sum\limits_{t = 0}^\infty  {\left[ {{\bf{y}'_t}{\bf{R}}{{\bf{y}}_t} + {\bf{x}'_t}{\bf{Q}}{{\bf{x}}_t}} \right]} \)

 

where the \({\bf{x}}\)'s are the subset of the \({\bf{y}}\) variables that are controls. (Dennis creates a different representation for the state equation which separates the endogenous variables from the controls, while RATS combines them into a single state equation and keeps them separate by positioning within the state vector. The two are equivalent). The \({\bf{R}}\) matrix in this doesn't have to be the size of the full \({\bf{y}}\) vector—just put the variables of interest at the start of the list on the DSGE instruction and \({\bf{R}}\) will be padded out with zeros. 

 

@DSGEControl(options)  input output

Parameters

input

5-element VECT[RECT] with system matrices generated by DSGE.

output

5-element VECT[RECT] with system matrices after optimization. This can be input to DSGE to solve out into standard state-space form.

Options

BETA=discount rate in the cost functional

 

NX=number of controls[1]

These should be the final variables in the variables list on the original DSGE and should match the CONTROLS option used on DSGE.

 

Q=quadratic form matrix on the controls [zero matrix]

 

R=quadratic form matrix on the controlled variables[zero matrix]

Example

This is one of the examples from Dennis' paper. It's a simplified form of the Gali-Monacelli(2007) model. The objective function is

 

\(\sum\limits_{j = 0}^\infty  {{\beta ^j}\left\{ {{{\left( {\pi _{t + j}^c} \right)}^2} + \lambda y_{t + j}^2 + \nu {{\left( {{i_{t + j}} - {i_{t + j - 1}}} \right)}^2}} \right\}} \)

 

where the interest rate (i, though we use r) is the control.

 

dec series y pi pic q r dr rStar piStar g u eps

*

dec real eta alpha beta sigma phi omegaAlpha kappaAlpha

dec real lambda nu

compute eta=1.0,alpha=0.4,beta=.99,theta=0.75,sigma=1.0,phi=3.0

*

* Simplications from deep parameters

*

compute omegaAlpha=1.0+alpha*(2-alpha)*(sigma*eta-1)

compute kappaAlpha=(1-theta)*(1-beta*theta)/theta*(phi+sigma/omegaAlpha)

*

frml(identity) f1 = pic-(pi+alpha/(1-alpha)*(q-q{1}))

frml(identity) f2 = pi -(beta*pi{-1}+kappaAlpha*y+u)

frml(identity) f3 = y  -(y{-1}-omegaAlpha/sigma*(r-pi{-1})+g)

frml(identity) f4 = q  -(q{-1}-(1-alpha)*(r-pi{-1}-rStar+piStar{-1})+(1-alpha)*eps)

frml(identity) f5 = dr -(r-r{1})

*

* These are exogenous

*

frml(identity) f6 = piStar

frml(identity) f7 = rStar

*

* These are shocks

*

frml           s1 = g

frml           s2 = u

frml           s3 = eps

*

* This is the control equation

*

frml(identity) c1 = r

*

* Partially solve model to its components. The control variable needs to

* be listed last on DSGE.

*

group control f1 f2 f3 f4 f5 f6 f7 s1 s2 s3 c1

dsge(model=control,analyze=output,form=second,comps=comps,controls=1) $

   pic y dr pi q piStar rStar g u eps r

*

* Compute controlled form

*

compute lambda=0.0,nu=1.0

compute rr=%diag(||1.0,lambda,nu||)

@dsgecontrol(beta=.99,r=rr) comps revised

*

* Compute backwards looking solution from the revised components

*

dsge(analyze=input,components=revised,form=second,$

        a=adlm,f=fdlm,z=zdlm)

@dlmirf(page=byvariable,a=adlm,f=fdlm,$

  variables=||"R","PIC","Y","DR","PI"||,shocks=||"G","U","EPS"||)

*

* Alternative way of handling control, using first difference.

*

frml(identity) c1 = dr

*

group control f1 f2 f3 f4 f5 f6 f7 s1 s2 s3 c1

dsge(model=control,analyze=output,form=second,comps=comps,controls=1) $

  pic y r pi q piStar rStar g u eps dr

compute rr=%diag(||1.0,lambda||)

compute qq=||nu||

@dsgecontrol(beta=.99,r=rr,q=qq) comps revised

dsge(analyze=input,components=revised,form=second,$

        a=adlm,f=fdlm,z=zdlm)

@dlmirf(page=byvariable,a=adlm,f=fdlm,$

  variables=||"DR","PIC","Y","R","PI"||,shocks=||"G","U","EPS"||)


 


Copyright © 2025 Thomas A. Doan