我似乎无法看到我在哪里弄错了。我使用包phylolm用系统发育数据做一些回归
我的模型没有运行并返回错误:phyloglm(testVar ~ ...the number of rows in the data does not match the number of tips in the tree.
中的错误
我已经做了所有事情来检查,但我的树中的物种和我的数据中的物种是匹配的。我的代码是
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.
任何人都可以指出我弄错了什么?
因为对这件小事视而不见而道歉...我应该在我的数据中重命名我的row.names
row.names(diet)<-diet$ScientificName