the number of rows in the data does not match the number of tips in the tree in phyloglm

Viewed 407

I do not seem to able to see where I am getting things wrong. I am using the package phylolm to do some regressions with phylogenetic data

my model is not running and returns the error : Error in phyloglm(testVar ~ ...the number of rows in the data does not match the number of tips in the tree.

I have done everything to check but the species in my tree and those in my data are matching. my code is

diet<-read.csv("dat.csv",h=T,dec = ".")
phy=read.nexus("ConsTree.tre")# the phylogenetic data
keep.spp<-levels(diet$ScientificName)
phylo<-drop.tip(phy,phy$tip.label[-match(keep.spp, phy$tip.label)])

setdiff(phylo$tip.label,diet$ScientificName)# this confirms that all is OK
t1<-phyloglm(testVar~Var1+Var2+Var3, diet, phylo)

t1<-phyloglm(testVar~Var1+Var2+Var3, diet, phylo, 
             method = c("logistic_MPLE","logistic_IG10","poisson_GEE"), 
             btol = 10, log.alpha.bound = 4,
             start.beta=NULL, start.alpha=NULL,
             boot = 0, full.matrix = TRUE)

   #
    Error in phyloglm(testVar~Var1+Var2+Var3,..the number of rows in the data does not match the number of tips in the tree.

Can anyone point where I am getting things wrong?

1 Answers
Related