Description Usage Arguments Value Author(s) References See Also Examples
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")
1 2 3 4 5  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)

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 metaanalysis. 
data 

start 
optional list having 4 possible elements:

prior 
optional list of prior specifications having 3 possible elements:

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

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 (solve(A)) that are proportional to the covariance structure of the random effects. The names of the matrices should correspond to columns in 
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)? 
Sol 
Posterior Distribution of MME solutions, including fixed effects 
VCV 
Posterior Distribution of (co)variance matrices 
CP 
Posterior Distribution of cutpoints 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 
Jarrod Hadfield j.hadfield@ed.ac.uk
General analyses: Hadfield, J.D. (2010) Journal of Statistical Software 33 2 122
Phylogenetic analyses: Hadfield, J.D. & Nakagawa, S. (2010) Journal of Evolutionary Biology 23 494508
Background Sorensen, D. & Gianola, D. (2002) Springer
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29  # 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.