lmerTest and lmer: Error message

[亡魂溺海] 提交于 2019-12-10 00:16:31

问题


I have run lmerTest and lmer in R in the version 2013:

> library(lmerTest)
> data1.frame <- read.delim("colorness.txt", fileEncoding="UTF-16")
> str(data1.frame)
> lmer3 <- lmerTest::lmer(duration ~ (1|item) + (1+color|speaker) + group*color*sex, data=data1.frame, REML=FALSE, na.action=na.omit)

The lmer3 works fine for me. And when I checked the data in str(data1.frame), there is nothing wrong.

But when I put this command

> summary(lmer3)

It gives me this message:

Error in `colnames<-`(`*tmp*`, value = c("Estimate", "Std. Error", "df",  : 
  length of 'dimnames' [2] not equal to array extent

However, I am quite sure there is nothing wrong in my data as I can run lmer in R version 2009. Do you have any idea how to solve this issue? The thing is that if I stick with R version 2009, then I cannot get p-values from lmerTest, and I don't know how to get it from likelihood ratio test. Do you have any idea about this?


回答1:


sorry to post this as an answer, but I still do not have enough "reputation" to comment. I think it is a bug and/or depends on the data, because I have the same problem. I have a large dataset, and the model runs row-wise through it using a loop. Everything works perfectly for the first 26,478 tests (out of 34,713) but stops in the next cycle, with the same error. So:

1) it is not the version of the package, since it works perfectly for 3/4's of my dataset 2) it is not the sintax, since everything works fine in the first tens of thousands of models and an ANOVA I run previously against a null model.

My code is roughly:

for (i in 1:nrow(dataset)){
    dataframe<-as.data.frame(dataset[i,]);
    lm.R<-lmer(response ~ treatment + (1|ran)+(1|rep), dataframe, REML= FALSE);
    x<-summary(lm.R);
    p.val[i,]<-x$coefficients[,"Pr(>|t|)"];
}

and I get the same error when i = 26479

Model is not identifiable...
Error in `colnames<-`(`*tmp*`, value = c("Estimate", "Std. Error", "df",  : 
  length of 'dimnames' [2] not equal to array extent

My data is fine in that row (I doublechecked) and I cannot see any irregularity. Even the ANOVA against the null model (which I highly recommend you to do, since it gives you the p-value, loglike, AIB, etc. of your model) works perfectly.

lm.null<-lmer(response ~ 1 + (1|ran)+(1|rep), dataframe, REML= FALSE);
lm.R<-lmer(response ~ treatment + (1|ran)+(1|rep), dataframe, REML= FALSE);
anova(lm.null,lm.R);


来源:https://stackoverflow.com/questions/22089982/lmertest-and-lmer-error-message

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!