[R] nls works but not gnls

Douglas Bates bates at stat.wisc.edu
Fri Jun 1 23:04:41 CEST 2001


"Antonio Olinto" <aolinto at bignet.com.br> writes:

> I had a similar problem with using gnls with a three-column data.frame like
> this (Li is a
> back-calculated length at age for each fish):
> 
>  Fish      Age            Li
>  1          1            110.17
>  1          2            143.61
>  1          3            180.47
>  1          4            218.97
>  1          5            257.12
>  1          6            299.22
>  1          7            328.16
>  2          1            100.36
>  2          2            131.09
>  2          3            171.42
>  2          4            213.08
>  ..
> 
> Writing:
> 
>  vbmale <- gnls(Li ~ Linf*(1-exp(-K*(Age-t0))), data=male, params= Linf +K +
> t0 ~ 1, start=list(Linf=1000,K=0.1,t0=0), control = list(returnObject = T),
> corr = corAR1(form=~Age|Fish))
> 
> I got:
> 
>  Error in [<-.factor(*tmp*, , value = grpShrunk[revOrderShrunk]) : Argument
>  "i" is missing, with no default
>  In addition: Warning message:
>  Step halving factor reduced below minimum in NLS step in: gnls(Li ~ Linf
>  *(1 - exp(-K * (Age - t0))), data = male, params = Linf +
> 
> Using the same data in S-Plus, a colleague of mine had the output:
> 
>  vbmale
> Generalized nonlinear least squares fit
>    Model: Li ~ Linf * (1 - exp( - K * (Age - t0)))
>    Data: male
>    Log-likelihood: -7515.22
> 
>  Coefficients:
>      Linf          K                    t0
>  1412.352      0.04403359   -0.6916286
> 
>  Correlation Structure: AR(1)
>   Formula:  ~ Age| Fish
>   Parameter estimate(s):
>         Phi
>   0.9660297
>  Degrees of freedom: 1803 total; 1800 residual
>  Residual standard error: 54.37347
> 
> Is there a bug? I would like to hear comments too.

Probably - but I just don't have time to debug it right now.
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._



More information about the R-help mailing list