2
$\begingroup$

How do you explain that ? There's only one operator but the mixed model returns an estimate for the operator random effect. Furthermore the sample effect is confounded with the interaction sample:operator. Below is the R code.

> dd
   sample operator         y
9      10      SCF 0.9153188
10     10      SCF 0.9884982
19    100      SCF 2.0798781
20    100      SCF 2.0464027
29   1000      SCF 3.0401590
30   1000      SCF 3.0114448
39  10000      SCF 4.1348324
40  10000      SCF 4.0840063
49  1e+05      SCF 5.1235795
50  1e+05      SCF 5.1106381
59  1e+06      SCF 6.0803404
60  1e+06      SCF 6.2353263
> str(dd)
'data.frame':   12 obs. of  3 variables:
 $ sample  : Factor w/ 6 levels "10","100","1000",..: 1 1 2 2 3 3 4 4 5 5 ...
     $ operator: Factor w/ 1 level "SCF": 1 1 1 1 1 1 1 1 1 1 ...
 $ y       : num  0.915 0.988 2.08 2.046 3.04 ...
> lmer(y ~ (1|sample)+(1|operator)+(1|sample:operator), data=dd) 
Linear mixed model fit by REML 
Formula: y ~ (1 | sample) + (1 | operator) + (1 | sample:operator) 
   Data: dd 
  AIC   BIC logLik deviance REMLdev
 18.6 21.03 -4.302    9.932   8.605
Random effects:
 Groups          Name        Variance   Std.Dev.
 sample:operator (Intercept) 1.87954740 1.370966
 sample          (Intercept) 1.87954925 1.370967
 operator        (Intercept) 0.00063096 0.025119
 Residual                    0.00283931 0.053285
Number of obs: 12, groups: sample:operator, 6; sample, 6; operator, 1

Fixed effects:
            Estimate Std. Error t value
(Intercept)   3.5709     0.7921   4.508

For those who are more familiar with SAS the corresponding code is:

PROC MIXED DATA=dd;
CLASS sample operator;
MODEL y=;
RANDOM sample operator sample*operator;
RUN;

This is nothing but the crossed 2-way ANOVA with random effects.

$\endgroup$
8
  • $\begingroup$ I am no expert on lme, but I think what's going on is that the operator term just gets added to the intercept. If you post your SAS code, I might have a better chance of understanding the code :-). $\endgroup$
    – Peter Flom
    Commented Oct 30, 2012 at 14:36
  • $\begingroup$ @PeterFlom Ok, I have posted it. The operator estimate is a variance, it has nothing to do with the intercept. $\endgroup$ Commented Oct 30, 2012 at 14:44
  • $\begingroup$ I am still not really sure what is going on, but if you add /solution to the random line, the estimate for operator and all levels of the interaction is 0. I am not sure what you expected to happen - you seem surprised that it ran, but there's no error in the code, it's just a weird model. I think. :-). $\endgroup$
    – Peter Flom
    Commented Oct 30, 2012 at 15:05
  • $\begingroup$ @PeterFlom Sorry in fact I have not checked the SAS outputs except the residual variance. I expected the model would not run because the operator variance is impossible to estimate and the sample and sample:operator effects are counfounded. $\endgroup$ Commented Oct 30, 2012 at 15:09
  • $\begingroup$ In SAS, operator variance was shown as missing, as was sample:operator. Models with confounded variables often do run. But they often give odd results, as here. $\endgroup$
    – Peter Flom
    Commented Oct 30, 2012 at 15:12

1 Answer 1

4
$\begingroup$

I have asked this question on the r-sig-mixed-models mailing list and below is the answer from Douglas Bates:

Stéphane,

You are correct that there should not be an attempt to fit such a model. In theory the deviance function is degenerate (a singular Hessian matrix at every parameter value). In practice it will not be exactly degenerate and the optimizer will attempt to locate a minimum determined by round-off error.

Again, it is probably good to throw an error in this case and to warn when the number of levels in a grouping factor for random effects term(s) is small (say, < 5). I'll add an issue on the github repository, https://github.com/lme4/lme4/issues, regarding this.

By the way, the reason for printing out the number of levels in the factors as part of the random-effects summary is so that the user will notice when these are small, which usually means a mistake in the model formula. Of course, it requires that the user look at that part of the summary and anyone who has used SAS is accustomed to ignoring large parts of the output.

Anyway, the issue is now recorded as https://github.com/lme4/lme4/issues/24

$\endgroup$
0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.