GLMM_MCMC {mixAK}R Documentation

MCMC estimation of generalized linear mixed model with mixtures in the distributions.

Description

THIS FUNCTION IS BEING DEVELOPED AND ORDINARY USERS ARE NOT RECOMMENDED TO USE IT.

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.beta, init.beta,                      
          scale.b,    prior.b,   init.b,
          prior.eps,  init.eps,
          nMCMC=c(burn=10, keep=10, thin=1, info=10),
          tuneMCMC=list(beta=1, b=1),
          store=c(b=FALSE), keep.chains=TRUE)

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

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 there are several responses specified then continuous responses must be put in the first columns and discrete responses in the subsequent columns.
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 binomial (0/1) distribution with a logit link. “poisson(log)” for Poisson distribution with a log link. Single value is recycled if necessary.
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 a component of the list x if there are no covariates for a particular response.
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.
REMARK: For a particular response, matrices x and z may not have the same columns. That is, matrix x includes covariates which are not involved among random effects and matrix z includes covariates which are involved among random effects (and implicitely among fixed effects as well).
random.intercept logical (vector) which determines for which responses random intercept should be included.
prior.beta 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.b can have the components listed below.
mean
a vector with prior means, defaults to zeros.
var
a vector with prior variances, defaults to 10000 for all components.
init.beta a numeric vector with initial values of fixed effects (not the means of random effects). A sensible value is determined using the maximum-likelihood fits (using lmer functions) and does not have to be given by the user.
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 user.
If the user wishes to influence the shift and scale constants, these are given as components of the list scale.b. The components are named:
shift
ADD DESCRIPTION
scale
ADD DESCRIPTION
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 list prior.b can have the components listed below. Their meaning is analogous to the components of the same name of the argument prior of function NMixMCMC (see therein for details).
priorK
a character string which specifies the type of the prior for K (the number of mixture components).
priormuQ
a character string which specifies the type of the prior for mixture means and mixture variances.
Kmax
maximal number of mixture components.
lambda
ADD DESCRIPTION
delta
ADD DESCRIPTION
xi
ADD DESCRIPTION
ce
ADD DESCRIPTION
D
ADD DESCRIPTION
zeta
ADD DESCRIPTION
g
ADD DESCRIPTION
h
ADD DESCRIPTION
init.b a list with initial values 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.
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 be determined by the function.
zeta
ADD DESCRIPTION
g
ADD DESCRIPTION
h
ADD DESCRIPTION
init.eps a list with initial values 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 determined by the function.
sigma
a numeric vector with the initial values for residual standard deviations for each continuous response.
gammaInv
a numeric vector with the initial values for the inverted components of the hyperparameter gamma for each continuous response.
nMCMC numeric vector of length 4 giving parameters of the MCMC simulation. Its components may be named (ordering is then unimportant) as:
burn
length of the burn-in (after discarding the thinned values), can be equal to zero as well.
keep
length of the kept chains (after discarding the thinned values), must be positive.
thin
thinning interval, must be positive.
info
interval in which the progress information is printed on the screen.
In total (M[burn] + M[keep]) * M[thin] MCMC scans are performed.
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:
beta
scale parameters by which we multiply the proposal covariance matrix when updating the fixed effects pertaining to the discrete response profiles. There is one scale parameter for each DISCRETE profile. A single value is recycled if necessary.
b
a scale parameter by which we multiply the proposal covariance matrix when updating the random effects. It is used only when there are some discrete response profiles in the model.
store logical vector indicating whether the chains of parameters should be stored. Its components may be named (ordering is then unimportant) as:
b
if TRUE then the sampled values of random effects are stored. Defaults to FALSE.
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.
... additional arguments passed to the default print method.

Details

See accompanying paper (Komárek et al., 2010).

Value

An object of class GLMM_MCMC. It can have the following components (some of them may be missing according to the context of the model):

