[R-sig-ME] lme and lmer

Nicholas Burgoyne nburgoyne at mango-solutions.com
Wed Jul 30 10:25:53 CEST 2014


Dear all,

I have been kindly redirected here by Ben Bolker, thank you for your assistance so far!

I apologise for posting what is probably quite a benign query, but for the life of me I can't find an answer.

I have been asked to explain the differences in the variance-covariance data in an identical test in Splus (lme) and R (lmer in lme4).

The input data is standard (from MASS), and identical (I've checked), the test is as similar as I can make it (code below).

The same output (to a high degree of precision) is obtained for all of the output values (not just that displaced here), expect for the vcov data for the Intercept with itself. The effect is therefore that the standard deviations of the fixed values are quite different!

I am using splus 6.2, R 3.0.2 and lme4 v 1.1-7 (see sessionInfo dump later on), the contrasts in splus are set to treatment/poly.

Any advice you could give me would be very helpful.

Kind regards,

Nick Burgoyne

#########
#In Spus#
#########
>options(contrasts=c("contr.treatment", "contr.poly"))
>library(MASS)
>coop <- coop
>lme <- lme(fixed=Conc ~ Lab, data=coop, random = ~ Bat, subset=coop$Spc=="S1")
> lme
Linear mixed-effects model fit by REML
  Data: coop 
  Subset: coop$Spc == "S1" 
  Log-restricted-likelihood: 20.27187
  Fixed: Conc ~ Lab 
 (Intercept)      LabL2 LabL3 LabL4     LabL5     LabL6 
    0.319999 0.08166667  0.04  0.68 0.1233333 0.2033333

Random effects:
Formula:  ~ Bat | 1
Structure: General positive-definite
                  StdDev   Corr        
(Intercept) 0.1401167895 (Intr) BatB2 
      BatB2 0.0001407246  0.000       
      BatB3 0.0003628541  0.000 -0.072
   Residual 0.1029156551              

Number of Observations: 36
Number of Groups: 1
> lme$varFix
             (Intercept)        LabL2        LabL3        LabL4        LabL5        LabL6 
(Intercept)  0.021398003 -0.001765272 -0.001765272 -0.001765272 -0.001765272 -0.001765272
      LabL2 -0.001765272  0.003530544  0.001765272  0.001765272  0.001765272  0.001765272
      LabL3 -0.001765272  0.001765272  0.003530544  0.001765272  0.001765272  0.001765272
      LabL4 -0.001765272  0.001765272  0.001765272  0.003530544  0.001765272  0.001765272
     LabL5 -0.001765272  0.001765272  0.001765272  0.001765272  0.003530544  0.001765272
      LabL6 -0.001765272  0.001765272  0.001765272  0.001765272  0.001765272  0.003530544

######
#In R#
######
>library(lme4)
>library(MASS)
>coop <- coop
>lme <- lmer(formula=Conc ~ Lab + (1|Bat),  data=coop, subset=coop$Spc=="S1")
>lme
Linear mixed model fit by REML ['lmerMod']
Formula: Conc ~ Lab + (1 | Bat)
   Data: coop
Subset: coop$Spc == "S1"
REML criterion at convergence: -40.5438
Random effects:
Groups   Name        Std.Dev.
Bat      (Intercept) 0.0000  
 Residual             0.1029  
Number of obs: 36, groups:  Bat, 3
Fixed Effects:
(Intercept)        LabL2        LabL3        LabL4        LabL5        LabL6  
    0.32000      0.08167      0.04000      0.68000      0.12333      0.20333
>vcov(lme)
6 x 6 Matrix of class "dpoMatrix"
             (Intercept)        LabL2        LabL3        LabL4        LabL5
(Intercept)  0.001765278 -0.001765278 -0.001765278 -0.001765278 -0.001765278
LabL2       -0.001765278  0.003530556  0.001765278  0.001765278  0.001765278
LabL3       -0.001765278  0.001765278  0.003530556  0.001765278  0.001765278
LabL4       -0.001765278  0.001765278  0.001765278  0.003530556  0.001765278
LabL5       -0.001765278  0.001765278  0.001765278  0.001765278  0.003530556
LabL6       -0.001765278  0.001765278  0.001765278  0.001765278  0.001765278
                   LabL6
(Intercept) -0.001765278
LabL2        0.001765278
LabL3        0.001765278
LabL4        0.001765278
LabL5        0.001765278
LabL6        0.003530556

> sessionInfo()
R version 3.0.2 (2013-09-25)
Platform: i386-w64-mingw32/i386 (32-bit)

locale:
[1] LC_COLLATE=English_United Kingdom.1252 
[2] LC_CTYPE=English_United Kingdom.1252   
[3] LC_MONETARY=English_United Kingdom.1252
[4] LC_NUMERIC=C                           
[5] LC_TIME=English_United Kingdom.1252    

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
[1] MASS_7.3-29  lme4_1.1-7   Rcpp_0.11.2  Matrix_1.1-4

loaded via a namespace (and not attached):
[1] grid_3.0.2      lattice_0.20-29 minqa_1.2.3     nlme_3.1-111   
[5] nloptr_1.0.0    splines_3.0.2   tools_3.0.2

--
Nicholas Burgoyne
E:nburgoyne at mango-solutions.com	T:+44 (0)1249 705 450
W:www.mango-solutions.com	
 

________________________________________
  EARL Conference, London 15-17 September 2014 - Hurry as tickets for the event are selling fast
  Mango are delighted to announce the inaugural EARL Conference (Effective Applications of the R Language) 
  For further details please visit  www.earl-conference.com or email  questions at earl-conference.com 

________________________________________

-- 

LEGAL NOTICE 

This message is intended for the use of the named recipient(s) only and may contain 
confidential and / or privileged information. If you are not the intended recipient, please 
contact the sender and delete this message. Any unauthorised use of the information 
contained in this message is prohibited. 

Mango Business Solutions Limited is registered in England under No. 4560258 with its 
registered office at Suite 3, Middlesex House, Rutherford Close, Stevenage, Herts, SG1 2EF, 
UK. 


PLEASE CONSIDER THE ENVIRONMENT BEFORE PRINTING THIS EMAIL

Nicholas Burgoyne
  
Tel. +44 (0)1249 705 450 | Mobile. 
mailto:nburgoyne at mango-solutions.com | www.mango-solutions.com



2 Methuen Park
Chippenham
Wiltshire 
SN14 OGB
UK

--

LEGAL NOTICE

This message is intended for the use of the named recipient(s) only and may contain
confidential and / or privileged information. If you are not the intended recipient, please
contact the sender and delete this message. Any unauthorised use of the information
contained in this message is prohibited.

Mango Business Solutions Limited is registered in England under No. 4560258 with its
registered office at Suite 3, Middlesex House, Rutherford Close, Stevenage, Herts, SG1 2EF,
UK.

PLEASE CONSIDER THE ENVIRONMENT BEFORE PRINTING THIS EMAIL



More information about the R-sig-mixed-models mailing list