Learn R Programming

phytools (version 2.4-4)

fitThresh: Fits multi-state threshold model using the discrete approximation

Description

This function uses the discrete approximation of Boucher and Demery (2016) to fit a multi-state discrete character threshold model following Felsenstein (2012; Revell 2014).

Usage

fitThresh(tree, x, sequence=NULL, ...)

Value

An object of class "fitThresh".

Arguments

tree

object of class "phylo".

x

a named vector.

sequence

assumed ordering of the discrete character state. If not supplied and then alphanumeric order is assumed.

...

optional arguments. Optional arguments include levs (the number of levels for the discrete approximation, defaults to levs=200), root (a root prior assumption, defaults to root="fitzjohn" which involves treating the root like a nuisance parameter), and rand_start (defaults to rand_start=TRUE).

Author

Liam Revell liam.revell@umb.edu

References

Boucher, F. C., and V. Demery (2016) Inferring bounded evolution in phenotypic characters from phylogenetic comparative data. Systematic Biology, 65, 651-661.

Felsenstein, J. (2012) A comparative method for both discrete and continuous characters using the threshold model. American Naturalist, 179, 145-156.

Revell, L. J. (2014) Ancestral character estimation under the threshold model from quantitative genetics. Evolution, 68, 743-759.

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

See Also

ancThresh, bounded_bm, fitmultiBM, threshBayes

Examples

Run this code
if (FALSE) {
## load data from Revell & Collar (2009)
data(sunfish.tree)
data(sunfish.data)

## extract character of interest
fmode<-setNames(sunfish.data$feeding.mode,
    rownames(sunfish.data))

## fit model
sunfish_thresh<-fitThresh(sunfish.tree,fmode,
    levs=100)
sunfish_thresh

## fit ARD model for comparison
sunfish_ard<-fitMk(sunfish.tree,fmode,model="ARD")
sunfish_ard

## compare results
anova(sunfish_thresh,sunfish_ard)

## estimate ancestral states under threshold model
anc_sunfish<-ancr(sunfish_thresh)

## plot results
plot(anc_sunfish,mar=c(0.1,0.1,4.1,0.1),
    args.plotTree=list(lwd=2,type="cladogram",
        nodes="inner",offset=1),
    args.nodelabels=list(piecol=hcl.colors(n=2),
        cex=0.6),
    args.tiplabels=list(cex=0.5),legend=FALSE)
legend("topleft",c("non-piscivorous","piscivorous"),
    pch=16,col=hcl.colors(n=2),pt.cex=2,bty="n")
	
## reset par to defaults
par(mar=c(5.1,4.1,4.1,2.1),cex.axis=1)}

Run the code above in your browser using DataLab