bootstrapping DSGE model; how are residuals in DLM computed?

Discussion of State Space and Dynamic Stochastic General Equilibrium Models
randal_verbrugge
Posts: 14
Joined: Mon Sep 23, 2013 10:43 am

bootstrapping DSGE model; how are residuals in DLM computed?

Unread post by randal_verbrugge »

Hi Tom (and everyone),

As I understand it, DLM does simulations of DSGE models by drawing Normal shocks according to the solved variance-covariance matrix. However, if one wishes to estimate the model via indirect inference, one must simulate the DSGE via bootstrapping.

DLM will provide the estimated residuals *after Kalman smoothing only*. For example, in the Ireland replication, if one uses the command

dlm(startup=SolveModel(),y=yf,$
a=afull,f=ffull,c=cfull,sw=swfull,presample=ergodic,$
pmethod=simplex,piters=5,method=bfgs,iters=100,$
reject=(eta<1.0.or.eta>1.05.or.rho>=1.0),type=smooth,what=what) 1948:1 2002:2 states

then DLM estimates residuals ("what") from which one can draw from.

However (apologies for my ignorance, since the answer is probably obvious), as far as I can tell, neither the manuals nor the state space/DSGE manual tell us how those residuals are calculated.

I ask because there are two versions of indirect inference (and at least two methods to calculate the residuals). The first, the "LIML" version, specifies a reduced-form model, such as a VAR, for how expectations are formed (and this seems to be what is done in the Angelini and Fanelli (2016, OxBullEconStat) "Expectations Correction" method, though the motivation for the latter is to soak up autocorrelation in the residuals--since these should not be autocorrelated). The second method uses the structural model to generate the forecast of the variable, and this method is evidently more time-consuming, as it involves iteration, and it can be a more challenging optimization problem.

I would guess that DLM does the latter ,but I was hoping you could clarify this for me. (Also, why is it that these residuals are only available after smoothing?)

I am trying to develop code to estimate the Ireland example via indirect inference, so I am developing code to do the bootstrapping. I believe that if I am going to use DLM, the LIML version is off the table?

thanks for any and all help!
TomDoan
Posts: 7814
Joined: Wed Nov 01, 2006 4:36 pm

Re: bootstrapping DSGE model; how are residuals in DLM compu

Unread post by TomDoan »

The smoothed W's (and V's) are computed using a reverse iteration given in Durbin and Koopman. The formulas are *not* simple. They are also not, by themselves, particularly useful because they don't have any good diagnostic properties. (Because they are smoothed, they are very strongly correlated---D&K offer a few possible diagnostic uses, none particularly convincing.) What they *are* good for is as a step in Gibbs sampling using the D&K method for doing conditional simulation where they can be treated as data for doing inference on the control parameters of the model. I take it that this is not something that lends itself to Gibbs sampling for inference?
randal_verbrugge
Posts: 14
Joined: Mon Sep 23, 2013 10:43 am

Re: bootstrapping DSGE model; how are residuals in DLM compu

Unread post by randal_verbrugge »

Bummer. Well, I guess I have to code that up by hand, then. (I don't think that the indirect inference approach meshes at all with Gibbs sampling, but am prepared to be corrected.)

There are some examples and matlab code (http://www.patrickminford.net/Indirect/) which I will attempt to follow. Evidently in the "LIML" version, the expected future values are constructed by direct estimation, and then the author uses the dynare function _dynamic to back out the residuals: "The idea is following: give all the variables in _dynamic their values, but the model residuals the values of zero. Then the lhs-rhs are the model residuals."

A complication I anticipate is that DSGE/DLM construct new state variables, but perhaps the implied "w" residuals are still "somewhat" easy to determine...

Best,
R
TomDoan
Posts: 7814
Joined: Wed Nov 01, 2006 4:36 pm

Re: bootstrapping DSGE model; how are residuals in DLM compu

Unread post by TomDoan »

Whether the procedure described actually works would depend upon the model. The problem with filtered state shocks is that they are either trivial or they are uninteresting. If you condition on information at time t, you get
statespace.gif
statespace.gif (2.17 KiB) Viewed 26789 times
The problem is that the X(t-1|t) isn't a particularly useful piece of information so knowing w(t|t) doesn't really help much in manipulating the data. Smoothing is a different matter----change the target information set to the full set at time T, then that becomes the relationship among three smoothed quantities. Now, if you have a model where the number of shocks = the number of observables (the Ireland model isn't---there are four shocks/measurement errors for three observables), then the states are pretty close to being observable (save perhaps some uncertainty for the initial conditions, which is usually transient). If you write a VAR in state space form, the x's are just y's and lags of y's, so they're 100% observable, and you can just calculate the residuals; whether they're filtered or smoothed doesn't matter since there is no uncertainty once you've seen data through y(t).
randal_verbrugge
Posts: 14
Joined: Mon Sep 23, 2013 10:43 am

Re: bootstrapping DSGE model; how are residuals in DLM compu

Unread post by randal_verbrugge »

This paper seems relevant:
https://editorialexpress.com/cgi-bin/co ... per_id=555
I have not read it carefully, inasmuch as this type of thing is very tough slogging for my current skill set.

I am not sure what to make of your reply, to be honest. Doesn't knowing wt|t allow one to bootstrap, which is what is wanted? And also, doesn't it allow us to test whether wt is not autocorrelated, etc.?

I can see that, given expected values (c{-1}) constructed from a reduced-form model ("LIML"), the Ireland model will require some constraint or normalization of shocks (and the reverse case would presumably require formal minimization, or perhaps averaging).
Post Reply