The key to doing this is to use the DLM instruction with a START option, where the START option calls a function which solves the model. In this case:
Code: Select all
function SolveModel
*
* Guard against solving the model with problem values
*
if eta<1.0.or.eta>1.05.or.rho>=1.0
return
dsge(model=dsgemodel,expand=loglinear,a=ax,f=fx,steady=steady,initial=basesteady) y c h in k a
compute afull=ax~\d,ffull=fx~\%identity(3),[symmetric] swfull=sigma^2~\%ltouterxx(lsigmav)
end SolveModel
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)) 1948:1 2002:2