nlme in R v.2.2.1 and S-Plus v. 7.0

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

nlme in R v.2.2.1 and S-Plus v. 7.0

Paolo Ghisletta
Dear R-Users,

I am comparing the nlme package in S-Plus (v. 7.0) and R (v. 2.2.1, nlme
package version 3.1-68.1; the lattice, Matrix, and lme4 have also just
been updated today, Jan. 23, 2006) on a PC (2.40 GHz Pentium 4 processor
and 1 GHz RAM) operating on Windows XP. I am using a real data set with
1,191 units with at most 4 repeated measures per unit (data are
incomplete, unbalanced). I use the same code with the same starting
values for both programs and obtain slightly different results. I am
aware that at this stage my model is far from being well specified for
the given data. Nevertheless, I wonder whether one program is more
suited than the other to pursue my modeling.

Below I included the input + output code, first for S-Plus, than for R.

Many thanks and best regards,
Paolo Ghisletta

############
#S-Plus
#min=4, max=41
 > logistic4.a <- nlme(jugs ~ 4 + 41 / (1 + xmid*exp( -scal*I(occ-1) +
u)), fixed=scal+xmid~1, random= u~1 |id, start=c(scal=.2, xmid=155),
data=jug, na.action=na.exclude, method="ML")
 > summary(logistic4.a)
Nonlinear mixed-effects model fit by maximum likelihood
  Model: jugs ~ 4 + 41/(1 + xmid * exp( - scal * I(occ - 1) + u))
 Data: jug
       AIC     BIC    logLik
  29595.62 29621.3 -14793.81

Random effects:
 Formula: u ~ 1 | id
               u Residual
StdDev: 5.162391 3.718887

Fixed effects: scal + xmid ~ 1
        Value Std.Error   DF  t-value p-value
scal   4.9697    0.0823 3339 60.39508  <.0001
xmid 683.5634  125.8509 3339  5.43153  <.0001

Standardized Within-Group Residuals:
       Min         Q1          Med        Q3      Max
 -10.66576 -0.5039498 0.0002772166 0.1226745 5.453209

Number of Observations: 4531
Number of Groups: 1191

############
# R
 > #min=4, max=41
 > logistic4.a <- nlme(jugs ~ 4 + 41 / (1 + xmid*exp( -scal*I(occ-1)+
u)), data=jug, fixed=scal+xmid~1, random= u~1 |id, start=c(scal=.2,
xmid=155), method="ML", na.action=na.exclude)
 > summary(logistic4.a)
Nonlinear mixed-effects model fit by maximum likelihood
  Model: jugs ~ 4 + 41/(1 + xmid * exp(-scal * I(occ - 1) + u))
 Data: jug
       AIC      BIC    logLik
  29678.11 29703.78 -14835.05

Random effects:
 Formula: u ~ 1 | id
               u Residual
StdDev: 5.116542 3.767097

Fixed effects: scal + xmid ~ 1
        Value Std.Error   DF  t-value p-value
scal   4.9244   0.08121 3339 60.63763       0
xmid 633.6956 115.37512 3339  5.49248       0
Erreur dans dim(x) : aucun slot de nom "Dim" pour cet objet de la classe
"correlation"



        [[alternative HTML version deleted]]

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Reply | Threaded
Open this post in threaded view
|

Re: nlme in R v.2.2.1 and S-Plus v. 7.0

Spencer Graves
          I see you got an error message from R.  Did you have both either the
lme4 or the Matrix packages in the search path at the same time you ran
nlme to get the result you got below?  If yes, please rerun with only
nlme in the search path.  (This may not be necessary, but I always quite
R and restart whenever I want to switch between nlme and lme4.)

          If this is not the problem, I would encourage you to experient with
smaller models and data sets to try to find the simplest "toy example"
that still produces the error message you got from summary(nlme(...)),
then submit that to this listserve.  I routinely copy reproducible
examples into R to see if I get the same error message.  Whether I do or
not, I think my comments are much more likely to be helpful than if I
have to guess.  And if I'm guessing about an error message I can't
generate myself at will, my comments may not be very helpful.

          Regarding whether to use S-Plus 7 or R 2.2.1 for this problem, if R
