11.01.2015 Views

Package 'MCMCglmm' - open source solution for an Internet free ...

Package 'MCMCglmm' - open source solution for an Internet free ...

Package 'MCMCglmm' - open source solution for an Internet free ...

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

<strong>Package</strong> ‘MCMCglmm’<br />

November 8, 2012<br />

Title MCMC Generalised Linear Mixed Models<br />

Version 2.17<br />

Depends tensorA, Matrix, coda, ape, corpcor<br />

Suggests rgl, combinat, mvtnorm, orthopolynom<br />

Date 2012-11-07<br />

Author Jarrod Hadfield<br />

Maintainer Jarrod Hadfield <br />

Description MCMC Generalised Linear Mixed Models<br />

License GPL (>= 2)<br />

Repository CRAN<br />

Date/Publication 2012-11-08 12:25:47<br />

R topics documented:<br />

MCMCglmm-package . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2<br />

at.level . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3<br />

at.set . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4<br />

BTdata . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5<br />

BTped . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5<br />

commutation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6<br />

Ddivergence . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7<br />

Dexpressions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8<br />

Dtensor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9<br />

evalDtensor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10<br />

gelm<strong>an</strong>.prior . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10<br />

inverseA . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12<br />

knorm . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13<br />

KPPM . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14<br />

krz<strong>an</strong>owski.test . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14<br />

1


2 MCMCglmm-package<br />

kunif . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15<br />

leg . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16<br />

list2bdiag . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17<br />

MCMCglmm . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18<br />

mult.memb . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21<br />

PlodiaPO . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22<br />

PlodiaR . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23<br />

PlodiaRB . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23<br />

plot.MCMCglmm . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24<br />

plotsubspace . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24<br />

posterior.cor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25<br />

posterior.evals . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26<br />

posterior.mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27<br />

predict.MCMCglmm . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28<br />

prunePed . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29<br />

Ptensor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30<br />

rbv . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30<br />

residuals.MCMCglmm . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31<br />

rIW . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32<br />

rtnorm . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33<br />

sir . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34<br />

sm2asreml . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35<br />

spl . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36<br />

SShorns . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37<br />

summary.MCMCglmm . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37<br />

Tri2M . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 38<br />

Index 40<br />

MCMCglmm-package<br />

Multivariate Generalised Linear Mixed Models<br />

Description<br />

MCMCglmm is a package <strong>for</strong> fitting Generalised Linear Mixed Models using Markov chain Monte<br />

Carlo techniques (Hadfield 2009). Most commonly used distributions like the normal <strong>an</strong>d the Poisson<br />

are supported together with some useful but less popular ones like the zero-inflated Poisson <strong>an</strong>d<br />

the multinomial. Missing values <strong>an</strong>d left, right <strong>an</strong>d interval censoring are accommodated <strong>for</strong> all<br />

traits. The package also supports multi-trait models where the multiple responses c<strong>an</strong> follow different<br />

types of distribution. The package allows various residual <strong>an</strong>d r<strong>an</strong>dom-effect vari<strong>an</strong>ce structures<br />

to be specified including heterogeneous vari<strong>an</strong>ces, unstructured covari<strong>an</strong>ce matrices <strong>an</strong>d r<strong>an</strong>dom regression<br />

(e.g. r<strong>an</strong>dom slope models). Three special types of vari<strong>an</strong>ce structure that c<strong>an</strong> be specified<br />

are those associated with pedigrees (<strong>an</strong>imal models), phylogenies (the comparative method) <strong>an</strong>d<br />

measurement error (meta-<strong>an</strong>alysis).<br />

The package makes heavy use of results in Sorensen & Gi<strong>an</strong>ola (2002) <strong>an</strong>d Davis (2006) which<br />

taken together result in what is hopefully a fast <strong>an</strong>d efficient routine. Most small to medium sized<br />

problems should take seconds to a few minutes, but large problems (> 20,000 records) are possible.


at.level 3<br />

My interest is in evolutionary biology so there are also several functions <strong>for</strong> applying Rice’s (2004)<br />

tensor <strong>an</strong>alysis to real data <strong>an</strong>d functions <strong>for</strong> visualising <strong>an</strong>d comparing matrices.<br />

