-2

The question looks naive but I am puzzled with the configuration of the nlme function in R to get equivalent results to a given lme model.

Ben Bolker
  • 211,554
  • 25
  • 370
  • 453
MyQ
  • 459
  • 3
  • 13

1 Answers1

3

This appears to work. Note that the defaults for method are different for lme ("REML") and nlme ("ML") ...

m1 <- lme(distance ~ age, 
          random = ~ age |Subject, data=Orthodont, 
          method="ML")

nlme requires starting values - cheat here and use those from lme:

m2 <- nlme(distance ~ mu, 
           fixed = mu ~ age, 
           random = mu ~ age | Subject, 
           data=Orthodont, 
           start=list(fixed=fixef(m1)))

The variance-covariance matrices are almost identical.

> VarCorr(m1)
Subject = pdLogChol(age) 
            Variance   StdDev    Corr  
(Intercept) 4.81407327 2.1940996 (Intr)
age         0.04619252 0.2149244 -0.581
Residual    1.71620466 1.3100399       
> VarCorr(m2)
Subject = pdLogChol(list(mu ~ age)) 
               Variance   StdDev    Corr  
mu.(Intercept) 4.81408901 2.1941032 m.(In)
mu.age         0.04619255 0.2149245 -0.581
Residual       1.71620373 1.3100396  
Ben Bolker
  • 211,554
  • 25
  • 370
  • 453