Learn R Programming

mixAK (version 4.2)

GLMM_MCMC: MCMC estimation of a (multivariate) generalized linear mixed model with a normal mixture in the distribution of random effects

Description

This function runs MCMC for a generalized linear mixed model with possibly several response variables and possibly normal mixtures in the distributions of random effects.

Usage

GLMM_MCMC(y, dist = "gaussian", id, x, z, random.intercept,
     prior.alpha, init.alpha, init2.alpha,                      
     scale.b,     prior.b,    init.b,      init2.b,
     prior.eps,   init.eps,   init2.eps,
     nMCMC = c(burn = 10, keep = 10, thin = 1, info = 10),
     tuneMCMC = list(alpha = 1, b = 1),
     store = c(b = FALSE), PED = TRUE, keep.chains = TRUE,
     dens.zero = 1e-300, parallel = FALSE, cltype, silent = FALSE)

## S3 method for class 'GLMM_MCMC': print(x, \dots)

## S3 method for class 'GLMM_MCMClist': print(x, \dots)

Arguments

y
vector, matrix or data frame with responses. If y is vector then there is only one response in the model. If y is matrix or data frame then each column gives values of one response. Missing values are allowed.

If

dist
character (vector) which determines distribution (and a link function) for each response variable. Possible values are: gaussian for gaussian (normal) distribution (with identity link), binomial(logit) for
id
vector which determines longitudinally or otherwise dependent observations. If not given then it is assumed that there are no clusters and all observations of one response are independent.
x
matrix or a list of matrices with covariates (intercept not included) for fixed effects. If there is more than one response, this must always be a list. Note that intercept in included in all models. Use a character value empty as
z
matrix or a list of matrices with covariates (intercept not included) for random effects. If there is more than one response, this must always be a list. Note that random intercept is specified using the argument random.intercept.

random.intercept
logical (vector) which determines for which responses random intercept should be included.
prior.alpha
a list which specifies prior distribution for fixed effects (not the means of random effects). The prior distribution is normal and the user can specify the mean and variances. The list prior.alpha can have the components listed b
init.alpha
a numeric vector with initial values of fixed effects (not the means of random effects) for the first chain. A sensible value is determined using the maximum-likelihood fits (using lmer functions)
init2.alpha
a numeric vector with initial values of fixed effects for the second chain.
scale.b
a list specifying how to scale the random effects during the MCMC. A sensible value is determined using the maximum-likelihood fits (using lmer functions) and does not have to be given by the u
prior.b
a list which specifies prior distribution for (shifted and scaled) random effects. The prior is in principle a normal mixture (being a simple normal distribution if we restrict the number of mixture components to be equal to one). The
init.b
a list with initial values of the first chain for parameters related to the distribution of random effects and random effects themselves. Sensible initial values are determined by the function itself and do not have to be given by the user.
init2.b
a list with initial values of the second chain for parameters related to the distribution of random effects and random effects themselves.
prior.eps
a list specifying prior distributions for error terms for continuous responses. The list prior.eps can have the components listed below. For all components, a sensible value leading to weakly informative prior distribution can
init.eps
a list with initial values of the first chain for parameters related to the distribution of error terms of continuous responses. The list init.eps can have the components listed below. For all components, a sensible value can be d
init2.eps
a list with initial values of the second chain for parameters related to the distribution of error terms of continuous responses.
nMCMC
numeric vector of length 4 giving parameters of the MCMC simulation. Its components may be named (ordering is then unimportant) as: [object Object],[object Object],[object Object],[object Object] In total $(M_{burn} + M_{keep}) \cdot M_{thin}$
tuneMCMC
a list with tuning scale parameters for proposal distribution of fixed and random effects. It is used only when there are some discrete response profiles. The components of the list have the following meaning: [object Object],[object Objec
store
logical vector indicating whether the chains of parameters should be stored. Its components may be named (ordering is then unimportant) as: [object Object]
PED
a logical value which indicates whether the penalized expected deviance (see Plummer, 2008 for more details) is to be computed (which requires two parallel chains).
keep.chains
logical. If FALSE, only summary statistics are returned in the resulting object. This might be useful in the model searching step to save some memory.
dens.zero
a small value used instead of zero when computing deviance related quantities.
parallel
a logical value which indicates whether parallel computation (based on a package parallel) should be used when running two chains for the purpose of PED calculation.
cltype
optional argument applicable if parallel is TRUE. If cltype is given, it is passed as the type argument into the call to makeCluster.
silent
a logical value indicating whether the information on the MCMC progress is to be supressed.
...
additional arguments passed to the default print method.

Value

  • An object of class GLMM_MCMClist (if PED argument is TRUE) or GLMM_MCMC (if PED argument is FALSE).

Details

See accompanying papers (Komárek et al., 2010, Komárek and Komárková, 2013).

References

Komárek, A. and Komárková, L. (2013). Clustering for multivariate continuous and discrete longitudinal data. The Annals of Applied Statistics, 7(1), 177--200.

Komárek, A. and Komárková, L. (2014). Capabilities of R package mixAK for clustering based on multivariate continuous and discrete longitudinal data. Journal of Statistical Software, 59(12), 1--38. http://www.jstatsoft.org/v59/i12/. Komárek, A., Hansen, B. E., Kuiper, E. M. M., van Buuren, H. R., and Lesaffre, E. (2010). Discriminant analysis using a multivariate linear mixed model with a normal mixture in the random effects distribution. Statistics in Medicine, 29(30), 3267--3283.

Plummer, M. (2008). Penalized loss functions for Bayesian model comparison. Biostatistics, 9(3), 523--539.

See Also

NMixMCMC.

Examples

Run this code
## See also additional material available in 
## YOUR_R_DIR/library/mixAK/doc/
## or YOUR_R_DIR/site-library/mixAK/doc/
## - files http://www.karlin.mff.cuni.cz/~komarek/software/mixAK/PBCseq.pdf,
##         PBCseq.R
## ==============================================

Run the code above in your browser using DataLab