Learn R Programming

phytools (version 2.3-0)

pscore: Compute the parsimony score

Description

Calculates the parsimony score using the Fitch algorithm.

Usage

pscore(tree, x, ...)

Value

A numerical value or vector of values.

Arguments

tree

object of class "phylo".

x

vector (e.g., factor vector), matrix, or data frame. Should contain names or row names.

...

optional arguments.

Author

Liam Revell liam.revell@umb.edu

Details

Mostly for diagnostic purposes. Users interested in using Maximum Parsimony for phylogeny inference or ancestral state reconstruction should refer to the phangorn package.

References

Felsenstein, J. (2004) Inferring Phylogenies. Sinauer.

Revell, L. J. (2024) phytools 2.0: an updated R ecosystem for phylogenetic comparative methods (and other things). PeerJ, 12, e16505.

See Also

fitMk, sim.Mk

Examples

Run this code
## load tree and data from Revell & Collar (2009)
data(sunfish.tree)
data(sunfish.data)
## extract discrete character (feeding mode)
fmode<-setNames(sunfish.data$feeding.mode,
    rownames(sunfish.data))
## compute the parsimony score
pscore(sunfish.tree,fmode)

Run the code above in your browser using DataLab