check.morpho {dispRity}R Documentation

Check a morphological matrix consistency levels.

Description

Performs a fast check of the phylogenetic signal in a morphological matrix using parsimony.

Usage

check.morpho(
  matrix,
  orig.tree,
  parsimony = "fitch",
  first.tree = c(phangorn::dist.hamming, phangorn::NJ),
  distance = phangorn::RF.dist,
  ...,
  contrast.matrix,
  verbose = FALSE
)

Arguments

matrix

A discrete morphological matrix.

orig.tree

Optional, the input tree to measure the distance between the parsimony and the original tree.

parsimony

Either the parsimony algorithm to be passed to optim.parsimony or a parsimony function that can take a phyDat object as an input (default = "fitch").

first.tree

A list of functions to generate the first most parsimonious tree (default = c(dist.hamming, NJ); see details).

distance

Optional, if orig.tree is provided, the function to use for measuring distance between the trees (default = link[phangorn]{RF.dist}).

...

Any additional arguments to be passed to the parsimony algorithm.

contrast.matrix

An optional contrast matrix. By default, the function recognises any character state token as different apart from ? that is treated as all characters.

verbose

Whether to be verbose or not (default = FALSE).

Details

Value

Returns the parsimony score (using parsimony), the consistency and retention indices (using CI and RI) from the most parsimonious tree obtained from the matrix. Can also return the topological distance from the original tree if provided.

Author(s)

Thomas Guillerme

See Also

sim.morpho, get.contrast.matrix, optim.parsimony

Examples

## Generating a random tree
random_tree <- rcoal(10)

## Generating a random matrix
random_matrix <- sim.morpho(random_tree, characters = 50, model = "ER",
     rates = c(rgamma, 1, 1))

## Checking the matrix scores
check.morpho(random_matrix, orig.tree = random_tree)


[Package dispRity version 1.8 Index]