mjmcmc: Main algorithm for MJMCMC (Genetically Modified MJMCMC)

mjmcmcR Documentation

Main algorithm for MJMCMC (Genetically Modified MJMCMC)

Description

Main algorithm for MJMCMC (Genetically Modified MJMCMC)

Usage

mjmcmc(
  x,
  y,
  N = 1000,
  probs = NULL,
  params = NULL,
  loglik.pi = NULL,
  mlpost_params = list(family = "gaussian", beta_prior = list(type = "g-prior")),
  intercept = TRUE,
  fixed = 0,
  sub = FALSE,
  verbose = TRUE
)

Arguments

x

matrix containing the design matrix with data to use in the algorithm,

y

response variable

N

The number of MJMCMC iterations to run for (default 100)

probs

A list of various probability vectors used by GMJMCMC, generated by gen.probs.mjmcmc.

params

A list of various parameter vectors used by MJMCMC, generated by gen.params.mjmcmc.

loglik.pi

A function specifying the marginal log-posterior of the model up to a constant, including the logarithm of the model prior: \log p(M|Y) = \text{const} + \log p(Y|M) + \log p(M). Typically assumes a Gaussian model with Zellner's g prior with g = max(n,p^2) by default.

mlpost_params

All parameters for the estimator function loglik.pi

intercept

Logical. Whether to include an intercept in the design matrix. Default is TRUE. No variable selection is performed on the intercept.

fixed

Integer specifying the number of leading columns in the design matrix to always include in the model. Default is 0.

sub

Logical. If TRUE, uses subsampling or a stochastic approximation approach to the likelihood rather than the full likelihood. Default is FALSE.

verbose

Logical. Whether to print messages during execution. Default is TRUE for gmjmcmc and FALSE for the parallel version.

Value

A list containing the following elements:

models

All visited models in both mjmcmc and local optimization.

accept

Average acceptance rate of the chain.

mc.models

All models visited during mjmcmc iterations.

best.crit

The highest log marginal probability of the visited models.

marg.probs

Marginal probabilities of the features.

model.probs

Marginal probabilities of all of the visited models.

model.probs.idx

Indices of unique visited models.

populations

The covariates represented as a list of features.

Examples

result <- mjmcmc(
y = matrix(rnorm(100), 100),
x = matrix(rnorm(600), 100),
loglik.pi = gaussian.loglik)
summary(result)
plot(result)


FBMS documentation built on Sept. 13, 2025, 1:09 a.m.