Fit a Bayesian model
bm(x, ...) ## S3 method for class 'formula' bm( x, data = NULL, n_save = 1000L, n_burn = 500L, options = set_options(), mh = set_mh(), verbose = TRUE, W, X_SLX, type = c("lm", "slx", "sar", "sem", "sdm", "sdem", "sv"), ... ) ## S3 method for class 'bm' bm(x, n_save = 1000L, n_burn = 0L, verbose = TRUE, ...) blm(...) bslx(...) bsar(...) bsem(...) bsdm(...) bsdem(...) bsv(...)
x
: Formula or bm
object to sample with....
: Not used.data
: A data.frame
containing the variables in the model.n_save, n_burn
: Integer scalar. Number of draws for the burn-in period and to store for inference.options
: Settings for the prior setup. See set_options
.mh
: Settings to tune the Metropolis-Hastings step. See set_mh
.verbose
: Logical scalar. Whether to print status updates.W
: Numeric matrix (or function to construct one) with the spatial connectivities.X_SLX
: Numeric matrix with explanatory variables that should be lagged spatially.type
: Character scalar used to specify the desired model.Returns a list with draws from the specified Bayesian model and an object to obtain further samples.
N <- 100L beta <- 1:5 X <- matrix(rnorm(N * 5), N, 5) y <- X %*% beta + rnorm(N) bm(y ~ X, n_burn = 100, n_draw = 100) # Reproduce the linear model in Kuschnig (2022) blm(log(sales) ~ log(price / cpi) + log(ndi / cpi) + factor(name) + factor(year), data = cigarettes)
Useful links