lmerTest和lmer:错误消息 [英] lmerTest and lmer: Error message
问题描述
我已经在2013版的R中运行了lmerTest和lmer:
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)
lmer3对我来说很好用.当我检查str(data1.frame)中的数据时,没有任何问题.
The lmer3 works fine for me. And when I checked the data in str(data1.frame), there is nothing wrong.
但是当我输入此命令
> summary(lmer3)
它给了我这个信息:
Error in `colnames<-`(`*tmp*`, value = c("Estimate", "Std. Error", "df", :
length of 'dimnames' [2] not equal to array extent
但是,我可以肯定我的数据没有问题,因为我可以在R版本2009中运行lmer.您知道如何解决此问题吗?问题是,如果我坚持使用R版本2009,则无法从lmerTest获取p值,而且我也不知道如何从似然比测试中获取p值.您对此有任何想法吗?
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?
推荐答案
很抱歉将其发布为答案,但是我仍然没有足够的信誉"来发表评论. 我认为这是一个错误,并且/或者取决于数据,因为我有同样的问题.我有一个很大的数据集,并且该模型使用循环逐行运行.一切对于前26,478个测试(在34,713个测试中)都运行良好,但在下一个周期中停止,并出现相同的错误. 因此:
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)它不是软件包的版本,因为它非常适合我的数据集的3/4. 2)它不是正弦波,因为在前几万个模型中都可以正常工作,而我以前针对空模型运行的方差分析也是如此.
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.
我的代码大致是:
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|)"];
}
当我= 26479时出现相同的错误
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
我的数据在该行中很好(我仔细检查了一下),并且看不到任何异常情况.甚至针对空模型的ANOVA(我也强烈建议您这样做,因为它为您提供了模型的p值,对数似的,AIB等).
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);
这篇关于lmerTest和lmer:错误消息的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!