Learn R Programming

phylocurve (version 2.1.1)

compare.models: Compare evolutionary hypotheses

Description

This function compares two evolutionary hypotheses via phylogenetic simulation under the null model (model1) and alternative model (model2) (Boettiger et al. 2012; Goolsby 2016). Typically the alternative model is nested within the null model, but is not a requirement of this testing procedure. By default, data are randomly simulated under model1 and model2, and model1 and model2 are fit to generate a distribution of likelihood ratios for data simulated under the null hypothesis and a distribution of likelihood ratios from data simulated under the alternative hypothesis. Comparison of the observed likelihood ratio to the null distribution provides an estimate of the P-value, whereas comparison of the alternative distribution to the critical value of the test statistic provides an estimate of statistical power.

Usage

compare.models(model1, model2, nsim = 1000,
plot = TRUE, estimate_power = TRUE, parallel = TRUE,
conf.int = TRUE)

Arguments

model1

The null model (an object of class rate.mult).

model2

The alternative model (an object of class rate.mult).

nsim

The number of iterations for phylogenetic simulation.

plot

Whether or not to plot the null and alternative distributions of likelihood ratios.

estimate_power

Whether to simulate the alternative distribution (default=TRUE).

parallel

Whether to use parallel processing to speed up computations (default=TRUE).

conf.int

Whether to estimate confidence inervals for tree transformation parameters in the alternative model (e.g., OU, EB, lambda, kappa, delta). If TRUE and the alternative evolutionary model is not 'BM', estimate_power is automatically set to TRUE.

Value

An object of class compare.models.

References

Boettiger C., Coop G., Ralph P. 2012. Is your phylogeny informative? Measuring the power of comparative methods. Evolution. 66:2240-2251.

Golsby E.W. 2015. Likelihood-Based Parameter Estimation for High-Dimensional Phylogenetic Comparative Models: Overcoming the Limitations of 'Distance-Based' Methods. In review.

See Also

evo.model

Examples

Run this code
# NOT RUN {
rand.data <- sim.traits()
X <- rowMeans(rand.data$trait_data)
null.model <- evo.model(tree = rand.data$tree,
  Y = rand.data$trait_data,method = "Pairwise ML")
alt.model <- evo.model(tree = rand.data$tree,
  Y = rand.data$trait_data,fixed.effects = X,method = "Pairwise ML")

compare.models(model1 = null.model,model2 = alt.model,
  nsim = 100,parallel = FALSE)
# }

Run the code above in your browser using DataLab