Prior to the MCMC simulation, the posterior mode of the variance parameters is found using the algorithm of "fastmode". The results from a call to "fastmode" are returned along with the MCMC results.
For a description of the model and the prior distribution, see the "Details" section below.
fastmcmc(y, subj, pred, xcol, zcol, prior, seed, vmax,
occ, start.mode, maxits=100, eps=0.0001, iter=1000,
start.mcmc, df=4)The model, which is typically applied to longitudinal or clustered responses, is
yi = Xi%*%beta + Zi%*%bi + ei , i=1,...,m,
where
yi = (ni x 1) response vector for subject or cluster i; Xi = (ni x p) matrix of covariates; Zi = (ni x q) matrix of covariates; beta = (p x 1) vector of coefficients common to the population (fixed effects); bi = (q x 1) vector of coefficients specific to subject or cluster i (random effects); and ei = (ni x 1) vector of residual errors.
The vector bi is assumed to be normally distributed with mean zero and unstructured covariance matrix psi,
bi $\sim$ N(0,psi) independently for i=1,...,m.
The residual vector ei is assumed to be
ei $\sim$ N(0,sigma2*Vi)
where Vi is a known (ni x ni) matrix. In most applications, Vi is the identity matrix.
The prior distribution applied to the within-unit residual variance is scaled inverted-chisquare,
sigma2 $\sim$ a / chisq(b),
where chisq(b) denotes a chisquare random variable with b degrees of freedom, and a and b are user-defined hyperparameters. Values for the hyperparmeters may be chosen by regarding a/b as a rough prior guess for sigma2, and as the imaginary degrees of freedom on which this guess is based.
The prior distribution applied to the between-unit covariance matrix is inverted Wishart,
psiinv $\sim$ W(c,D),
where psiinv is the inverse of the between-unit covariance matrix psi, and W(c,D) denotes a Wishart distribution with degrees of freedom c and scale matrix D. Values for the hyperparameters may be chosen by regarding Dinv/c (the inverse of D divided by c) as a rough prior guess for psi, and c as the imaginary degrees of freedom on which this guess is based.
An improper uniform prior density function is applied to the fixed effects beta.
ecmeml, ecmerml,
fastml, fastrml,
fastmode, mgibbs,
exampleFor a detailed example, see the file "example.R" distributed
with this library.Run the code above in your browser using DataLab