Learn R Programming

MCMCglmm (version 1.06)

MCMCglmm: 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
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
family
optional character vector of trait distributions. Currently, "gaussian", "poisson", "categorical", "multinomial", "exponential", "cengaussian", "cenpoisson"
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 elem
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
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 onl
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

  • SolPosterior Distribution of MME solutions, including fixed effects
  • VCVPosterior Distribution of (co)variance matrices
  • LiabPosterior Distribution of latent variables
  • Fixedformula: fixed terms
  • Randomformula: random terms
  • Residualformula: residual terms
  • Deviancedeviance -2*log(p(y|...))
  • DICdeviance information criterion

References

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

See Also

mcmc

Examples

Run this code
# 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)

Run the code above in your browser using DataLab