Looping over hyperparameters in Bayesian VAR

Hello,

I would like to estimate a Bayesian VAR in Dynare several times, looping over possible combination of hyper-parameters values. My current mod file looks like this:

var pih pif yhg yfg;
varobs pih pif yhg yfg;

bvar_density(datafile = dataset, first_obs = 6,
bvar_prior_mu = 2, bvar_prior_lambda = 1, bvar_prior_tau = 1,
bvar_prior_decay = 4, bvar_prior_omega = 1) 4;

Is there a simple way of defining the values for mu, lambda, tau, d and omega outside the mod file and then pass them in?
Also, where is the value of the marginal data density stored?
Thank you very much!

Giacomo

Could you please provide me with the full codes.

Hi Johannes,

The code I posted is my full mod file. I basically want to find the values of the hyper parameters mu, lambda, tau, decay and omega that maximize the marginal data density (MDD). To do that I would need to know how to pass the parameter values from an .m file into the .mod file and know where the value of the MDD is stored so that I can write the maximization routine in my .m file outside of dynare.

Thanks,

Giacomo
BVAR.mod (251 Bytes)

The datafile is missing.
It seems you need to loop over

options_.bvar_prior_decay = 4; options_.bvar_prior_lambda = 1; options_.bvar_prior_mu = 2; options_.bvar_prior_omega = 1; options_.bvar_prior_tau = 1;
The problem seems to be that the MDD is not stored. We are working on it: github.com/DynareTeam/dynare/issues/1090