Learn R Programming

glmBfp (version 0.0-60)

sampleBma: Produce posterior samples from a Bayesian model average over GLMs / Cox models

Description

Based on the result list from glmBayesMfp, sample from the Bayesian model average (BMA) over the models contained in this list.

Usage

sampleBma(
  object,
  mcmc = McmcOptions(),
  postProbs = posteriors(object),
  nMargLikSamples = NULL,
  verbose = TRUE,
  ...
)

Arguments

object

valid GlmBayesMfp object containing the models over which to average

mcmc

MCMC options object with class '>McmcOptions, specifying the number of required BMA samples (via sampleSize(mcmc)), and the burn-in and thinning parameters applied to each model (see above). If TBF is used, each sample is accepted, and the number of samples is given by sampleSize(mcmc).

postProbs

vector of posterior probabilites (will be normalized within the function) for the weighting of the models in object (defaults to the normalized posterior probabilities)

nMargLikSamples

If this is non-NULL, it specified the number of samples used for the marginal likelihood estimate for each model (see above).

verbose

should information on computation progress be given? (default)

optional further arguments already available for sampling from a single model: gridList, gridSize, newdata, weights, marginalZApprox, debug, useOpenMP. See sampleGlm for the meanings.

Value

The result is a list with the following elements:

modelData

data frame containing the result from the as.data.frame function, and in addition BMA probabilities, BMA frequencies in the sample, acceptance ratios of the MCMC runs and optionally marginal likelihood estimates / standard errors.

samples

an object of S4 class '>GlmBayesMfpSamples containing the samples from the BMA.

Details

If TBF methodology is used (which is specified within the glmBayesMfp object), then Monte Carlo (MC) sampling is used. If the fully Bayesian, generalized hyper-g prior methodology is used, then the sampling is based on MCMC. Therefore, instead of only specifying the required number of samples and the model probabilities, one also needs to specify the burn-in length and the thinning parameter, which will be applied to every model from which at least one sample is included in the average. Alternatively, you can ask for MCMC marginal likelihood estimates for all models in the list. Then at least nMargLikSamples will be produced for each model, whether included in the BMA sample or not.