Examples of using steady state block to solve models "outside" Dynare

Hello Dynare community!

I was curious if anyone could share a go-to example for using a steady-state file to solve models “outside” Dynare, butand estimating them “within” Dynare. Examples of applications I’m imagining: a term structure model a la Piazzesi and Ang 2003, or DSGE models with dispersed information (e.g., Melosi, ReStud 2017). Both of these examples involve models that are straightforward-ish to numerically solve using fixed points or recursively defining expressions and then get into a state-space format, but it’s not obvious to me how to take that state space model and put define it in a way that Dynare can parse for estimation.


What do you mean with that? You want to provide Dynare with the state space solution and then estimate the model? And the coefficients for the state space solution should be computed within a steady state file?

Right, exactly.

To elaborate: Suppose I have some Matlab code that takes a parameter guess and uses that to construct the matrices of a state space model. I’m wondering if it’s possible to convert that code into the appropriate format for a Dynare steady state file (which seems to be the only way to call outside code within a mod file), and then use Dynare to actually carry out the estimation. I assume that when Dynare is estimating a linearized DSGE model via MLE or Bayesian methods, it’s implicitly putting the model solution into a state space format; I’m wondering if there’s some trick to telling Dynare “here’s the state space model for this parameter guess, calculate the likelihood.”

I realize this is a little bit of a weird thing to do, but the two papers I mentioned are examples where explicitly writing the model line-by-line is challenging but it’s easy enough to write code that generates the state-space representation for any given parameter guess.

There is not really a trick, but you can use the preprocessor to automatize constructing the state space representation in the mod-file (like the VAR in DSGE_mod/Chari_et_al_2007.mod at master · JohannesPfeifer/DSGE_mod · GitHub) and then use the steady state file to assign the coefficients.

Thank you! Appreciate the suggestion.