sampleGlm: Produce posterior samples from one GLM / Cox model

Description Usage Arguments Value

View source: R/sampleGlm.R


Based on the result list from glmBayesMfp, for the first model in the list MCMC samples are produced. In parallel to the sampling of coefficients and FP curve points, optionally the marginal likelihood of the model is estimated with MCMC samples. This provides a check of the integrated Laplace approximation used in the model sampling. If TBF methodology is used, then no MCMC is necessary, instead ordinary Monte Carlo samples from an approximate posterior distribution are obtained.


sampleGlm(object, mcmc = McmcOptions(), estimateMargLik = TRUE,
  gridList = list(), gridSize = 203L, newdata = NULL, fixedZ = NULL,
  marginalZApprox = NULL, verbose = TRUE, debug = FALSE,
  useOpenMP = TRUE, correctedCenter = FALSE)



the GlmBayesMfp object, from which only the first model will be processed (at least for now ...)


MCMC options object with class McmcOptions. If TBF is used, each sample is accepted, and the number of samples is given by sampleSize(mcmc).


shall the marginal likelihood be estimated in parallel? (default) Only has an effect if full Bayes and not TBF is used.


optional list of appropriately named grid vectors for FP evaluation. Default is length (gridSize - 2) grid per covariate additional to the observed values (two are at the endpoints)


see above (default: 203)


new covariate data.frame with exactly the names (and preferably ranges) as before (default: no new covariate data) Note that there is no option for offsets for new data at the moment. Just add the offsets to the predictions slot of samples in the return list yourself.


either NULL (default) or a (single) fixed z value to be used, in order to sample from the conditional posterior given this z. If object was constructed by the empirical Bayes machinery, this will default to the estimated z with maximum conditional marginal likelihood. If object was constructed with the option fixedg, then the fixed value will be used by default.


method for approximating the marginal density of the log covariance factor z, see getMarginalZ for the details (default: same preference list as in getMarginalZ) If TBF are used in conjunction with incomplete inverse gamma hyperprior on g = exp(z), then the posterior distribution of g is again of this form. Therefore this option does not have any effect in that case, because the samples are directly obtained from that posterior distribution.


should information on computation progress be given? (default)


print debugging information? (not default)


shall OpenMP be used to accelerate the computations? (default)


If TRUE predict new data based on the centering of the original data.


Returns a list with the following elements:


an object of S4 class GlmBayesMfpSamples


samples of all original coefficients in the model (nCoefs x nSamples)


proportion of accepted Metropolis-Hastings proposals


if estimateMargLik is TRUE, this list is included: it contains the elements numeratorTerms and denominatorTerms for the numerator and denominator samples of the Chib Jeliazkov marginal likelihood estimate, highDensityPointLogUnPosterior is the log unnormalized posterior density at the fixed parameter and the resulting estimate and standardError.

glmBfp documentation built on July 31, 2017, 3 p.m.