DSGE VAR example bvar_forward.mod falls over at IRFs

I am having trouble running the bvar_forward.mod example from dynare.org/DynareWiki/DsgeVar (eg see dynare.org/DynareWiki/DsgeVar?action=AttachFile&do=get&target=bvar_forward.mod).

estimation(datafile=datarabanal_hybrid,first_obs=50,mh_nblocks = 1,nobs=90,mode_compute=4,mh_replic=20000)

runs correctly.


estimation(datafile=datarabanal_hybrid,first_obs=50,mh_nblocks = 1,nobs=90,mode_compute=4,mh_replic=20000,bayesian_irf)

does not.

The file successfully computes the posterior distributions using the Metropolis-Hastings algorithm, but then fails to compute the impulse responses and results in the following error message:

MH: Posterior (dsge) IRFs…
MH: Posterior (bvar-dsge) IRFs…
??? Index exceeds matrix dimensions.

Error in ==> PosteriorIRF at 366

Error in ==> dynare_estimation at 943

Error in ==> bvar_forward at 172

Error in ==> dynare at 102
evalin(‘base’,fname) ;

A different model crashes in the same place.

I am running dynare 4.0.2 from a network drive: h:\matlav\dynare\4.0.2.


Dear Christie,

The problem is specific to this version of Dynare (I did run successfully the mod file using the snapshot, I did not try with dynare version 4.0.3).

The problem is that in this example I did not declare a set of variables after the estimation command for which I want to see posterior IRFs. In this case dynare (4.0.2) prints:

You did not declare endogenous variables after the estimation command.
Posterior IRFs will be computed for the 10 endogenous variables
of your model, this can be very long....
Choose one of the following options:
 [1] Consider all the endogenous variables.
 [2] Consider all the observed endogenous variables.
 [3] Stop Dynare and change the mod file.
options [default is 1] =  

If you choose the first option (the default), Dynare will try to compute the IRFs for all the endogenous variables of the DSGE model… But this is meaningless for a VAR model, where the IRFs can only be computed for the observed variables. So you have to choose the second option in this case.

With more recent versions of Dynare, if a subset of variables is not listed after the estimation command and if you estimate a Dsge-Var model Dynare understands that you want to compute the posterior IRFs of all the observed variables. In this case Dynare won’t warn you about the absence of declared variables after the estimation command.


How to set the option in the mod file to let Dynare choose all the observed variables (option 2), such that Dynare won’t ask that question and ones does not have to write all the observed variables after the estimation command?

Currently, I think the only way is to copy manually everything you wrote behind the var_obs-command. Sorry.