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