Please read the tutorial vignette("Tutorial", "MCMCglmm") or the course notes vignette("CourseNotes", "MCMCglmm"<br />

Author(s)<br />

Jarrod Hadfield <br />

References<br />

Hadfield, J.D. (2009) MCMC methods <strong>for</strong> Multi-response Generalised Linear Mixed Models: The<br />

MCMCglmm R <strong>Package</strong>, submitted<br />

Sorensen, D. & Gi<strong>an</strong>ola, D. (2002) Likelihood, Bayesi<strong>an</strong> <strong>an</strong>d MCMC Methods in Qu<strong>an</strong>titative<br />

Genetics, Springer<br />

Davis, T.A. (2006) Direct Methods <strong>for</strong> Sparse Linear Systems, SIAM<br />

Rice (2004) Evolutionary Theory: Mathematical <strong>an</strong>d Conceptual Foundations, Sinauer<br />

at.level<br />

Incidence Matrix of Levels within a Factor<br />

Description<br />

Incidence matrix of levels within a factor<br />

Usage<br />

at.level(x, level)<br />

Arguments<br />

x<br />

level<br />

factor<br />

factor level<br />

Value<br />

incidence matrix <strong>for</strong> level in x<br />

Author(s)<br />

Jarrod Hadfield <br />

See Also<br />

at.set


4 at.set<br />

Examples<br />

fac


BTdata 5<br />

BTdata<br />

Blue Tit Data <strong>for</strong> a Qu<strong>an</strong>titative Genetic Experiment<br />

Description<br />

Usage<br />

Format<br />

Blue Tit (Cy<strong>an</strong>istes caeruleus) Data <strong>for</strong> a Qu<strong>an</strong>titative Genetic Experiment<br />

BTdata<br />

a data frame with 828 rows <strong>an</strong>d 7 columns, with variables tarsus length (tarsus) <strong>an</strong>d colour (back)<br />

measured on 828 individuals (<strong>an</strong>imal). The mother of each is also recorded (dam) together with the<br />

foster nest (fosternest) in which the chicks were reared. The date on which the first egg in each<br />

nest hatched (hatchdate) is recorded together with the sex (sex) of the individuals.<br />

References<br />

See Also<br />

Hadfield, J.D. et. al. 2007 Journal of Evolutionary Biology 20 549-557<br />

BTped<br />

BTped<br />

Blue Tit Pedigree<br />

Description<br />

Usage<br />

Blue Tit (Cy<strong>an</strong>istes caeruleus) Pedigree<br />

BTped<br />

Format<br />

a data frame with 1040 rows <strong>an</strong>d 3 columns, with individual identifier (<strong>an</strong>imal) mother identifier<br />

(dam) <strong>an</strong>d father identifier (sire). The first 212 rows are the parents of the 828 offspring from 106<br />

full-sibling families. Parents are assumed to be unrelated to each other <strong>an</strong>d have NA’s in the dam<br />

<strong>an</strong>d sire column.<br />

References<br />

Hadfield, J.D. et. al. 2007 Journal of Evolutionary Biology 20 549-557


6 commutation<br />

See Also<br />

BTped<br />

commutation<br />

Commutation Matrix<br />

Description<br />

Forms <strong>an</strong> mn x mn commutation matrix which tr<strong>an</strong>s<strong>for</strong>ms vec(A) into vec(A ′ ), where A is <strong>an</strong> m<br />

x n matrix<br />

Usage<br />

commutation(m, n)<br />

Arguments<br />

m<br />

n<br />

integer; number of rows of A<br />

integer; number of columns of A<br />

Value<br />

Commutation Matrix<br />

Author(s)<br />

Jarrod Hadfield <br />

References<br />

Magnus, J. R. & Neudecker, H. (1979) Annals of Statistics 7 (2) 381-394<br />

Examples<br />

commutation(2,2)


Ddivergence 7<br />

Ddivergence<br />

d-divergence<br />

Description<br />

Calculates Ovaskainen’s (2008) d-divergence between 2 zero-me<strong>an</strong> multivariate normal distributions.<br />

Usage<br />

Ddivergence(CA=NULL, CB=NULL, n=10000)<br />

Arguments<br />

CA<br />

CB<br />

n<br />

Matrix A<br />

Matrix B<br />

number of Monte Carlo samples <strong>for</strong> approximating the integral<br />

Value<br />

d-divergence<br />

Author(s)<br />

Jarrod Hadfield <br />

References<br />

Ovaskainen, O. et. al. (2008) Proc. Roy. Soc - B (275) 1635 593-750<br />

Examples<br />

CA


8 Dexpressions<br />

Dexpressions<br />

List of unevaluated expressions <strong>for</strong> (mixed) partial derivatives of fitness<br />

with respect to linear predictors.<br />

Description<br />

Unevaluated expressions <strong>for</strong> (mixed) partial derivatives of fitness with respect to linear predictors<br />

<strong>for</strong> survival <strong>an</strong>d fecundity.<br />

Usage<br />

Dexpressions<br />

Value<br />

PW.d0W<br />

PW.d1Wds<br />

PW.d1Wdf<br />

PW.d3Wd2sd1f<br />

PW.d3Wdsd2f <strong>an</strong>d so on ...<br />

PW.d2Wd2f<br />

PW.d2Wd2s<br />

PW.d3Wd3s<br />

PW.d3Wd3f<br />

Fitness (W) function <strong>for</strong> the Poisson-Weibull (PW) model.<br />

First Partial derivative of fitness (d1W) with respect to survival (d1s) linear predictor<br />

<strong>for</strong> the Poisson-Weibull (PW) model.<br />

First Partial derivative of fitness (d1W) with respect to fecundity (d1f) linear<br />

redictor <strong>for</strong> the Poisson-Weibull (PW) model.<br />

Mixed third partial derivative of fitness (d3W) with 2nd derivative of survival<br />

linear predictor (d2s) <strong>an</strong>d first derivative of fecundity linear predictor (d1f) from<br />

the Poisson-Weibull (PW) model.<br />

Author(s)<br />

Jarrod Hadfield <br />

See Also<br />

Dtensor


Dtensor 9<br />

Dtensor<br />

Tensor of (mixed) partial derivatives<br />

Description<br />

Forms tensor of (mixed) partial derivatives<br />

Usage<br />

Dtensor(expr, name=NULL, mu = NULL, m=1, evaluate = TRUE)<br />

Arguments<br />

expr<br />

name<br />

mu<br />

m<br />

evaluate<br />

’expression’<br />

character vector, giving the variable names with respect to which derivatives will<br />

be computed. If NULL all variables in the expression will be used<br />

optional: numeric vector, at which the derivatives are evaluated<br />

order of derivative<br />

logical; if TRUE the derivatives are evaluated at mu, if FALSE the derivatives are<br />

left unevaluated<br />

Value<br />

Dtensor<br />

(list) of unevaluated expression(s) if evaluate=FALSE or a tensor if evaluate=TRUE<br />

Author(s)<br />

Jarrod Hadfield j.hadfield@ed.ac.uk<br />

References<br />

Rice, S.H. (2004) Evolutionary Theory: Mathematical <strong>an</strong>d Conceptual Foundations. Sinauer (MA)<br />

USA.<br />

See Also<br />

evalDtensor, Dexpressions, D<br />

Examples<br />

f


10 gelm<strong>an</strong>.prior<br />

evalDtensor<br />

Evaluates a list of (mixed) partial derivatives<br />

Description<br />

Evaluates a list of (mixed) partial derivatives<br />

Usage<br />

evalDtensor(x, mu)<br />

Arguments<br />

x<br />

mu<br />

unevaluated (list) of expression(s)<br />

values at which the derivatives are evaluated: names need to match terms in x<br />

Value<br />

tensor<br />

Author(s)<br />

Jarrod Hadfield <br />

See Also<br />

Dtensor, D<br />

Examples<br />

f


gelm<strong>an</strong>.prior 11<br />

Arguments<br />

<strong>for</strong>mula<br />

data<br />

intercept<br />

scale<br />

<strong>for</strong>mula <strong>for</strong> the fixed effects.<br />

data.frame.<br />

prior vari<strong>an</strong>ce <strong>for</strong> intercept<br />

prior vari<strong>an</strong>ce <strong>for</strong> regression parameters<br />

Details<br />

Gelm<strong>an</strong> et al. (2008) suggest that the input variables of a categorical regression are st<strong>an</strong>dardised <strong>an</strong>d<br />

that the associated regression parameters are assumed independent in the prior. Gelm<strong>an</strong> et al. (2008)<br />

recommend a scaled t-distribution with a single degree of <strong>free</strong>dom (scaled Cauchy) <strong>an</strong>d a scale of<br />

10 <strong>for</strong> the intercept <strong>an</strong>d 2.5 <strong>for</strong> the regression parameters. If the degree of <strong>free</strong>dom is infinity (i.e. a<br />

normal distribution) then a prior covari<strong>an</strong>ce matrix B$V c<strong>an</strong> be defined <strong>for</strong> the regression parameters<br />

without input st<strong>an</strong>dardisation that corresponds to a diagonal prior D <strong>for</strong> the regression parameters<br />

had the inputs been st<strong>an</strong>dardised. The diagonal elements of D are set to scale except the first which<br />

is set to intercept. With logistic regression π 2 /3 + σ 2 gives a prior that is approximately flat on<br />

the probability scale, where σ 2 is the total vari<strong>an</strong>ce due to the r<strong>an</strong>dom effects. For probit regression<br />

it is 1 + σ 2 .<br />

Value<br />

prior covari<strong>an</strong>ce matrix<br />

Author(s)<br />

Jarrod Hadfield <br />

References<br />

Gelm<strong>an</strong>, A. et al. (2008) The Annals of Appled Statistics 2 4 1360-1383<br />

Examples<br />

dat


12 inverseA<br />

inverseA<br />

Inverse Relatedness Matrix <strong>an</strong>d Phylogenetic Covari<strong>an</strong>ce Matrix<br />

Description<br />

Henderson (1976) <strong>an</strong>d Meuwissen <strong>an</strong>d Luo (1992) algorithm <strong>for</strong> inverting relatedness matrices, <strong>an</strong>d<br />

Hadfield <strong>an</strong>d Nakagawa (2010) algorithm <strong>for</strong> inverting phylogenetic covari<strong>an</strong>ce matrices.<br />

Usage<br />

inverseA(pedigree=NULL, nodes="ALL", scale=TRUE)<br />

Arguments<br />

pedigree<br />

nodes<br />

scale<br />

ordered pedigree with 3 columns: id, dam <strong>an</strong>d sire, or a phylo object.<br />

"ALL" calculates the inverse <strong>for</strong> all individuals/nodes. For phylogenies "TIPS"<br />

calculates the inverse <strong>for</strong> the species tips only, <strong>an</strong>d <strong>for</strong> pedigrees a vector of id’s<br />

c<strong>an</strong> be passed which inverts the relatedness matrix <strong>for</strong> that subset.<br />

logical: should a phylogeny (needs to be ultrametric) be scaled to unit length<br />

(dist<strong>an</strong>ce from root to tip)<br />

Value<br />

Ainv<br />

inbreeding<br />

pedigree<br />

inverse as sparseMatrix<br />

inbreeding coefficients/br<strong>an</strong>ch lengths<br />

pedigree/pedigree representation of phylogeny<br />

Author(s)<br />

Jarrod Hadfield <br />

References<br />

Henderson, C.R. (1976) Biometrics 32 (1) 69:83<br />

Meuwissen, T.H.E, <strong>an</strong>d Luo, Z. (1992) Genetic Selection Evolution 24 (4) 305:313<br />

Hadfield, J.D. <strong>an</strong>d Nakagawa, S. (2010) Journal of Evolutionary Biology 23 494-508<br />

Examples<br />

data(bird.families)<br />

Ainv


knorm 13<br />

knorm<br />

(Mixed) Central Moments of a Multivariate Normal Distribution<br />

Description<br />

Forms a tensor of (mixed) central moments of a multivariate normal distribution<br />

Usage<br />

knorm(V, k)<br />

Arguments<br />

V<br />

k<br />

(co)vari<strong>an</strong>ce matrix<br />

kth central moment, must be even<br />

Value<br />

tensor<br />

Author(s)<br />

Jarrod Hadfield <br />

References<br />

Schott, J.R.(2003) Journal of Multivariate Analysis 87 (1) 177-190<br />

See Also<br />

dnorm<br />

Examples<br />

V


14 krz<strong>an</strong>owski.test<br />

KPPM<br />

Kronecker Product Permutation Matrix<br />

Description<br />

Forms <strong>an</strong> mk x mk Kronecker Product Permutation Matrix<br />

Usage<br />

KPPM(m, k)<br />

Arguments<br />

m<br />

k<br />

integer<br />

integer<br />

Value<br />

Matrix<br />

Author(s)<br />

Jarrod Hadfield <br />

References<br />

Schott, J.R.(2003) Journal of Multivariate Analysis 87 (1) 177-190<br />

Examples<br />

KPPM(2,3)<br />

krz<strong>an</strong>owski.test<br />

Krz<strong>an</strong>owski’s Comparison of Subspaces<br />

Description<br />

Calculates statistics of Krz<strong>an</strong>owski’s comparison of subspaces.<br />

Usage<br />

krz<strong>an</strong>owski.test(CA, CB, vecsA, vecsB, corr = FALSE, ...)


kunif 15<br />

Arguments<br />

CA<br />

Matrix A<br />

CB<br />

Matrix B<br />

vecsA<br />

Vector of integers indexing the eigenvectors determining the subspace of A<br />

vecsB<br />

Vector of integers indexing the eigenvectors determining the subspace of B<br />

corr<br />

logical; if TRUE the vari<strong>an</strong>ces of A <strong>an</strong>d B are st<strong>an</strong>dardised<br />

... further arguments to be passed<br />

Value<br />

sumofS<br />

<strong>an</strong>gles<br />

bisector<br />

metric <strong>for</strong> overall similarity with 0 indicting no similarity <strong>an</strong>d a value of length(vecsA)<br />

<strong>for</strong> identical subspaces<br />

<strong>an</strong>gle in degrees between each best matched pair of vectors<br />

vector that lies between each best matched pair of vectors<br />

Author(s)<br />

Jarrod Hadfield <br />

References<br />

Krz<strong>an</strong>owski, W.J. (2000) Principles of Multivariate Analysis. OUP<br />

Examples<br />

CA


16 leg<br />

Value<br />

kth central moment<br />

Author(s)<br />

Jarrod Hadfield <br />

See Also<br />

dunif<br />

Examples<br />

kunif(-1,1,4)<br />

y


list2bdiag 17<br />

See Also<br />

legendre.polynomials<br />

Examples<br />

x


18 MCMCglmm<br />

MCMCglmm<br />

Multivariate Generalised Linear Mixed Models<br />

Description<br />

Markov chain Monte Carlo Sampler <strong>for</strong> Multivariate Generalised Linear Mixed Models with special<br />

emphasis on correlated r<strong>an</strong>dom effects arising from pedigrees <strong>an</strong>d phylogenies (Hadfield 2010).<br />

Please read the course notes: vignette("CourseNotes","MCMCglmm") or the overview vignette("Overview", "MCMCglmm<br />

Usage<br />

MCMCglmm(fixed, r<strong>an</strong>dom=NULL, rcov=~units, family="gaussi<strong>an</strong>", mev=NULL,<br />

data,start=NULL, prior=NULL, tune=NULL, pedigree=NULL, nodes="ALL",<br />

scale=TRUE, nitt=13000, thin=10, burnin=3000, pr=FALSE,<br />

pl=FALSE, verbose=TRUE, DIC=TRUE, singular.ok=FALSE, saveX=TRUE,<br />

saveZ=TRUE, saveXL=TRUE, slice=FALSE, ginverse=NULL)<br />

Arguments<br />

fixed<br />

r<strong>an</strong>dom<br />

rcov<br />

family<br />

<strong>for</strong>mula <strong>for</strong> the fixed effects, multiple responses are passed as a matrix using<br />

cbind<br />

<strong>for</strong>mula <strong>for</strong> the r<strong>an</strong>dom effects. Multiple r<strong>an</strong>dom terms c<strong>an</strong> be passed using<br />

the + operator, <strong>an</strong>d in the most general case each r<strong>an</strong>dom term has the <strong>for</strong>m<br />

vari<strong>an</strong>ce.function(<strong>for</strong>mula):linking.function(r<strong>an</strong>dom.terms). Currently,<br />

the only vari<strong>an</strong>ce.functions available are idv, idh, us <strong>an</strong>d cor. idv fits a<br />

const<strong>an</strong>t vari<strong>an</strong>ce across all components in <strong>for</strong>mula, <strong>an</strong>d cor fixes the vari<strong>an</strong>ces<br />

to 1. Both idh <strong>an</strong>d us fit different vari<strong>an</strong>ces across each component in<br />

<strong>for</strong>mula, but us will also fit the covari<strong>an</strong>ces. The <strong>for</strong>mula c<strong>an</strong> contain both<br />

factors <strong>an</strong>d numeric terms (i.e. r<strong>an</strong>dom regression) although it should be noted<br />

that the intercept term is suppressed. The (co)vari<strong>an</strong>ces are the (co)vari<strong>an</strong>ces of<br />

the r<strong>an</strong>dom.terms effects. Currently, the only linking.functions available<br />

are mm <strong>an</strong>d str. mm fits a multimembership model where multiple r<strong>an</strong>dom terms<br />

are separated by the + operator. str allows covari<strong>an</strong>ces to exist between multiple<br />

r<strong>an</strong>dom terms that are also separated by the + operator. In both cases the<br />

levels of all multiple r<strong>an</strong>dom terms have to be the same. For simpler models the<br />

vari<strong>an</strong>ce.function(<strong>for</strong>mula) <strong>an</strong>d linking.function(r<strong>an</strong>dom.terms) c<strong>an</strong><br />

be omitted <strong>an</strong>d the model syntax has the simpler <strong>for</strong>m ~r<strong>an</strong>dom1+r<strong>an</strong>dom2+....<br />

There are two reserved variables: units which index rows of the response variable<br />

<strong>an</strong>d trait which index columns of the response variable<br />

<strong>for</strong>mula <strong>for</strong> residual covari<strong>an</strong>ce structure. This has to be set up so that each data<br />

point is associated with a unique residual. For example a multi-response model<br />

might have the R-structure defined by ~us(trait):units<br />

optional character vector of trait distributions. Currently, "gaussi<strong>an</strong>", "poisson",<br />

"categorical", "multinomial", "ordinal", "exponential", "geometric",<br />

"cengaussi<strong>an</strong>", "cenpoisson", "cenexponential", "zipoisson", "zapoisson",


MCMCglmm 19<br />

mev<br />

data<br />

start<br />

prior<br />

tune<br />

pedigree<br />

nodes<br />

scale<br />

nitt<br />

thin<br />

burnin<br />

pr<br />

pl<br />

verbose<br />

"ztpoisson", "hupoisson" <strong>an</strong>d "zibinomial" are supported, where the prefix<br />

"cen" me<strong>an</strong>s censored, the prefix "zi" me<strong>an</strong>s zero inflated, the prefix "za"<br />

me<strong>an</strong>s zero altered, the prefix "zt" me<strong>an</strong>s zero truncated <strong>an</strong>d the prefix "hu"<br />

me<strong>an</strong>s hurdle. If NULL, data needs to contain a family column.<br />

optional vector of measurement error vari<strong>an</strong>ces <strong>for</strong> each data point <strong>for</strong> r<strong>an</strong>dom<br />

effect meta-<strong>an</strong>alysis.<br />

data.frame<br />

optional list having 4 possible elements: R (R-structure) G (G-structure) <strong>an</strong>d<br />

liab (latent variables or liabilities) should contain the starting values where G<br />

itself is also a list with as m<strong>an</strong>y elements as r<strong>an</strong>dom effect components. The<br />

fourth element QUASI should be logical: if TRUE starting latent variables are<br />

obtained heuristically, if FALSE then they are sampled from a Z-distribution<br />

optional list of prior specifications having 3 possible elements: R (R-structure) G<br />

(G-structure) <strong>an</strong>d B (fixed effects). B is a list containing the expected value (mu)<br />

<strong>an</strong>d a (co)vari<strong>an</strong>ce matrix (V) representing the strength of belief: the defaults are<br />

B$mu=0 <strong>an</strong>d B$V=I*1e+10, where where I is <strong>an</strong> identity matrix of appropriate<br />

dimension. The priors <strong>for</strong> the vari<strong>an</strong>ce structures (R <strong>an</strong>d G) are lists with the<br />

expected (co)vari<strong>an</strong>ces (V) <strong>an</strong>d degree of belief parameter (nu) <strong>for</strong> the inverse-<br />

Wishart, <strong>an</strong>d also the me<strong>an</strong> vector (alpha.mu) <strong>an</strong>d covari<strong>an</strong>ce matrix (alpha.V)<br />

<strong>for</strong> the redund<strong>an</strong>t working parameters. The deafults are nu=0, V=1, alpha.mu=0,<br />

<strong>an</strong>d alpha.V=0. When alpha.V is non-zero, parameter exp<strong>an</strong>ded algorithms are<br />

used.<br />

optional (co)vari<strong>an</strong>ce matrix defining the proposal distribution <strong>for</strong> the latent variables.<br />

If NULL <strong>an</strong> adaptive algorithm is used which ceases to adapt once the<br />

burn-in phase has finished.<br />

ordered pedigree with 3 columns id, dam <strong>an</strong>d sire or a phylo object. This argument<br />

is retained <strong>for</strong> back compatability - see ginverse argument <strong>for</strong> a more<br />

general <strong>for</strong>mulation.<br />

pedigree/phylogeny nodes to be estimated. The default, "ALL" estimates effects<br />

<strong>for</strong> all individuals in a pedigree or nodes in a phylogeny (including <strong>an</strong>cestral<br />

nodes). For phylogenies "TIPS" estimates effects <strong>for</strong> the tips only, <strong>an</strong>d <strong>for</strong> pedigrees<br />

a vector of ids c<strong>an</strong> be passed to nodes specifying the subset of individuals<br />

<strong>for</strong> which <strong>an</strong>imal effects are estimated. Note that all <strong>an</strong>alyses are equivalent if<br />

omitted nodes have missing data but by absorbing these nodes the chain max<br />

mix better. However, the algorithm may be less numerically stable <strong>an</strong>d may<br />

iterate slower, especially <strong>for</strong> large phylogenies.<br />

logical: should the phylogeny (needs to be ultrametric) be scaled to unit length<br />

(dist<strong>an</strong>ce from root to tip)<br />

number of MCMC iterations<br />

thinning interval<br />

burnin<br />

logical: should the posterior distribution of r<strong>an</strong>dom effects be saved<br />

logical: should the posterior distribution of latent variables be saved<br />

logical: if TRUE MH diagnostics are printed to screen


20 MCMCglmm<br />

DIC<br />

singular.ok<br />

saveX<br />

saveZ<br />

saveXL<br />

slice<br />

ginverse<br />

logical: if TRUE devi<strong>an</strong>ce <strong>an</strong>d devi<strong>an</strong>ce in<strong>for</strong>mation criterion are calculated<br />

logical: if FALSE linear dependencies in the fixed effects are removed. if TRUE<br />

they are left in <strong>an</strong> estimated, although all in<strong>for</strong>mation comes <strong>for</strong>m the prior<br />

logical: save fixed effect design matrix<br />

logical: save r<strong>an</strong>dom effect design matrix<br />

logical: save structural parameter design matrix<br />

logical: should slice sampling be used Only applicable <strong>for</strong> binary triats with<br />

indpendent residuals<br />

a list of sparse inverse matrices (A −1 ) that are proportional to the covari<strong>an</strong>ce<br />

structure of the r<strong>an</strong>dom effects. The names of the matrices should correspond<br />

to columns in data that are associated with the r<strong>an</strong>dom term. All levels of the<br />

r<strong>an</strong>dom term should appear as rownames <strong>for</strong> the matrices.<br />

Value<br />

Sol<br />

VCV<br />

CP<br />

Liab<br />

Fixed<br />

R<strong>an</strong>dom<br />

Residual<br />

Devi<strong>an</strong>ce<br />

DIC<br />

X<br />

Z<br />

XL<br />

error.term<br />

family<br />

Tune<br />

Posterior Distribution of MME <strong>solution</strong>s, including fixed effects<br />

Posterior Distribution of (co)vari<strong>an</strong>ce matrices<br />

Posterior Distribution of cut-points from <strong>an</strong> ordinal model<br />

Posterior Distribution of latent variables<br />

list: fixed <strong>for</strong>mula <strong>an</strong>d number of fixed effects<br />

list: r<strong>an</strong>dom fromula, dimensions of each covari<strong>an</strong>ce matrix, number of levels<br />

per covari<strong>an</strong>ce matrix, <strong>an</strong>d term in r<strong>an</strong>dom <strong>for</strong>mula to which each covari<strong>an</strong>ce<br />

belongs<br />

list: residual fromula, dimensions of each covari<strong>an</strong>ce matrix, number of levels<br />

per covari<strong>an</strong>ce matrix, <strong>an</strong>d term in residual <strong>for</strong>mula to which each covari<strong>an</strong>ce<br />

belongs<br />

devi<strong>an</strong>ce -2*log(p(y|...))<br />

devi<strong>an</strong>ce in<strong>for</strong>mation criterion<br />

sparse fixed effect design matrix<br />

sparse r<strong>an</strong>dom effect design matrix<br />

sparse structural parameter design matrix<br />

residual term <strong>for</strong> each datum<br />

distribution of each datum<br />

(co)vari<strong>an</strong>ce matrix of the proposal distribution <strong>for</strong> the latent variables<br />

Author(s)<br />

Jarrod Hadfield <br />

References<br />

General <strong>an</strong>alyses: Hadfield, J.D. (2010) Journal of Statistical Software 33 2 1-22<br />

Phylogenetic <strong>an</strong>alyses: Hadfield, J.D. & Nakagawa, S. (2010) Journal of Evolutionary Biology 23<br />

494-508<br />

Background Sorensen, D. & Gi<strong>an</strong>ola, D. (2002) Springer


mult.memb 21<br />

See Also<br />

mcmc<br />

Examples<br />

# Example 1: univariate Gaussi<strong>an</strong> model with st<strong>an</strong>dard r<strong>an</strong>dom effect<br />

data(PlodiaPO)<br />

model1


22 PlodiaPO<br />

Details<br />

Currently mult.memb c<strong>an</strong> only usefully be used inside <strong>an</strong> idv vari<strong>an</strong>ce function.<br />

usually contains serveral factors that have the same factor levels.<br />

The <strong>for</strong>mula<br />

Value<br />

design matrix<br />

Author(s)<br />

Jarrod Hadfield <br />

Examples<br />

fac1


PlodiaR 23<br />

PlodiaR<br />

Resist<strong>an</strong>ce of Indi<strong>an</strong> meal moth caterpillars to the gr<strong>an</strong>ulosis virus<br />

PiGV.<br />

Description<br />

Usage<br />

Format<br />

Source<br />

Resist<strong>an</strong>ce of Indi<strong>an</strong> meal moth (Plodia interpunctella) caterpillars to the gr<strong>an</strong>ulosis virus PiGV.<br />

PlodiaR<br />

a data frame with 50 rows <strong>an</strong>d 5 columns, with variables indicating full- sib family (FSfamly), date<br />

of egg laying (date_laid) <strong>an</strong>d assaying (date_Ass), <strong>an</strong>d the number of individuals from the family<br />

that were experimentally infected with the virus Infected <strong>an</strong>d the number of those that pupated<br />

Pupated. These full-sib family identifiers also relate to the full-sib family identifiers in PlodiaPO<br />

See Also<br />

Tidbury H & Boots M (2007) University of Sheffield<br />

PlodiaRB, PlodiaPO<br />

PlodiaRB<br />

Resist<strong>an</strong>ce (as a binary trait) of Indi<strong>an</strong> meal moth caterpillars to the<br />

gr<strong>an</strong>ulosis virus PiGV.<br />

Description<br />

Usage<br />

Format<br />

Resist<strong>an</strong>ce (as a binary trait) of Indi<strong>an</strong> meal moth (Plodia interpunctella) caterpillars to the gr<strong>an</strong>ulosis<br />

virus PiGV.<br />

PlodiaRB<br />

a data frame with 784 rows <strong>an</strong>d 4 columns, with variables indicating full- sib family (FSfamly),<br />

date of egg laying (date_laid) <strong>an</strong>d assaying (date_Ass), <strong>an</strong>d a binary variable indicating whether<br />

<strong>an</strong> individual was resist<strong>an</strong>t (Pupated) to <strong>an</strong> experimental infection of the virus. These data are<br />

identical to those in the data.frame PlodiaR except each family-level binomial variable has been<br />

exp<strong>an</strong>ded into a binary variable <strong>for</strong> each individual.


24 plotsubspace<br />

Source<br />

Tidbury H & Boots M (2007) University of Sheffield<br />

See Also<br />

PlodiaR, PlodiaPO<br />

plot.MCMCglmm<br />

Plots MCMC chains from MCMCglmm using plot.mcmc<br />

Description<br />

Usage<br />

plot method <strong>for</strong> class "MCMCglmm".<br />

## S3 method <strong>for</strong> class ’MCMCglmm’<br />

plot(x, r<strong>an</strong>dom=FALSE, ...)<br />

Arguments<br />

x<br />

r<strong>an</strong>dom<br />

<strong>an</strong> object of class "MCMCglmm"<br />

logical; should saved r<strong>an</strong>dom effects be plotted<br />

... Further arguments to be passed<br />

Author(s)<br />

See Also<br />

Jarrod Hadfield <br />

plot.mcmc, MCMCglmm<br />

plotsubspace<br />

Plots covari<strong>an</strong>ce matrices<br />

Description<br />

Usage<br />

Represents covari<strong>an</strong>ce matrices as 3-d ellipsoids using the rgl package. Covari<strong>an</strong>ce matrices of<br />

dimension greater th<strong>an</strong> 3 are plotted on the subspace defined by the first three eigenvectors.<br />

plotsubspace(CA, CB=NULL, corr = FALSE, shadeCA = TRUE,<br />

shadeCB = TRUE, axes.lab = FALSE, ...)


posterior.cor 25<br />

Arguments<br />

CA<br />

CB<br />

corr<br />

Details<br />

shadeCA<br />

shadeCB<br />

axes.lab<br />

Matrix<br />

Optional second matrix<br />

If TRUE the covari<strong>an</strong>ce matrices are tr<strong>an</strong>s<strong>for</strong>med into correlation matrices<br />

If TRUE the ellipsoid is solid, if FALSE the ellipsoid is wireframe<br />

If TRUE the ellipsoid is solid, if FALSE the ellipsoid is wireframe<br />

If TRUE the axes are labelled with the eigenvectors<br />

... further arguments to be passed<br />

The matrix CA is always red, <strong>an</strong>d the matrix CB if given is always blue. The subspace is defined by<br />

the first three eigenvectors of CA, <strong>an</strong>d the percentage of vari<strong>an</strong>ce <strong>for</strong> each matrix along these three<br />

dimensions is given in the plot title.<br />

Author(s)<br />

See Also<br />

Jarrod Hadfield with code taken from the rgl package<br />

rgl<br />

Examples<br />

if(require(rgl)!=FALSE){<br />

G1


26 posterior.evals<br />

Value<br />

posterior correlation matrices<br />

Author(s)<br />

See Also<br />

Jarrod Hadfield <br />

posterior.evals<br />

Examples<br />

v


posterior.mode 27<br />

posterior.mode<br />

Estimates the marginal parameter modes using kernel density estimation<br />

Description<br />

Estimates the marginal parameter modes using kernel density estimation<br />

Usage<br />

posterior.mode(x, adjust=0.1, ...)<br />

Arguments<br />

x<br />

adjust<br />

mcmc object<br />

numeric, passed to density to adjust the b<strong>an</strong>dwidth of the kernal density<br />

... other arguments to be passed<br />

Value<br />

modes of the kernel density estimates<br />

Author(s)<br />

Jarrod Hadfield <br />

See Also<br />

density<br />

Examples<br />

v


28 predict.MCMCglmm<br />

predict.MCMCglmm<br />

Predict method <strong>for</strong> GLMMs fitted with MCMCglmm<br />

Description<br />

Predicted values <strong>for</strong> GLMMs fitted with MCMCglmm<br />

Usage<br />

## S3 method <strong>for</strong> class ’MCMCglmm’<br />

predict(object, newdata=NULL, marginal=object$R<strong>an</strong>dom$<strong>for</strong>mula,<br />

type="response", interval="none", level=0.95, ...)<br />

Arguments<br />

object<br />

newdata<br />

marginal<br />

type<br />

interval<br />

level<br />

<strong>an</strong> object of class "MCMCglmm"<br />

An optional data frame in which to look <strong>for</strong> variables with which to predict<br />

<strong>for</strong>mula defining r<strong>an</strong>dom effects to be maginalised<br />

character; either "terms" (link scale) or "response" (data scale)<br />

character; either "none", "confidence" or "prediction"<br />

A numeric scalar in the interval (0,1) giving the target probability content of the<br />

intervals.<br />

... Further arguments to be passed<br />

Value<br />

Expectation <strong>an</strong>d credible interval<br />

Author(s)<br />

Jarrod Hadfield <br />

See Also<br />

MCMCglmm


prunePed 29<br />

prunePed<br />

Pedigree pruning<br />

Description<br />

Creates a subset of a pedigree by retaining the <strong>an</strong>cestors of a specified subset of individuals<br />

Usage<br />

prunePed(pedigree, keep, make.base=FALSE)<br />

Arguments<br />

pedigree pedigree with id in column 1 dam in column 2 <strong>an</strong>d sire in column 3<br />

keep<br />

make.base<br />

individuals in pedigree <strong>for</strong> which the <strong>an</strong>cestors should be retained<br />

logical: should <strong>an</strong>cestors that do not provide additional in<strong>for</strong>mation be discarded<br />

Value<br />

subsetted pedigree<br />

Note<br />

If the individuals in keep are the only phenotyped individuals <strong>for</strong> some <strong>an</strong>alysis then some nonphenotyped<br />

individuals c<strong>an</strong> often be discarded if they are not responsible <strong>for</strong> pedigree links between<br />

phenotyped individuals. In the simplest case (make.base=FALSE) all <strong>an</strong>cestors of phenotyped individuals<br />

will be retained, although further pruning may be possible using make.base=TRUE. In this<br />

case all pedigree links that do not connect phenotyped individuals are discarded resulting in some<br />

individuals becoming part of the base population. In terms of vari<strong>an</strong>ce component <strong>an</strong>d fixed effect<br />

estimation pruning the pedigree should have no impact on the target posterior distribution, although<br />

convergence <strong>an</strong>d mixing may be better because there is less missing data.<br />

Author(s)<br />

Jarrod Hadfield + Michael Morrissey


30 rbv<br />

Ptensor<br />

Tensor of Sample (Mixed) Central Moments<br />

Description<br />

Forms a tensor of sample (mixed) central moments<br />

Usage<br />

Ptensor(x, k)<br />

Arguments<br />

x<br />

k<br />

matrix; traits in columns samples in rows<br />

kth central moment<br />

Value<br />

tensor<br />

Author(s)<br />

Jarrod Hadfield <br />

Examples<br />

n


esiduals.MCMCglmm 31<br />

Arguments<br />

pedigree<br />

G<br />

nodes<br />

scale<br />

ggroups<br />

gme<strong>an</strong>s<br />

ordered pedigree with 3 columns id, dam <strong>an</strong>d sire or a phylo object.<br />

(co)vari<strong>an</strong>ce matrix<br />

effects <strong>for</strong> pedigree/phylogeny nodes to be returned. The default, nodes="ALL"<br />

returns effects <strong>for</strong> all individuals in a pedigree or nodes in a phylogeny (including<br />

<strong>an</strong>cestral nodes). For phylogenies nodes="TIPS" returns effects <strong>for</strong> the tips<br />

only, <strong>an</strong>d <strong>for</strong> pedigrees a vector of ids c<strong>an</strong> be passed to nodes specifying the<br />

subset of individuals <strong>for</strong> which <strong>an</strong>imal effects are returned.<br />

logical: should a phylogeny (needs to be ultrametric) be scaled to unit length<br />

(dist<strong>an</strong>ce from root to tip)<br />

optional; vector of genetic groups<br />

matrix of me<strong>an</strong> breeding value <strong>for</strong> genetic groups (rows) by traits (columns)<br />

Value<br />

matrix of breeding values/phylogenetic effects<br />

Author(s)<br />

Jarrod Hadfield <br />

Examples<br />

data(bird.families)<br />

bv


32 rIW<br />

Value<br />

vector of residuals<br />

Author(s)<br />

Jarrod Hadfield <br />

See Also<br />

residuals, MCMCglmm<br />

rIW<br />

R<strong>an</strong>dom Generation from the Conditional Inverse Wishart Distribution<br />

Description<br />

Usage<br />

Samples from the inverse Wishart distribution, with the possibility of conditioning on a diagonal<br />

submatrix<br />

rIW(V, nu, fix=NULL, n=1, CM=NULL)<br />

Arguments<br />

V<br />

nu<br />

fix<br />

n<br />

CM<br />

Expected (co)varaince matrix as nu tends to infinity<br />

degrees of <strong>free</strong>dom<br />

optional integer indexing the partition to be conditioned on<br />

integer: number of samples to be drawn<br />

matrix: optional matrix to condition on. If not given, <strong>an</strong>d fix!=NULL, V_22 is<br />

conditioned on<br />

Details<br />

If W −1 is a draw from the inverse Wishart, fix indexes the diagonal element of W −1 which<br />

partitions W −1 into 4 submatrices. fix indexes the upper left corner of the lower diagonal matrix<br />

<strong>an</strong>d it is this matrix that is conditioned on.<br />

For example partioning W −1 such that<br />

[ ]<br />

W −1 W<br />

−1<br />

=<br />

11 W −1 12<br />

W −1 21 W −1 22<br />

fix indexes the upper left corner of W −1 22. If CM!=NULL then W −1 22 is fixed at CM, otherwise<br />

W −1 22 is fixed at V 22 . For example, if dim(V)=4 <strong>an</strong>d fix=2 then W −1 11 is a 1X1 matrix <strong>an</strong>d<br />

W −1 22 is a 3X3 matrix.


tnorm 33<br />

Value<br />

Note<br />

if n = 1 a matrix equal in dimension to V, if n>1 a matrix of dimension n x length(V)<br />

In versions of MCMCglmm >1.10 the arguments to rIW have ch<strong>an</strong>ged so that they are more intuitive<br />

in the context of MCMCglmm. Following the notation of Wikipedia (http://en.wikipedia.<br />

org/wiki/Inverse-Wishart_distribution) the inverse scale matrix Ψ = (V*nu). In earlier<br />

versions of MCMCglmm (


34 sir<br />

Arguments<br />

n<br />

me<strong>an</strong><br />

sd<br />

lower<br />

upper<br />

integer: number of samples to be drawn<br />

vector of me<strong>an</strong>s<br />

vector of st<strong>an</strong>dard deviations<br />

left truncation point<br />

right truncation point<br />

Value<br />

vector<br />

Author(s)<br />

Jarrod Hadfield <br />

References<br />

Robert, C.P. (1995) Statistics & Computing 5 121-125<br />

See Also<br />

rtnorm<br />

Examples<br />

hist(rtnorm(100, lower=-1, upper=1))<br />

sir<br />

Design Matrix <strong>for</strong> Simult<strong>an</strong>eous <strong>an</strong>d Recursive Relationships between<br />

Responses<br />

Description<br />

Forms design matrix <strong>for</strong> simult<strong>an</strong>eous <strong>an</strong>d recursive relationships between responses<br />

Usage<br />

sir(<strong>for</strong>mula1=NULL, <strong>for</strong>mula2=NULL)<br />

Arguments<br />

<strong>for</strong>mula1<br />

<strong>for</strong>mula2<br />

<strong>for</strong>mula<br />

<strong>for</strong>mula<br />

Value<br />

design matrix


sm2asreml 35<br />

Author(s)<br />

Jarrod Hadfield <br />

Examples<br />

fac1


36 spl<br />

spl<br />

Orthogonal Spline Design Matrix<br />

Description<br />

Orthogonal Spline Design Matrix<br />

Usage<br />

spl(x,<br />

k=10, knots=NULL, type="LRTP")<br />

Arguments<br />

x<br />

k<br />

knots<br />

type<br />

a numeric covariate<br />

integer, defines knot points at the 1:k/(k+1) qu<strong>an</strong>tiles of x<br />

vector of knot points<br />

type of spline - currently only low-r<strong>an</strong>k thin-plate ("LRTP") are implemented<br />

Value<br />

Design matrix post-multiplied by the inverse square root of the penalty matrix<br />

Author(s)<br />

Jarrod Hadfield <br />

Examples<br />

## Not run:<br />

x


SShorns 37<br />

SShorns<br />

Horn type <strong>an</strong>d genders of Soay Sheep<br />

Description<br />

Horn type <strong>an</strong>d genders of Soay Sheep Ovis aires<br />

Usage<br />

BTdata<br />

Format<br />

a data frame with 666 rows <strong>an</strong>d 3 columns, with individual idenitifier (id), horn type (horn) <strong>an</strong>d<br />

gender (sex).<br />

References<br />

Clutton-Brock T., Pemberton, J. Eds. 2004 Soay Sheep: Dynamics \& Selection in <strong>an</strong> Isl<strong>an</strong>d Population<br />

summary.MCMCglmm<br />

Summarising GLMM Fits from MCMCglmm<br />

Description<br />

summary method <strong>for</strong> class "MCMCglmm". The returned object is suitable <strong>for</strong> printing with the print.summary.MCMCglmm<br />

method.<br />

Usage<br />

## S3 method <strong>for</strong> class ’MCMCglmm’<br />

summary(object, r<strong>an</strong>dom=FALSE, ...)<br />

Arguments<br />

object <strong>an</strong> object of class "MCMCglmm"<br />

r<strong>an</strong>dom logical: should the r<strong>an</strong>dom effects be summarised<br />

... Further arguments to be passed


38 Tri2M<br />

Value<br />

DIC<br />

Devi<strong>an</strong>ce In<strong>for</strong>mation Criterion<br />

fixed.<strong>for</strong>mula model <strong>for</strong>mula <strong>for</strong> the fixed terms<br />

r<strong>an</strong>dom.<strong>for</strong>mula model <strong>for</strong>mula <strong>for</strong> the r<strong>an</strong>dom terms<br />

residual.<strong>for</strong>mula<br />

model <strong>for</strong>mula <strong>for</strong> the residual terms<br />

<strong>solution</strong>s posterior me<strong>an</strong>, 95% HPD interval, MCMC p-values <strong>an</strong>d effective sample size<br />

of fixed (<strong>an</strong>d r<strong>an</strong>dom) effects<br />

Gcovari<strong>an</strong>ces posterior me<strong>an</strong>, 95% HPD interval <strong>an</strong>d effective sample size of r<strong>an</strong>dom effect<br />

(co)vari<strong>an</strong>ce components<br />

Rcovari<strong>an</strong>ces posterior me<strong>an</strong>, 95% HPD interval <strong>an</strong>d effective sample size of residual (co)vari<strong>an</strong>ce<br />

components<br />

cutpoints posterior me<strong>an</strong>, 95% HPD interval <strong>an</strong>d effective sample size of cut-points from<br />

<strong>an</strong> ordinal model<br />

csats<br />

chain length, burn-in <strong>an</strong>d thinning interval<br />

Gterms indexes r<strong>an</strong>dom effect (co)vari<strong>an</strong>ces by the component terms defined in the r<strong>an</strong>dom<br />

<strong>for</strong>mula<br />

Author(s)<br />

Jarrod Hadfield <br />

See Also<br />

MCMCglmm<br />

Tri2M<br />

Lower/Upper Tri<strong>an</strong>gle Elements of a Matrix<br />

Description<br />

Lower/Upper tri<strong>an</strong>gle elements of a matrix or <strong>for</strong>ms a matrix from a vector of lower/upper tri<strong>an</strong>gle<br />

elements<br />

Usage<br />

Tri2M(x, lower.tri = TRUE, reverse = TRUE)<br />

Arguments<br />

x<br />

lower.tri<br />

reverse<br />

Matrix or vector<br />

If x is a matrix then the lower tri<strong>an</strong>gle (TRUE) or upper tri<strong>an</strong>gle FALSE elements<br />

(including diagonal elements) are returned. If x is a vector a matrix is <strong>for</strong>med under<br />

the assumption that x are the lower tri<strong>an</strong>gle (TRUE) or upper tri<strong>an</strong>gle (FALSE)<br />

elements.<br />

logical: ifTRUE a symmetric matrix is <strong>for</strong>med, if FALSE the remaining tri<strong>an</strong>gle is<br />

left as zeros.


Tri2M 39<br />

Value<br />

Author(s)<br />

numeric or matrix<br />

Jarrod Hadfield <br />

Examples<br />

M


Index<br />

∗Topic array<br />

commutation, 6<br />

Dtensor, 9<br />

evalDtensor, 10<br />

inverseA, 12<br />

KPPM, 14<br />

Ptensor, 30<br />

∗Topic datasets<br />

BTdata, 5<br />

BTped, 5<br />

PlodiaPO, 22<br />

PlodiaR, 23<br />

PlodiaRB, 23<br />

SShorns, 37<br />

∗Topic distribution<br />

gelm<strong>an</strong>.prior, 10<br />

knorm, 13<br />

kunif, 15<br />

posterior.cor, 25<br />

posterior.evals, 26<br />

posterior.mode, 27<br />

rbv, 30<br />

rIW, 32<br />

rtnorm, 33<br />

∗Topic hplot<br />

plot.MCMCglmm, 24<br />

plotsubspace, 24<br />

∗Topic m<strong>an</strong>ip<br />

at.level, 3<br />

at.set, 4<br />

leg, 16<br />

list2bdiag, 17<br />

mult.memb, 21<br />

prunePed, 29<br />

sir, 34<br />

sm2asreml, 35<br />

spl, 36<br />

Tri2M, 38<br />

∗Topic math<br />

Dtensor, 9<br />

evalDtensor, 10<br />

∗Topic models<br />

MCMCglmm, 18<br />

predict.MCMCglmm, 28<br />

residuals.MCMCglmm, 31<br />

summary.MCMCglmm, 37<br />

∗Topic multivariate<br />

Ddivergence, 7<br />

krz<strong>an</strong>owski.test, 14<br />

∗Topic symbolmath<br />

Dexpressions, 8<br />

at.level, 3, 4<br />

at.set, 3, 4<br />

BTdata, 5<br />

BTped, 5, 5, 6<br />

commutation, 6<br />

D, 9, 10<br />

data.frame, 11<br />

Ddivergence, 7<br />

density, 27<br />

Dexpressions, 8, 9<br />

dnorm, 13<br />

Dtensor, 8, 9, 10<br />

dunif, 16<br />

evalDtensor, 9, 10<br />

<strong>for</strong>mula, 11, 18<br />

gelm<strong>an</strong>.prior, 10<br />

inverseA, 12<br />

knorm, 13<br />

KPPM, 14<br />

krz<strong>an</strong>owski.test, 14<br />

40


INDEX 41<br />

kunif, 15<br />

leg, 16<br />

legendre.polynomials, 16, 17<br />

list2bdiag, 17<br />

mcmc, 21<br />

MCMCglmm, 18, 24, 28, 32, 33, 38<br />

MCMCglmm-package, 2<br />

mult.memb, 21<br />

PlodiaPO, 22, 23, 24<br />

PlodiaR, 22, 23, 24<br />

PlodiaRB, 22, 23, 23<br />

plot.MCMCglmm, 24<br />

plotsubspace, 24<br />

posterior.cor, 25, 26<br />

posterior.evals, 26, 26<br />

posterior.mode, 27<br />

predict.MCMCglmm, 28<br />

print.MCMCglmm (summary.MCMCglmm), 37<br />

print.summary.MCMCglmm<br />

(summary.MCMCglmm), 37<br />

prunePed, 29<br />

Ptensor, 30<br />

rbv, 30<br />

residuals, 32<br />

residuals.MCMCglmm, 31<br />

rgl, 25<br />

rIW, 32<br />

riwish, 33<br />

rtnorm, 33, 34<br />

rwish, 33<br />

rwishart, 33<br />

sir, 34<br />

sm2asreml, 35<br />

spl, 36<br />

SShorns, 37<br />

summary.MCMCglmm, 37<br />

Tri2M, 38

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!