gives you an error message when S-Plus does not, doesn't that answer
your question?  Moreover, the S-Plus logLik is higher than for R, which
suggests that it must get closer to the actual maximum of the likelihood
function.

          If you'd like more help from this listserve, I suggest you PLEASE do
read the posting guide! "www.R-project.org/posting-guide.html".  Doing
so will on average tend to increase the speed and utility of comments
you might receive, I believe.

          hope this helps,
          spencer graves

Paolo Ghisletta wrote:

> Dear R-Users,
>
> I am comparing the nlme package in S-Plus (v. 7.0) and R (v. 2.2.1, nlme
> package version 3.1-68.1; the lattice, Matrix, and lme4 have also just
> been updated today, Jan. 23, 2006) on a PC (2.40 GHz Pentium 4 processor
> and 1 GHz RAM) operating on Windows XP. I am using a real data set with
> 1,191 units with at most 4 repeated measures per unit (data are
> incomplete, unbalanced). I use the same code with the same starting
> values for both programs and obtain slightly different results. I am
> aware that at this stage my model is far from being well specified for
> the given data. Nevertheless, I wonder whether one program is more
> suited than the other to pursue my modeling.
>
> Below I included the input + output code, first for S-Plus, than for R.
>
> Many thanks and best regards,
> Paolo Ghisletta
>
> ############
> #S-Plus
> #min=4, max=41
>  > logistic4.a <- nlme(jugs ~ 4 + 41 / (1 + xmid*exp( -scal*I(occ-1) +
> u)), fixed=scal+xmid~1, random= u~1 |id, start=c(scal=.2, xmid=155),
> data=jug, na.action=na.exclude, method="ML")
>  > summary(logistic4.a)
> Nonlinear mixed-effects model fit by maximum likelihood
>   Model: jugs ~ 4 + 41/(1 + xmid * exp( - scal * I(occ - 1) + u))
>  Data: jug
>        AIC     BIC    logLik
>   29595.62 29621.3 -14793.81
>
> Random effects:
>  Formula: u ~ 1 | id
>                u Residual
> StdDev: 5.162391 3.718887
>
> Fixed effects: scal + xmid ~ 1
>         Value Std.Error   DF  t-value p-value
> scal   4.9697    0.0823 3339 60.39508  <.0001
> xmid 683.5634  125.8509 3339  5.43153  <.0001
>
> Standardized Within-Group Residuals:
>        Min         Q1          Med        Q3      Max
>  -10.66576 -0.5039498 0.0002772166 0.1226745 5.453209
>
> Number of Observations: 4531
> Number of Groups: 1191
>
> ############
> # R
>  > #min=4, max=41
>  > logistic4.a <- nlme(jugs ~ 4 + 41 / (1 + xmid*exp( -scal*I(occ-1)+
> u)), data=jug, fixed=scal+xmid~1, random= u~1 |id, start=c(scal=.2,
> xmid=155), method="ML", na.action=na.exclude)
>  > summary(logistic4.a)
> Nonlinear mixed-effects model fit by maximum likelihood
>   Model: jugs ~ 4 + 41/(1 + xmid * exp(-scal * I(occ - 1) + u))
>  Data: jug
>        AIC      BIC    logLik
>   29678.11 29703.78 -14835.05
>
> Random effects:
>  Formula: u ~ 1 | id
>                u Residual
> StdDev: 5.116542 3.767097
>
> Fixed effects: scal + xmid ~ 1
>         Value Std.Error   DF  t-value p-value
> scal   4.9244   0.08121 3339 60.63763       0
> xmid 633.6956 115.37512 3339  5.49248       0
> Erreur dans dim(x) : aucun slot de nom "Dim" pour cet objet de la classe
> "correlation"
>
>
>
> [[alternative HTML version deleted]]
>
> ______________________________________________
> [hidden email] mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html