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 2010). Please read the course notes: vignette("CourseNotes",
"MCMCglmm")
or the overview vignette("Overview", "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=TRUE,
saveZ=TRUE, saveXL=TRUE, slice=FALSE, ginverse=NULL, trunc=FALSE,
theta_scale=NULL, saveWS=TRUE)
fixed |
|
random |
|
rcov |
|
family |
optional character vector of trait distributions. Currently,
|
mev |
optional vector of measurement error variances for each data point for random effect meta-analysis. |
data |
|
start |
optional list having 5 possible elements:
|
prior |
optional list of prior specifications having 4 possible elements:
|
tune |
optional list with elements |
pedigree |
ordered pedigree with 3 columns id, dam and sire or a
|
nodes |
pedigree/phylogeny nodes to be estimated. The default,
|
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 |
DIC |
logical: if |
singular.ok |
logical: if |
saveX |
logical: save fixed effect design matrix |
saveZ |
logical: save random effect design matrix |
saveXL |
logical: save structural parameter design matrix |
slice |
logical: should slice sampling be used? Only applicable for binary traits with independent residuals |
ginverse |
a list of sparse inverse matrices ( |
trunc |
logical: should latent variables in binary models be truncated to prevent under/overflow (+/-20 for categorical/multinomial models and +/-7 for threshold/probit models)? |
theta_scale |
optional list of 4 possible elements specifying a set of location effects (fixed or random) that are to be scaled by the parameter |
saveWS |
logical: save design matrix for scaled effects. |
Sol |
Posterior Distribution of MME solutions, including fixed effects |
VCV |
Posterior Distribution of (co)variance matrices |
CP |
Posterior Distribution of cut-points from an ordinal model |
Liab |
Posterior Distribution of latent variables |
Fixed |
list: fixed formula and number of fixed effects |
Random |
list: random formula, dimensions of each covariance matrix, number of levels per covariance matrix, and term in random formula to which each covariance belongs |
Residual |
list: residual formula, dimensions of each covariance matrix, number of levels per covariance matrix, and term in residual formula to which each covariance belongs |
Deviance |
deviance -2*log(p(y|...)) |
DIC |
deviance information criterion |
X |
sparse fixed effect design matrix |
Z |
sparse random effect design matrix |
XL |
sparse structural parameter design matrix |
error.term |
residual term for each datum |
family |
distribution of each datum |
Tune |
(co)variance matrix of the proposal distribution for the latent variables |
meta |
logical; was |
Wscale |
sparse design matrix for scaled terms. |
Jarrod Hadfield j.hadfield@ed.ac.uk
General analyses: Hadfield, J.D. (2010) Journal of Statistical Software 33 2 1-22
Phylogenetic analyses: Hadfield, J.D. & Nakagawa, S. (2010) Journal of Evolutionary Biology 23 494-508
Background Sorensen, D. & Gianola, D. (2002) Springer
mcmc
# Example 1: univariate Gaussian model with standard random effect
data(PlodiaPO)
model1<-MCMCglmm(PO~1, random=~FSfamily, data=PlodiaPO, verbose=FALSE,
nitt=1300, burnin=300, thin=1)
summary(model1)
# 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, taxon=row.names(phenotype))
Ainv<-inverseA(bird.families)$Ainv
# inverse matrix of shared phyloegnetic history
prior<-list(R=list(V=1, nu=0.002), G=list(G1=list(V=1, nu=0.002)))
model2<-MCMCglmm(phenotype~1, random=~taxon, ginverse=list(taxon=Ainv),
data=test.data, prior=prior, verbose=FALSE, nitt=1300, burnin=300, thin=1)
plot(model2$VCV)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.