Skip to main content
1 of 4
Stéphane Laurent
  • 19.7k
  • 5
  • 76
  • 109

mixed model runs well whereas a random effect has only one level

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 and SAS give the same results.

> 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
Stéphane Laurent
  • 19.7k
  • 5
  • 76
  • 109