bayes_dsge_var_mh: Joint Bayesian Estimation of DSGE-VAR(lambda)

View source: R/dsge-var-mh.R

bayes_dsge_var_mhR Documentation

Joint Bayesian Estimation of DSGE-VAR(lambda)

Description

Estimates the structural DSGE parameters, shock standard deviations and the DSGE-prior weight \lambda jointly by random-walk Metropolis-Hastings. The VAR coefficients are analytically marginalised out at every iteration via the Normal-inverse-Wishart conjugate posterior, so only (\theta_{\text{DSGE}}, \sigma, \lambda) are explicitly sampled.

Usage

bayes_dsge_var_mh(
  model,
  data,
  priors,
  lambda_prior = NULL,
  p = 4L,
  chains = 2L,
  iter = 5000L,
  warmup = NULL,
  thin = 1L,
  proposal_scale = 0.1,
  include_intercept = TRUE,
  seed = NULL
)

Arguments

model

A dsge_model object.

data

Matrix or data frame of observable variables. Column names must match a subset of model$variables$observed.

priors

Named list of dsge_prior objects for the free structural parameters. Shock standard deviations receive default inv_gamma(0.1, 2) priors unless overridden under names "sd_e.<shockname>".

lambda_prior

A dsge_prior object for the DSGE-VAR weight \lambda. Default: prior("uniform", lower = 0, upper = 10), matching the Del Negro–Schorfheide / Dynare default.

p

Integer. VAR lag order. Default 4.

chains

Integer. Number of MH chains. Default 2.

iter

Integer. Total iterations per chain (warmup + sampling). Default 5000.

warmup

Integer. Warmup iterations. Default floor(iter/2).

thin

Integer. Thinning interval. Default 1.

proposal_scale

Numeric. Initial RW proposal scale. Default 0.1.

include_intercept

Logical. Include a constant term in the VAR. Default TRUE.

seed

Optional integer seed.

Details

The likelihood kernel is the DSGE-VAR closed-form log marginal likelihood (Del Negro & Schorfheide 2004, eqs. 19–21):

\log p(Y\mid\theta,\lambda) = -\frac{T n_y}{2}\log\pi + \frac{n_y}{2}\log\big|\lambda T\,\Gamma_{XX}(\theta)\big| - \frac{n_y}{2}\log|\bar M_{XX}| + \frac{\lambda T}{2}\log\big|\lambda T\,\Gamma_{YY\mid X}(\theta)\big| - \frac{\bar T}{2}\log|\bar S| + \log\Gamma_{n_y}(\bar T/2) - \log\Gamma_{n_y}(\lambda T/2).

This is added to log priors on the structural parameters, shock standard deviations and \lambda to form the log-posterior.

The sampler is the same adaptive random-walk Metropolis-Hastings used by bayes_dsge; it operates in unconstrained parameter space with appropriate Jacobian corrections (log for positive parameters, logit for bounded parameters).

Value

An object of class "dsge_dsgevar_mh" containing:

posterior

Array (iter-warmup) x n_params x chains of posterior draws (in natural parameter space). Last column is lambda.

param_names

Names of all sampled parameters.

acceptance_rate

Per-chain MH acceptance rate.

lambda_posterior_mean

Posterior mean of \lambda.

lambda_posterior_q

2.5\ of \lambda.

model, data, p, include_intercept

Inputs needed by downstream methods such as forecast.dsge_dsgevar_mh.

free_parameters

Names of free DSGE structural parameters.

shock_names

Names of shocks whose SDs are estimated.

n_iter, n_warmup, chains

MH settings.

References

Del Negro, M. and Schorfheide, F. (2004). Priors from general equilibrium models for VARs. International Economic Review, 45(2), 643-673.

See Also

bayes_dsge_var for VAR estimation with a fixed DSGE solution; forecast.dsge_dsgevar_mh and conditional_forecast.dsge_dsgevar_mh for forecasts integrating over the joint posterior.


dsge documentation built on Sept. 25, 2026, 5:08 p.m.