Nothing
knitr::opts_chunk$set( collapse = TRUE, comment = "#>" )
This vignette demonstrates how to use the ShiVa R package to detect evolutionary shifts in both optimal trait values (mean) and evolutionary variance under an Ornstein-Uhlenbeck (OU) model. We illustrate the process using a floral trait dataset from Euphorbiaceae species. It is available at phylolm.
library(ShiVa) library(phylolm)
Load the required packages:
data('flowerTree') data('flowerSize')
We load the phylogenetic tree and trait data. The trait is floral diameter, log-transformed.
Y = flowerSize$log_transformed_size names(Y) = rownames(flowerSize) tree = flowerTree # normalize the tree tree$edge.length = flowerTree$edge.length/max(node.depth.edgelength(flowerTree))
set.seed(111) result = ShiVa(Y,tree, lambda.type = "lambda.min")
plot(result$best_model,title = "ShiVa")
print(summary(result$best_model))
Any scripts or data that you put into this service are public.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.