[R] minor bug in lmer

From: Lngmyers <lngmyers_at_ccu.edu.tw>
Date: Wed, 09 May 2007 14:29:20 +0800

While playing around with the "(1|Subj)" syntax in lmer [lme4], I tried out "(0|Subj)". It turns out that this is such a naughty thing to do that it crashes the GUI in Windows! The parallel structure in lme [nlme] has no effect. Try the following code to see for yourself.

# Make data set

  q = 5; n = 5
  Subj = NULL
  X = NULL
  Y = NULL
  for (i in 1:q) {
   for (j in 1:n) {
    Subj = c(Subj,i)
    X = c(X,j)
    Y = c(Y,i/j)
   }
  }
  fake = data.frame(Subj,X,Y)

# nlme

  library(nlme)
  fake.g.1 = groupedData(Y~1|Subj, data = fake)   fake.g.lme.1.1 = lme(Y ~ X, random=~1|Subj, data= fake.g.1)

  fake.g.0 = groupedData(Y~0|Subj, data = fake)   fake.g.lme.0.0 = lme(Y ~ X, random=~0|Subj, data= fake.g.0)

  fake.g.lme.1.0 = lme(Y ~ X, random=~1|Subj, data= fake.g.0)   fake.g.lme.0.1 = lme(Y ~ X, random=~0|Subj, data= fake.g.1)

  # The following are all identical

  summary(fake.g.lme.1.1)
  summary(fake.g.lme.0.0)
  summary(fake.g.lme.1.0)
  summary(fake.g.lme.0.1)

# lme4

  library(lme4)

  # Same analysis as above:
  fake.lme.1 = lmer(Y ~ X + (1|Subj),data=fake)

  # The following line crashes the WinR GUI!   fake.lme.0 = lmer(Y ~ X + (0|Subj),data=fake)

-- 
James Myers
Graduate Institute of Linguistics
National Chung Cheng University
Web:    http://www.ccunix.ccu.edu.tw/~lngmyers/

______________________________________________
R-help_at_stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
Received on Wed 09 May 2007 - 06:34:50 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Wed 09 May 2007 - 07:31:24 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.