TipInstability: Tip instability

View source: R/stability.R

TipInstabilityR Documentation

Tip instability

Description

TipInstability() calculates the instability of each leaf in a tree. Unstable leaves are likely to display roguish behaviour.

Usage

TipInstability(
  trees,
  log = TRUE,
  average = "mean",
  deviation = "sd",
  checkTips = TRUE,
  parallel = FALSE
)

ColByStability(
  trees,
  log = TRUE,
  average = "mean",
  deviation = "sd",
  pal = hcl.colors(131, "inferno")[1:101]
)

Arguments

trees

List of trees to analyse.

log

Logical specifying whether to log-transform distances when calculating leaf stability.

average

Character specifying whether to use "mean" or "median" tip distances to calculate leaf stability.

deviation

Character specifying whether to use "sd" or "mad" to calculate leaf stability.

checkTips

Logical specifying whether to check that tips are numbered consistently.

parallel

Logical specifying whether parallel execution should take place in C++.

pal

A vector listing a sequence of colours to be used for plotting. The earliest entries will be assigned to the most stable tips.

Details

\insertCite

SmithCons;textualRogue defines the instability of a pair of leaves as the median absolute divergence in the graph geodesic (the number of edges in the shortest path between the leaves) across all trees, normalized against the mean graph geodesic. The instability of a single leaf is the mean instability of all pairs that include that leaf; higher values characterise leaves whose position is more variable between trees.

Other concepts of leaf instability include

  • The "taxonomic instability index", as implemented in Mesquite: described by \insertCiteThomson2010;textualRogue as \sum\limits_{(x, y), j \neq i}{\frac{|D~ijx~ - D~ijy~|}{(D~ijx~ - D~ijy~)^2}}, where D~ijx~ is the patristic distance (i.e. length of edges) between leaves i and j in tree x.

  • the average stability of triplets (i.e. quartets including the root) that include the leaf \insertCiteThorley1999Rogue, implemented in "Phyutility" \insertCiteSmith2008Rogue; and related to "positional congruence" measures \insertCiteEstabrook1992,Pol2009Rogue.

Value

ColByStability() returns a named character vector that assigns a colour to each leaf in trees according to their stability.

Author(s)

Martin R. Smith (martin.smith@durham.ac.uk)

References

\insertAllCited

See Also

Other tip instability functions: TipVolatility()

Examples

library("TreeTools", quietly = TRUE)

# Generate some trees with a rogue taxon
trees <- AddTipEverywhere(BalancedTree(8), "Rogue")[3:6]

# Display the strict consensus
plot(consensus(trees), tip.col = ColByStability(trees))

# Add a legend for the colour scale used
PlotTools::SpectrumLegend(
  "bottomleft", bty = "n", # No box
  legend = c("Unstable", "", "Stable"),
  palette = hcl.colors(131, "inferno")[1:101]
)

# Calculate leaf stability
instab <- TipInstability(trees, log = FALSE, ave = "mean", dev = "mad")

# Plot a consensus that omits the least stable leaves
plot(ConsensusWithout(trees, names(instab[instab > 0.2])))

Rogue documentation built on May 29, 2024, 5:05 a.m.