# \donttest{
test = FALSE
if(test){
if(require(mvMORPH)){
set.seed(1)
n <- 32 # number of species
p <- 31 # number of traits
tree <- pbtree(n=n) # phylogenetic tree
R <- Posdef(p) # a random symmetric matrix (covariance)
# simulate a dataset
Y <- mvSIM(tree, model="BM1", nsim=1, param=list(sigma=R))
# fit a multivariate Pagel lambda model with Penalized likelihood
fit <- fit_t_pl(Y, tree, model="lambda", method="RidgeAlt")
# Perform a phylogenetic PCA using the model fit (Pagel lambda model)
pca_results <- phyl.pca_pl(fit, plot=TRUE)
# retrieve the scores
head(pca_results$scores)
}
}
# }
Run the code above in your browser using DataLab