[R] nls
Jost Burkardt
jost.burkardt at web.de
Wed Nov 8 19:17:54 CET 2006
Xiaodong Jin <close2ceo at yahoo.com> writes:
>> y
> [1] 1 11 42 64 108 173 214
>
> > t
> [1] 1 2 3 4 5 6 7
>
> > nls(1/y ~ c*exp(-a*b*t)+1/b, start=list(a=0.001,b=250,c=5), trace=TRUE)
> 29.93322 : 0.001 250.000 5.000
> Error in numericDeriv(form[[3]], names(ind), env) :
> Missing value or an infinity produced when evaluating the model
>
> # the start value for b is almost close to final estimates,
> # a is usually small positive close to 0
> # c is a positive number
> # Do I need different estimation method?
>
> Regards
> xj
nls fails because it tests large negative parameter value for b (maybe
because of the product a*b). I got around this by using this
reparametrized version
nls(1/y ~ c*exp(-a2*t)+b2, start=list(a2=0.001*250,b2=1/250,c=5), trace=TRUE)
Nonlinear regression model
model: 1/y ~ c * exp(-a2 * t) + b2
data: parent.frame()
a2 b2 c
2.49029199 0.01010844 11.94220446
residual sum-of-squares: 0.0001228177
Regards,
Jost
More information about the R-help
mailing list