0

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?

user3288202
  • 313
  • 1
  • 4
  • 14
  • 1
    You should provide some representative data and your code. This is too vague for anyone to hazard a guess. – asb Feb 28 '14 at 08:43
  • OK, I'll do in a minute. I just have uninstalled R a moment ago, and waiting for school technician to reinstall it for me. Thanks for suggestion, asb. – user3288202 Feb 28 '14 at 09:16
  • Hi asb, I have added more information for you so that you might be able to point out problem. Your suggestions will be useful for my work. – user3288202 Feb 28 '14 at 09:31
  • Look at the "Depends" field on the [CRAN page](http://cran.r-project.org/web/packages/lmerTest/index.html). If your setup doesn't fulfill the listed requirements you should not be suprised by problems. – Roland Feb 28 '14 at 09:41
  • Hi Roland, but the formula works fine when I run it with the other measurement. That is why I am surprised what is wrong. – user3288202 Feb 28 '14 at 09:46
  • Could you copy `head(data1.frame)` here? – llrs Feb 28 '14 at 10:06
  • Hi Llopis, I have tried it, but it seems like nothing wrong. I am not sure if I should put it here as it will also show my data which is confidential. Could you guide me what I should notice about the heading? I am not sure if it is because I use Windows as in http://cran.r-project.org/web/checks/check_results_lmerTest.html. – user3288202 Feb 28 '14 at 10:23
  • My other solution is that I will have to find article analysing data with lmm and not report p-values so that I can be sure that the p-values are not needed for analysis reporting. – user3288202 Feb 28 '14 at 10:45
  • You don't need `lmerTest` for p-values. Install the latest version of lme4 and read `help("pvalues")`. – Roland Feb 28 '14 at 12:03
  • 2013 is not a version. It's a year. R and it's packages have actual version numbers which are more informative. – Roland Feb 28 '14 at 14:13
  • Hi Roland, oh, sorry. I'm using R 3.0.1. And I still cannot get p-values from KRmodcomp from the pbkrtest package (MC) as I have the same number of parameters. – user3288202 Feb 28 '14 at 14:27
  • R version 2009 seems to be quite old.. could you run sessionInfo() and put here what you get out of it? My guess that the problem lies in the version of lmerTest together with the version of lme4. But of course a representative example would help. You could e-mail me the data if you can (to maintainer of lmerTest) so I can have a closer look – Alexandra Feb 28 '14 at 12:17
  • Thanks very much for suggestion. I have reported this and attached files to Alexandra already. – user3288202 Feb 28 '14 at 12:43
  • having the same problem, I've just detach("package:lmerTest"), and "summary" worked. So, it sounds the lmerTest bug Marina – marina Mar 24 '14 at 11:28
  • Yes I have emailed asking Alexandra who is lmerTest maintainer and he confirmed that for this set of my data, lmerTest cannot be run. So I've excluded random slope in one random effect, and it works fine. – user3288202 Mar 24 '14 at 11:37
  • Thank you ! But not convinced it depends on the data. My model is the simplier your can find (y ~ Tt + (1|patient) ) . It just stopped working when updating versions... Thanks anyway – marina Mar 24 '14 at 11:58

1 Answers1

2

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);
Carlos
  • 43
  • 7
  • Yes I agree it is a bug. – user3288202 Apr 24 '14 at 16:20
  • I think I'm just going to ignore that datapoint (there was no significant difference to the null model.) Did you managed to circumvent it? (By comparing it against individual models and doing an ANOVA or using loglikelihood, maybe?) I recommend an ANOVA on: lm.null<-lmer(duration ~ (1|item) + (1+color|speaker) + 1, data=data1.frame, REML=FALSE, na.action=na.omit) lm.g<-lmer(duration ~ (1|item) + (1+color|speaker) + group, data=data1.frame, REML=FALSE, na.action=na.omit) end every combination possible (G, C, S, G*C, G*S, C*S, etc.) – Carlos Apr 24 '14 at 18:08
  • Thanks Carlos. Now i just use lsmeans to give me post-hoc test so i don't need the output from the model anymore. – user3288202 Apr 24 '14 at 19:43