A phytools user asks:
Is there an easy way to use phylosig to test whether the fitted value of λ is significantly different from 1?
Indeed, this is possible to do using fitContinuous in the geiger package, as many readers probably realize. It is also possible to do this with functions entirely in the phytools package. This is how:
# assuming phylogeny in 'tree' and data in 'x'
mtree<-tree
mtree$mapped.edge<-matrix(mtree$edge.length,nrow(tree$edge),1)
colnames(mtree$mapped.edge)<-"1"
resBM<-brownie.lite(mtree,x)
resLambda<-phylosig(tree,x,method="lambda")
LR<-2*(resLambda$logL-resBM$logL1)
P<-pchisq(LR,df=1,lower.tail=F)
That's it!
Hi Dr. Revell,
ReplyDeleteI'm trying to follow your above example for a tree of eight bird species and data for their respective growth rates. The brownie.lite() function seems to run fine but phylosig() returns "Error in invCl %*% y : requires numeric/complex matrix/vector arguments." I have used the same tree and data with function pgls (in caper) without a problem. I realize this is not reproducible but I thought you might have an idea as to what I'm doing wrong?
Many thanks,
Maria
Hi Maria, I came across the same problem. It can be circumvented with reducing the number of traits in your dataset. If you prune all but 2 traits, it runs fine. Might be a bug?!
Deletecheers,
max
Hello. Is there also an easy way to test whether the fitted value of λ is significantly different from 0?
ReplyDeleteThank you for answering,
René
That's the default. Just set method="lambda" & test=TRUE.
Delete- Liam
Many thanks for the quick reply!
Delete