2

I want to use MCMCglmm to account for phylogenetic autocorrelation on my GLMM. However I have more than one trait measurement for certain species.

Is there a way to account for intraspecific variation using MCMCglmm such as it can be done in geiger's fitContinuous including a vector of standard errors in SE?

gung - Reinstate Monica
  • 132,789
  • 81
  • 357
  • 650
AEM
  • 141
  • 3

1 Answers1

1

The MCMCglmm package is well suited to incorporating repeated measures of interspecific data. The following code demonstrates how to account for repeated measures by specifying a random effect for species in the MCMCglmm function. The pedigree argument did not work for me, so I use ginverse to specify the covariance structure of the random effect (i.e., the phylogenetic covariance structure).

# Load packages
library(phytools)
library(MCMCglmm)

# Generate data
phy <- pbtree(n=20)
dat <- fastBM(phy, nsim=12)
dat <- stack(data.frame(t(dat)))
colnames(dat) <- c("values", "species")

# Phylogenetic covariance structure of random effects
phy.inv <- inverseA(phy)$Ainv

# Fit model
fit <- MCMCglmm(values ~ 1, random=~species, data=dat, ginverse=list(species=phy.inv))
Slow loris
  • 1,045
  • 6
  • 26