fitThresh: Fits binary, multi-state, and semi-threshold models using the...

View source: R/fitThresh.R

fitThreshR Documentation

Fits binary, multi-state, and semi-threshold models using the discrete approximation

Description

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

fitsemiThresh uses the discrete approximation of Boucher and Demery (2016) to fit a semi-threshold model in which liability is observed on some interval, but unobserved outside of it.

Usage

fitThresh(tree, x, sequence=NULL, ...)
fitsemiThresh(tree, x, threshold=c(0,1), ...)

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.

threshold

for fitsemiThresh, thresholds for the semi-threshold trait.

...

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).

Value

An object of class "fitThresh" or "fitsemiThresh".

Author(s)

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

## Not run: 
## 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)
## End(Not run)

liamrevell/phytools documentation built on June 14, 2025, 7:58 p.m.