library(datasets)
library(nlme)
n1 <- nlme(circumference ~ phi1 / (1 + exp(-(age - phi2)/phi3)),
data = Orange,
fixed = list(phi1 ~ 1,
phi2 ~ 1,
phi3 ~ 1),
random = list(Tree = pdDiag(phi1 ~ 1)),
start = list(fixed = c(phi1 = 192.6873, phi2 = 728.7547, phi3 = 353.5323)))
I fit a nonlinear mixed effects model using nlme
in R, and here's my output.
> summary(n1)
Nonlinear mixed-effects model fit by maximum likelihood
Model: circumference ~ phi1/(1 + exp(-(age - phi2)/phi3))
Data: Orange
AIC BIC logLik
273.1691 280.9459 -131.5846
Random effects:
Formula: phi1 ~ 1 | Tree
phi1 Residual
StdDev: 31.48255 7.846255
Fixed effects: list(phi1 ~ 1, phi2 ~ 1, phi3 ~ 1)
Value Std.Error DF t-value p-value
phi1 191.0499 16.15411 28 11.82671 0
phi2 722.5590 35.15195 28 20.55530 0
phi3 344.1681 27.14801 28 12.67747 0
Correlation:
phi1 phi2
phi2 0.375
phi3 0.354 0.755
Standardized Within-Group Residuals:
Min Q1 Med Q3 Max
-1.9146426 -0.5352753 0.1436291 0.7308603 1.6614518
Number of Observations: 35
Number of Groups: 5
I fit the same model in SAS and get the following results.
data Orange;
input row Tree age circumference;
datalines;
1 1 118 30
2 1 484 58
3 1 664 87
4 1 1004 115
5 1 1231 120
6 1 1372 142
7 1 1582 145
8 2 118 33
9 2 484 69
10 2 664 111
11 2 1004 156
12 2 1231 172
13 2 1372 203
14 2 1582 203
15 3 118 30
16 3 484 51
17 3 664 75
18 3 1004 108
19 3 1231 115
20 3 1372 139
21 3 1582 140
22 4 118 32
23 4 484 62
24 4 664 112
25 4 1004 167
26 4 1231 179
27 4 1372 209
28 4 1582 214
29 5 118 30
30 5 484 49
31 5 664 81
32 5 1004 125
33 5 1231 142
34 5 1372 174
35 5 1582 177
;
proc nlmixed data=Orange;
parms phi1=192.6873 phi2=728.7547 phi3=353.5323 vb1=991.151, s2e=61.56372;
mod = (phi1 + u1)/(1 + exp(-(age - phi2)/phi3));
model circumference ~ normal(mod, s2e);
random u1 ~ normal([0],[vb1]) subject=Tree;
run;
Can someone help me understand why I'm getting slightly different estimates? I know that the nlme
uses the Lindstrom & Bates (1990) implementation. According to SAS documentation, SAS's integral approximation is based on Pinhiero & Bates (1995). I've tried changing the optimization method to Nelder-Mead to match that of nlme
, but the results are still dissimilar.
I've had other cases where the standard error and parameter estimate in R vs. SAS are vastly different (I don't have a reproducible example of this, but any insight would be appreciated). I'm guessing this has to do with how nlme
and nlmixed
estimate the standard errors in the presence of random effects?
Orange
data set contains 35 observations. $\endgroup$