I'm looking at running evolutionary models on some whale data and then determining significance vs. Brownian motion with Chi Squared.
It is working for most of my models except 2 and I have no idea why (early burst and Ornstein-Uhlenbeck). The models all work (the size.X parts) but the Chi Squared doesn't with a "numeric(0)" return for two of the models only, the rest all producing valid values.
I have shown my code below and given an example of the code that is working (bm and lambda work) and one that doesn't (acdc). Thanks!
WhaleData <- read.csv("WhaleData.csv")
attach(WhaleData)
library(geiger)
WhaleSize <- matrix(log10(WhaleData[,"length"]))
rownames(WhaleSize) <- WhaleData$X
nms.id <- complete.cases(WhaleSize)
WhaleSizePruned <- as.matrix(WhaleSize[nms.id,])
drop.names <- rownames(WhaleSize)[!nms.id]
WhaleTreePruned <- drop.tip(WhaleTree, drop.names)
size.bm <- transformPhylo.ML(WhaleSizePruned,WhaleTreePruned,model="bm")
size.bm
size.acdc <- transformPhylo.ML(WhaleSizePruned,WhaleTreePruned,model="acdc")
size.acdc
size.lam <- fitContinuous(WhaleTreePruned,WhaleSizePruned,model="lambda")
size.lam
lh.bm<-size.bm$logLikelihood
lh.acdc<-size.acdc$opt$lnL
1-pchisq(2*(lh.acdc-lh.bm),df=1)
lh.lam<-size.lam$opt$lnL
1-pchisq(2*(lh.lam-lh.bm),df=1)