Learn R Programming

BVAR (version 0.2.2)

bv_metropolis: Metropolis-Hastings settings

Description

Function to provide settings for the Metropolis-Hastings step in bvar. Options include scaling the inverse Hessian that is used to draw parameter proposals and automatic scaling to achieve a certain acceptance rate.

Usage

bv_metropolis(
  scale_hess = 0.01,
  adjust_acc = FALSE,
  acc_lower = 0.25,
  acc_upper = 0.35,
  acc_change = 0.01
)

bv_mh( scale_hess = 0.01, adjust_acc = FALSE, acc_lower = 0.25, acc_upper = 0.35, acc_change = 0.01 )

# S3 method for bv_metropolis print(x, ...)

Arguments

scale_hess

Numeric scalar or vector. Scaling parameter, determining the range of hyperparameter draws. Should be calibrated so a reasonable rate of acceptance is reached. If provided as vector the length must equal the number of hyperparameters (one per variable for psi).

adjust_acc

Logical scalar. Whether or not to further scale the variability of parameter draws during the burn-in phase.

acc_lower, acc_upper

Numeric scalar. Lower (upper) bound of the target acceptance rate. Required if adjust_acc is set to TRUE.

acc_change

Numeric scalar. Percent change applied to the Hessian matrix. Required if adjust_acc is set to TRUE.

x

An object of class bv_metropolis.

...

Not used

Value

Returns a named list of class bv_metropolis with options for bvar.

Examples

Run this code
# NOT RUN {
# Only adjust the scale parameter
bv_mh(scale_hess = 10)

# Turn on automatic scaling of the acceptance rate to [20%, 40%]
bv_mh(adjust_acc = TRUE, acc_lower = 0.2, acc_upper = 0.4)

# Increase the rate of automatic scaling
bv_mh(adjust_acc = TRUE, acc_lower = 0.2, acc_upper = 0.4, acc_change = 0.1)
# }

Run the code above in your browser using DataLab