Estimate the impact on model estimates of phylogenetic linear regression after removing clades from the analysis and evaluating uncertainty in trees topology.

tree_clade_phylm(
  formula,
  data,
  phy,
  clade.col,
  n.species = 5,
  n.sim = 100,
  n.tree = 2,
  model = "lambda",
  track = TRUE,
  ...
)

Arguments

formula

The model formula

data

Data frame containing species traits with row names matching tips in phy.

phy

A phylogeny (class 'multiPhylo', see ?ape).

clade.col

The column in the provided data frame which specifies the clades (a character vector with clade names).

n.species

Minimum number of species in a clade for the clade to be included in the leave-one-out deletion analysis. Default is 5.

n.sim

Number of simulations for the randomization test.

n.tree

Number of times to repeat the analysis with n different trees picked randomly in the multiPhylo file. If NULL, n.tree = 2

model

The phylogenetic model to use (see Details). Default is lambda.

track

Print a report tracking function progress (default = TRUE)

...

Further arguments to be passed to phylolm

Value

The function clade_phylm returns a list with the following components:

formula: The formula

full.model.estimates: Coefficients, aic and the optimised value of the phylogenetic parameter (e.g. lambda) for the full model without deleted species.

sensi.estimates: A data frame with all simulation estimates. Each row represents a deleted clade for a tree iteration. Columns report the calculated regression intercept (intercept), difference between simulation intercept and full model intercept (DIFintercept), the percentage of change in intercept compared to the full model (intercept.perc) and intercept p-value (pval.intercept). All these parameters are also reported for the regression slope (DIFestimate etc.). Additionally, model aic value (AIC) and the optimised value (optpar) of the phylogenetic parameter (e.g. kappa or lambda, depending on the phylogenetic model used) are reported.

null.dist: A data frame with estimates for the null distributions for all clades analysed.

data: Original full dataset.

errors: Clades and/or trees where deletion resulted in errors.

Details

This function sequentially removes one clade at a time, fits a phylogenetic linear regression model using phylolm and stores the results. The impact of of a specific clade on model estimates is calculated by the comparison between the full model (with all species) and the model without the species belonging to a clade. It repeats this operation using n trees, randomly picked in a multiPhylo file.

Additionally, to account for the influence of the number of species on each clade (clade sample size), this function also estimate a null distribution of slopes expected for the number of species in a given clade. This is done by fitting models without the same number of species in the given clade. The number of simulations to be performed is set by 'n.sim'. To test if the clade influence differs from the null expectation for a clade of that size, a randomization test can be performed using 'summary(x)'.

All phylogenetic models from phylolm can be used, i.e. BM, OUfixedRoot, OUrandomRoot, lambda, kappa, delta, EB and trend. See ?phylolm for details.

clade_phylm detects influential clades based on difference in intercept and/or slope when removing a given clade compared to the full model including all species. This is done for n trees in the multiphylo file.

Currently, this function can only implement simple linear models (i.e. \(y = a + bx\)). In the future we will implement more complex models.

Output can be visualised using sensi_plot.

References

Paterno, G. B., Penone, C. Werner, G. D. A. sensiPhy: An r-package for sensitivity analysis in phylogenetic comparative methods. Methods in Ecology and Evolution 2018, 9(6):1461-1467

Ho, L. S. T. and Ane, C. 2014. "A linear-time algorithm for Gaussian and non-Gaussian trait evolution models". Systematic Biology 63(3):397-408.

See also

Examples

if (FALSE) { # Load data: data(primates) # run analysis: clade_tree <- tree_clade_phylm(log(sexMaturity) ~ log(adultMass), phy = primates$phy, data = primates$data, clade.col = "family", n.sim = 50, n.tree = 5) # To check summary results and most influential clades: summary(clade_tree) # Visual diagnostics for clade removal: sensi_plot(clade_tree) # Specify which clade removal to plot: sensi_plot(clade_tree) sensi_plot(clade_tree, "Cercopithecidae") sensi_plot(clade_tree, clade = "Cebidae", graphs = 2) } # \dontshow{ data(primates) # run analysis: clade_tree <- tree_clade_phylm(log(sexMaturity) ~ log(adultMass), phy = primates$phy, data = primates$data, clade.col = "family", n.sim = 10, n.tree = 2)
#> Used dataset has 95 species that match data and phylogeny
#> | | | 0% | |=================================== | 50% | |======================================================================| 100%
# To check summary results and most influential clades: summary(clade_tree)
#> $Estimate #> clade.removed N.species estimate DIFestimate Change (%) Pval #> 3 Cercopithecidae 32 0.3051562 0.05732393 23.10 9.604555e-11 #> 2 Cebidae 19 0.2208491 -0.02698319 10.85 6.538060e-07 #> 1 Callitrichidae 9 0.2214056 -0.02642664 10.70 1.089426e-07 #> 4 Lemuridae 8 0.2584135 0.01058129 4.30 1.027548e-09 #> m.null.estimate Pval.randomization Significant (%) #> 3 0.2739287 0.10 50 #> 2 0.2666883 0.00 100 #> 1 0.2534249 0.00 100 #> 4 0.2556822 0.35 0 #> #> $Intercept #> clade.removed N.species intercept DIFintercept Change (%) Pval #> 3 Cercopithecidae 32 4.514581 -0.38997519 7.95 9.604555e-11 #> 2 Cebidae 19 5.042564 0.13800782 2.80 6.538060e-07 #> 1 Callitrichidae 9 5.104811 0.20025393 4.05 1.089426e-07 #> 4 Lemuridae 8 4.830787 -0.07376971 1.50 1.027548e-09 #> m.null.intercept Pval.randomization Significant (%) #> 3 4.702392 0.20 0 #> 2 4.770586 0.00 100 #> 1 4.855895 0.00 100 #> 4 4.840570 0.35 0 #>
# }