iter index of the last iteration performed.
nMCMC used value of the argument nMCMC.
dist a character vector of length R corresponding to the dist argument.
R a two component vector giving the number of continuous responses and the number of discrete responses.
p a numeric vector of length R giving the number of non-intercept beta parameters for each response.
q a numeric vector of length R giving the number of non-intercept random effects for each response.
fixed.intercept a logical vector of length R which indicates inclusion of fixed intercept for each response.
random.intercept a logical vector of length R which indicates inclusion of random intercept for each response.
lbeta length of the vector of fixed effects.
dimb dimension of the distribution of random effects.
prior.beta a list containing the used value of the argument prior.beta.
prior.b a list containing the used value of the argument prior.b.
prior.eps a list containing the used value of the argument prior.eps.
init.beta a numeric vector with the used value of the argument init.beta.
init.b a list containing the used value of the argument init.b.
init.eps a list containing the used value of the argument init.eps.
state.beta a numeric vector with the last sampled value of fixed effects beta. It can be used as argument init.beta to restart MCMC.
state.b a list with the last sampled values of parameters related to the distribution of random effects. It has components named b, K, w, mu, Sigma, Li, Q, gammaInv, r. It can be used as argument init.b to restart MCMC.
state.eps a list with the last sampled values of parameters related to the distribution of residuals of continuous responses. It has components named sigma, gammaInv. It can be used as argument init.eps to restart MCMC.
prop.accept.beta acceptance proportion from the Metropolis-Hastings algorithm for fixed effects (separately for each response type). Note that the acceptance proportion is equal to one for continuous responses since the Gibbs algorithm is used there.
prop.accept.b acceptance proportion from the Metropolis-Hastings algorithm for random effects (separately for each cluster). Note that the acceptance proportion is equal to one for models with continuous responses only since the Gibbs algorithm is used there.
scale.b a list containing the used value of the argument scale.b.
poster.mean.eta a data.frame with columns labeled fixed and random holding posterior means for fixed effect part of the linear predictor and the random effect part of the linear predictor. In each column, there are first all values for the first response, then all values for the second response etc.
poster.mean.profile a data.frame with columns labeled b1, ..., bq, LogL, Logpb with posterior means of random effects for each cluster and posterior means of log(L) (log-likelihood given random effects) and log(p(b)) for each cluster.
poster.mean.w_b a numeric vector with posterior means of mixture weights after re-labeling. It is computed only if K[b] is fixed and even then I am not convinced that these are useful posterior summary statistics. In any case, they should be used with care.
poster.mean.mu_b a matrix with posterior means of mixture means after re-labeling. It is computed only if K[b] is fixed and even then I am not convinced that these are useful posterior summary statistics. In any case, they should be used with care.
poster.mean.Q_b a list with posterior means of mixture inverse variances after re-labeling. It is computed only if K[b] is fixed and even then I am not convinced that these are useful posterior summary statistics. In any case, they should be used with care.
poster.mean.Sigma_b a list with posterior means of mixture variances after re-labeling. It is computed only if K[b] is fixed and even then I am not convinced that these are useful posterior summary statistics. In any case, they should be used with care.
poster.mean.Li_b a list with posterior means of Cholesky decompositions of mixture inverse variances after re-labeling. It is computed only if K[b] is fixed and even then I am not convinced that these are useful posterior summary statistics. In any case, they should be used with care.
poster.comp.prob1 a matrix which is present in the output object if the number of mixture components in the distribution of random effects is fixed and equal to K. In that case, poster.comp.prob1 is a matrix with K columns and I rows (I is the number of subjects defining the longitudinal profiles or correlated observations) with estimated posterior component probabilities – posterior means of the components of the underlying 0/1 allocation vector.
These can be used for possible clustering of the subjects based on the longitudinal profiles.
poster.comp.prob2 a matrix which is present in the output object if the number of mixture components in the distribution of random effects is fixed and equal to K. In that case, poster.comp.prob2 is a matrix with K columns and I rows (I is the number of subjects defining the longitudinal profiles or correlated observations) with estimated posterior component probabilities – posterior mean over model parameters including random effects.
These can be used for possible clustering of the subjects based on the longitudinal profiles.
summ.beta a matrix with posterior summary statistics for fixed effects.
summ.b.Mean a matrix with posterior summary statistics for means of random effects.
summ.b.SDCorr a matrix with posterior summary statistics for standard deviations of random effects and correlations of each pair of random effects.
summ.sigma_eps a matrix with posterior summary statistics for standard deviations of the error terms in the (mixed) models of continuous responses.
freqK_b frequency table for the MCMC sample of the number of mixture components in the distribution of the random effects.
propK_b posterior probabilities for the numbers of mixture components in the distribution of random effects.
K_b numeric vector with a chain for K[b] (number of mixture components in the distribution of random effects).
w_b numeric vector or matrix with a chain for w[b] (mixture weights for the distribution of random effects). It is a matrix with K[b] columns when K[b] is fixed. Otherwise, it is a vector with weights put sequentially after each other.
mu_b numeric vector or matrix with a chain for mu[b] (mixture means for the distribution of random effects). It is a matrix with dimb*K[b] columns when K[b] is fixed. Otherwise, it is a vector with means put sequentially after each other.
Q_b numeric vector or matrix with a chain for lower triangles of Q[b] (mixture inverse variances for the distribution of random effects). It is a matrix with (dimb*(dimb+1)2)*K[b] columns when K[b] is fixed. Otherwise, it is a vector with lower triangles of Q[b] matrices put sequentially after each other.
Sigma_b numeric vector or matrix with a chain for lower triangles of Sigma[b] (mixture variances for the distribution of random effects). It is a matrix with (dimb*(dimb+1)2)*K[b] columns when K[b] is fixed. Otherwise, it is a vector with lower triangles of Sigma[b] matrices put sequentially after each other.
Li_b numeric vector or matrix with a chain for lower triangles of Cholesky decompositions of Q[b] matrices. It is a matrix with (dimb*(dimb+1)2)*K[b] columns when K[b] is fixed. Otherwise, it is a vector with lower triangles put sequentially after each other.
gammaInv_b matrix with dimb columns with a chain for inverses of the hyperparameter gamma[b].
order_b numeric vector or matrix with order indeces of mixture components in the distribution of random effects. It is a matrix with K[b] columns when K[b] is fixed. Otherwise it is a vector with orders put sequentially after each other.
rank_b numeric vector or matrix with rank indeces of mixture components in the distribution of random effects. It is a matrix with K[b] columns when K[b] is fixed. Otherwise it is a vector with ranks put sequentially after each other.
mixture_b data.frame with columns labeled b.Mean.*, b.SD.*, b.Corr.*.* containing the chains for the means, standard deviations and correlations of the distribution of the random effects based on a normal mixture at each iteration.
b a matrix with the MCMC chains for random effects. It is included only if store[b] is TRUE.
beta numeric vector or matrix with the MCMC chain(s) for fixed effects.
sigma_eps numeric vector or matrix with the MCMC chain(s) for standard deviations of the error terms in the (mixed) models for continuous responses.
gammaInv_eps matrix with dimb columns with MCMC chain(s) for inverses of the hyperparameter gamma[b].

Author(s)

Arnošt Komárek arnost.komarek[AT]mff.cuni.cz

References

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. To appear.

See Also

NMixMCMC.

Examples

### WILL BE ADDED.

[Package mixAK version 0.6 Index]