Main Algorithm for MJMCMC (Genetically Modified MJMCMC)
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
)A list containing the following elements:
All visited models in both mjmcmc and local optimization.
Average acceptance rate of the chain.
All models visited during mjmcmc iterations.
The highest log marginal probability of the visited models.
Marginal probabilities of the features.
Marginal probabilities of all of the visited models.
Indices of unique visited models.
The covariates represented as a list of features.
matrix containing the design matrix with data to use in the algorithm,
response variable
The number of MJMCMC iterations to run for (default 100)
A list of various probability vectors used by GMJMCMC, generated by gen.probs.mjmcmc.
A list of various parameter vectors used by MJMCMC, generated by gen.params.mjmcmc.
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\).
All parameters for the estimator function loglik.pi
Logical. Whether to include an intercept in the design matrix. Default is TRUE. No variable selection is performed on the intercept.
Integer specifying the number of leading columns in the design matrix to always include in the model. Default is 0.
Logical. If TRUE, uses subsampling or a stochastic approximation approach to the likelihood rather than the full likelihood. Default is FALSE.
Logical. Whether to print messages during execution. Default is TRUE for gmjmcmc and FALSE for the parallel version.
result <- mjmcmc(
y = matrix(rnorm(100), 100),
x = matrix(rnorm(600), 100),
loglik.pi = gaussian.loglik)
summary(result)
plot(result)
Run the code above in your browser using DataLab