MCMCglmm {MCMCglmm}R Documentation

Multivariate Generalised Linear Mixed Models

Description

Markov chain Monte Carlo Sampler for Multivariate Generalised Linear Mixed Models with special emphasis on correlated random effects arising from pedigrees and phylogenies. Please read the tutorial: vignette("Tutorial", "MCMCglmm")

Usage

MCMCglmm(fixed, random=NULL, rcov=~units, family="gaussian", mev=NULL, 
    data=NULL,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)

Arguments

fixed formula for the fixed effects, multiple responses are passed as a matrix using cbind
random formula for the random effects. There are three reserved variables: units which indexes rows of the response variable, trait which indexes columns of the response variable and animal which is associated with a pedigree or phylogeny. ~rfactor fits a single variance across all levels of rfactor, idh(factor):rfactor fits different rfactor variances for each level of factor, and us(factor):rfactor fits different variances and covariances terms. Random regression using Legendre polynomials is possible using leg(covariate, n):rfactor where n is the order of the polynomial. -n fits an n- order polynomial but without the intercept.
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-trait model might have the R-structure defined by ~us(trait):units
family optional character vector of trait distributions. Currently, "gaussian", "poisson", "categorical", "multinomial", "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 shoudl 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 (n) 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 burnin 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

Value

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

Author(s)

Jarrod Hadfield j.hadfield@ed.ac.uk

References

For phylogenetic analyses: Hadfield & Nakagawa (2009) submitted For other analyses: Hadfield in prep Sorensen & Gianola (2004) Springer

See Also

mcmc

Examples


# 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") # simulate phylogenetic effects with unit variance
phenotype<-phylo.effect+rnorm(dim(phylo.effect)[1], 0, 1)  # add residual with unit variance

test.data<-data.frame(phenotype=phenotype, animal=as.factor(row.names(phenotype)))

model2<-MCMCglmm(phenotype~1, random=~animal, data=test.data, pedigree=bird.families, verbose=FALSE)
plot(model2$VCV)


[Package MCMCglmm version 1.06 Index]