Skip to content
Prev 14640 / 20628 Next

lme function - fixed sigma - inconsistent results with sae and proc mixed results

Since when does lme() in R have the 'sigma' control argument? Ah, since 2015-11-25 (https://cran.r-project.org/web/packages/nlme/ChangeLog). Very interesting!

But apparently this is not giving the right results here. Another check:

library(sae)
library(metafor)
data(milk)
milk$var <- milk$SD^2
res <- rma(yi ~ as.factor(MajorArea), var, data=milk)
res
res$tau2

Yields:

Mixed-Effects Model (k = 43; tau^2 estimator: REML)

tau^2 (estimated amount of residual heterogeneity):     0.0185 (SE = 0.0079)
tau (square root of estimated tau^2 value):             0.1362
I^2 (residual heterogeneity / unaccounted variability): 55.21%
H^2 (unaccounted variability / sampling variability):   2.23
R^2 (amount of heterogeneity accounted for):            65.85%

Test for Residual Heterogeneity: 
QE(df = 39) = 86.1840, p-val < .0001

Test of Moderators (coefficient(s) 2,3,4): 
QM(df = 3) = 46.5699, p-val < .0001

Model Results:

                       estimate      se     zval    pval    ci.lb    ci.ub     
intrcpt                  0.9682  0.0694  13.9585  <.0001   0.8322   1.1041  ***
as.factor(MajorArea)2    0.1328  0.1030   1.2891  0.1974  -0.0691   0.3347     
as.factor(MajorArea)3    0.2269  0.0923   2.4580  0.0140   0.0460   0.4079    *
as.factor(MajorArea)4   -0.2413  0.0816  -2.9565  0.0031  -0.4013  -0.0813   **

---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
[1] 0.01854996

Same as in 'sae' (rounded to 6 decimals) and SAS.

Not a huge difference to lme(), but larger than one would expect due to numerical differences.

If you switch to method="ML" (for both lme() and rma()), then you get 0.1245693^2 = 0.01551751 for lme() and 0.0155174 for rma(), so that's basically the same.

Best,
Wolfgang