MCMCglmm {MCMCglmm} | R Documentation |
Markov chain Monte Carlo Sampler for Multivariate Generalised Linear Mixed
Models with special emphasis on correlated random effects arising from pedigrees
and phylogenies (Hadfield 2009). Please read the tutorial: vignette("Tutorial",
"MCMCglmm")
MCMCglmm(fixed, random=NULL, rcov=~units, family="gaussian", mev=NULL, data,start=NULL, prior=NULL, tune=NULL, pedigree=NULL, nodes="ALL", scale=TRUE, nitt=13000, thin=10, burnin=3000, pr=FALSE, pl=FALSE, verbose=TRUE, DIC=TRUE, singular.ok=FALSE, saveX=FALSE, saveZ=FALSE)
fixed |
formula for the fixed effects, multiple responses
are passed as a matrix using cbind |
random |
formula for the random effects. Multiple random terms
can be passed using the + operator, and in the most general case each random term has the form variance.function(formula):random.term .
Currently, the only variance.functions available are idh and us . Both fit different variances across each component in formula , but us will also fit the covariances. The formula can contain both factors and numeric terms (i.e. random regression) although it should be noted that the intercept term is suppressed. The (co)variances are the (co)variances of the random.term effects. For simple random effects the variance.function(formula) can be omitted and the model syntax has the simpler form ~random1+random2+... . There are three reserved variables: units which index rows of the response variable, trait which index columns of the response variable and animal which is associated with a pedigree or phylogeny. |
rcov |
formula for residual covariance structure. This has
to be set up so that each data point is associated with a unique residual. For
example a multi-response model might have the R-structure defined by
~us(trait):units |
family |
optional character vector of trait distributions. Currently,
"gaussian" , "poisson" , "categorical" ,
"multinomial" , "ordinal" , "ordinal" , "exponential" , "cengaussian" ,
"cenpoisson" , "cenexponential" , "zipoisson" are
supported, where the prefix "cen" means censored and the prefix
"zi" means zero inflated. If NULL data needs to contain a
family column. |
mev |
optional vector of measurement error variances for each data point for random effect meta-analysis. |
data |
data.frame |
start |
optional list having 4 possible elements:
R (R-structure) G (G-structure) and liab (latent variables
or liabilities) should contain the starting values where G itself is also a list with as many elements as random
effect components. The fourth element QUASI should be logical: if TRUE starting latent variables are obtained heuristically, if FALSE then they are sampled from a Z-distribution |
prior |
optional list of prior specifications having 3 possible elements:
R (R-structure) G (G-structure) and B (fixed effects). Each
element is a list containing the expected (co)variances (V ) and a degree
of belief parameter (nu ) for the variance structures (R and
G ). B is a list containing the expected value (mu ) and a
(co)variance matrix (V ) representing the strength of belief. Defaults to
n=0 and B$V<-I*1e+8 , where I is an identity matrix of appropriate
dimension. |
tune |
optional (co)variance matrix defining the proposal distribution for the latent variables. If NULL an adaptive algorithm is used which ceases to adapt once the burn-in phase has finished. |
pedigree |
ordered pedigree with 3 columns id, dam and sire or a
phylo object. |
nodes |
pedigree/phylogeny nodes to be estimated. The default,
"ALL" estimates effects for all individuals in a pedigree or nodes in a
phylogeny (including ancestral nodes). For phylogenies "TIPS" estimates
effects for the tips only, and for pedigrees a vector of ids can be passed to
nodes specifying the subset of individuals for which animal effects are
estimated. Note that all analyses are equivalent if omitted nodes have missing
data but by absorbing these nodes the chain max mix better. However, the
algorithm may be less numerically stable and may iterate slower, especially for
large phylogenies. |
scale |
logical: should the phylogeny (needs to be ultrametric) be scaled to unit length (distance from root to tip)? |
nitt |
number of MCMC iterations |
thin |
thinning interval |
burnin |
burnin |
pr |
logical: should the posterior distribution of random effects be saved? |
pl |
logical: should the posterior distribution of latent variables be saved? |
verbose |
logical: if TRUE MH diagnostics are printed to screen |
DIC |
logical: if TRUE deviance and deviance information criterion are calculated |
singular.ok |
logical: if FALSE linear dependencies in the fixed effects are removed. if TRUE they are left in an estimated, although all information comes form the prior |
saveX |
logical: save fixed effect design matrix |
saveZ |
logical: save random effect design matrix |
Sol |
Posterior Distribution of MME solutions, including fixed effects |
VCV |
Posterior Distribution of (co)variance matrices |
Liab |
Posterior Distribution of latent variables |
Fixed |
formula: fixed terms |
Random |
formula: random terms |
Residual |
formula: residual terms |
Deviance |
deviance -2*log(p(y|...)) |
DIC |
deviance information criterion |
X |
sparse fixed effect design matrix |
Z |
sparse random effect design matrix |
Jarrod Hadfield j.hadfield@ed.ac.uk
General analyses: Hadfield, J.D. (2009) submitted
Phylogenetic analyses: Hadfield, J.D. and Nakagawa, S. (2009) submitted
Background Sorensen, D. & Gianola, D. (2002) Springer
# Example 1: univariate Gaussian model with standard random effect data(PlodiaPO) model1<-MCMCglmm(PO~1, random=~FSfamily, data=PlodiaPO, verbose=FALSE) plot(model1$VCV) # Example 2: univariate Gaussian model with phylogenetically correlated # random effect data(bird.families) phylo.effect<-rbv(bird.families, 1, nodes="TIPS") phenotype<-phylo.effect+rnorm(dim(phylo.effect)[1], 0, 1) # simulate phylogenetic and residual effects with unit variance test.data<-data.frame(phenotype=phenotype, animal=row.names(phenotype)) prior<-list(R=list(V=1, nu=1), G=list(G1=list(V=1, nu=1))) model2<-MCMCglmm(phenotype~1, random=~animal, data=test.data, pedigree=bird.families, prior=prior, verbose=FALSE) plot(model2$VCV)