# \donttest{
set.seed(1)
n <- 32 # number of species
p <- 5 # number of traits
tree <- pbtree(n=n, scale=1) # phylogenetic tree
R <- crossprod(matrix(runif(p*p), ncol=p)) # a random covariance matrix
# simulate a BM dataset
Y <- mvSIM(tree, model="BM1", nsim=1, param=list(sigma=R, theta=rep(0,p)))
data=list(Y=Y)
fit <- mvgls(Y~1, data=data, tree, model="BM", method="LL")
# Perform the ancestral states reconstruction
anc <- ancestral(fit)
# retrieve the ancestral states
head(anc)
# }
Run the code above in your browser using DataLab