View source: R/shift_configuration.R
fit_OU | R Documentation |
Fits an OU model based on a given configuration
fit_OU(tree, Y, shift.configuration, criterion = c("pBIC", "pBICess", "mBIC", "BIC", "AICc"), root.model = c("OUfixedRoot", "OUrandomRoot"), cr.regimes = NULL, alpha.starting.value = NA, alpha.upper = alpha_upper_bound(tree), alpha.lower = NA, l1ou.options = NA)
tree |
ultrametric tree of class phylo, with branch lengths, and edges in postorder. |
Y |
trait vector/matrix without missing entries. The row names of the data must be in the same order as the tip labels. |
shift.configuration |
shift positions, i.e. vector of indices of the edges where the shifts occur. |
criterion |
an information criterion (see Details). |
root.model |
model for the ancestral state at the root. |
alpha.starting.value |
optional starting value for the optimization of the phylogenetic adaptation rate. |
alpha.upper |
optional upper bound for the phylogenetic adaptation rate. The default value is log(2) over the minimum length of external branches, corresponding to a half life greater or equal to the minimum external branch length. |
alpha.lower |
optional lower bound for the phylogenetic adaptation rate. |
l1ou.options |
if provided, all the default values will be ignored. |
AICc gives the usual small-sample size modification of AIC. BIC gives the usual Bayesian information criterion, here penalizing each shift as 2 parameters. mBIC is the modified BIC proposed by Ho and Ané (2014). pBIC is the phylogenetic BIC for shifts proposed by Khabbazian et al. pBICess is a version of pBIC where the determinant term is replaced by a sum of the log of effective sample sizes (ESS), similar to the ESS proposed by Ané (2008).
an object of class l1ou similar to estimate_shift_configuration
.
Cécile Ané, 2008. "Analysis of comparative data with hierarchical autocorrelation". Annals of Applied Statistics 2(3):1078-1102.
Ho, L. S. T. and Ané, C. 2014. "Intrinsic inference difficulties for trait evolution with Ornstein-Uhlenbeck models". Methods in Ecology and Evolution. 5(11):1133-1146.
Mohammad Khabbazian, Ricardo Kriebel, Karl Rohe, and Cécile Ané (2016). "Fast and accurate detection of evolutionary shifts in Ornstein-Uhlenbeck models". Methods in Ecology and Evolution. doi:10.1111/2041-210X.12534
estimate_shift_configuration
adjust_data
data(lizard.tree, lizard.traits) lizard <- adjust_data(lizard.tree, lizard.traits[,1]) eModel <- estimate_shift_configuration(lizard$tree, lizard$Y) ### building l1ou object out of the second best score eModel2 = fit_OU(eModel$tree, eModel$Y, eModel$profile$configurations[[2]], l1ou.options=eModel$l1ou.options) plot(eModel2) ### hypothesis testing data("lizard.traits", "lizard.tree") Y <- lizard.traits[,1:1] tr <- lizard.tree tr <- multi2di(tr) tr <- reorder(tr, "postorder") ### visualizing the tree with the edge indeces plot(tr) edgelabels() ## place the shift position based on the hypothesis shift.config <- c(116, 77) hModel <- fit_OU(tr, Y, shift.config, criterion="AICc") plot(hModel) print(hModel)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.