Learn R Programming

mixAK (version 0.5)

GLMM_MCMC: 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),
          store=c(b=FALSE), keep.chains=TRUE)

## S3 method for class 'GLMM_MCMC': 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)
id
vector which determines clustered 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.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
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 hav
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 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
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 fu
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}$
store
logical vector indicating whether the chains of parameters should be stored. Its components may be named (ordering is then unimportant) as: [object Object]
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.

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):
  • iterindex of the last iteration performed.
  • nMCMCused value of the argument nMCMC.
  • Ra two component vector giving the number of continuous responses and the number of discrete responses.
  • dista character vector of length R corresponding to the dist argument.
  • pa numeric vector of length R giving the number of non-intercept beta parameters for each response.
  • qa numeric vector of length R giving the number of non-intercept random effects for each response.
  • fixed.intercepta logical vector of length R which indicates inclusion of fixed intercept for each response.
  • random.intercepta logical vector of length R which indicates inclusion of random intercept for each response.
  • lbetalength of the vector of fixed effects.
  • dimbdimension of the distribution of random effects.
  • prior.betaa list containing the used value of the argument prior.beta.
  • prior.ba list containing the used value of the argument prior.b.
  • prior.epsa list containing the used value of the argument prior.eps.
  • init.betaa numeric vector with the used value of the argument init.beta.
  • init.ba list containing the used value of the argument init.b.
  • init.epsa list containing the used value of the argument init.eps.
  • state.betaa numeric vector with the last sampled value of fixed effects $\beta$. It can be used as argument init.beta to restart MCMC.
  • state.ba 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.epsa 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.
  • scale.ba list containing the used value of the argument scale.b.
  • poster.mean.etaa 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.clustera 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\bigl{p(\boldsymbol{b})\bigr}$ for each cluster.
  • poster.mean.w_bADD DESCRIPTION
  • poster.mean.mu_bADD DESCRIPTION
  • poster.mean.Q_bADD DESCRIPTION
  • poster.mean.Sigma_bADD DESCRIPTION
  • poster.mean.Li_bADD DESCRIPTION
  • summ.betaADD DESCRIPTION
  • summ.b.MeanADD DESCRIPTION
  • summ.b.SDCorrADD DESCRIPTION
  • summ.sigma_epsADD DESCRIPTION
  • freqK_bADD DESCRIPTION
  • propK_bADD DESCRIPTION
  • K_bADD DESCRIPTION
  • w_bADD DESCRIPTION
  • mu_bADD DESCRIPTION
  • Li_bADD DESCRIPTION
  • Q_bADD DESCRIPTION
  • Sigma_bADD DESCRIPTION
  • gammaInv_bADD DESCRIPTION
  • order_bADD DESCRIPTION
  • rank_bADD DESCRIPTION
  • mixture_bADD DESCRIPTION
  • bADD DESCRIPTION
  • betaADD DESCRIPTION
  • sigma_epsADD DESCRIPTION
  • gammaInv_epsADD DESCRIPTION

Details

I HOPE TO WRITE A PAPER DESCRIBING ALL THE DETAILS.

References

$\mbox{Kom\'{a}rek, A.}$ (20XX). PAPER TO BE WRITTEN. JOURNAL, XX, XXX-XXX.

See Also

NMixMCMC.

Examples

Run this code
### WILL BE ADDED.

Run the code above in your browser using DataLab