[R] About nls.

Jianling Fan fanjianling at gmail.com
Thu Jul 30 21:51:22 CEST 2015


Hello,

I am trying to do a nls regression with R.  but I always get a error
as "Error in numericDeriv(form[[3L]], names(ind), env) :  Missing
value or an infinity produced when evaluating the model".  I googled
it and found someone said it is because of the improper start value. I
tried many times but can not solve it. Does anyone can help me?

thanks a lot !

my code is:

fit1<-nls2(lnd~log(1/(den1/R1+den2+den3+den4+den5/R5)-1)/c+log(d50),
              start=c(R1=0.9, R5=23, c=-1.1, d50=10), data=SWrt)

data (SWrt) is:

  Depth      lnd   den1 den2 den3 den4   den5
1     20 2.995732 0.4190 0.00 0.00 0.00   0.00
2     40 3.688879 0.6725 0.00 0.00 0.00   0.00
3     60 4.094345 0.8780 0.00 0.00 0.00   0.00
4     80 4.382027 0.9660 0.00 0.00 0.00   0.00
5    100 4.605170 0.9990 0.00 0.00 0.00   0.00
6     15 2.708050 0.0000 0.38 0.00 0.00   0.00
7     30 3.401197 0.0000 0.48 0.00 0.00   0.00
8     45 3.806662 0.0000 0.85 0.00 0.00   0.00
9     60 4.094345 0.0000 0.88 0.00 0.00   0.00
10   120 4.787492 0.0000 1.00 0.00 0.00   0.00
11    15 2.708050 0.0000 0.00 0.48 0.00   0.00
12    30 3.401197 0.0000 0.00 0.89 0.00   0.00
13    45 3.806662 0.0000 0.00 0.98 0.00   0.00
14    60 4.094345 0.0000 0.00 0.99 0.00   0.00
15   120 4.787492 0.0000 0.00 1.00 0.00   0.00
16    15 2.708050 0.0000 0.00 0.00 0.20   0.00
17    30 3.401197 0.0000 0.00 0.00 0.39   0.00
18    45 3.806662 0.0000 0.00 0.00 0.69   0.00
19    60 4.094345 0.0000 0.00 0.00 0.99   0.00
20   120 4.787492 0.0000 0.00 0.00 1.00   0.00
21    10 2.302585 0.0000 0.00 0.00 0.00 139.50
22    30 3.401197 0.0000 0.00 0.00 0.00 227.85
23    50 3.912023 0.0000 0.00 0.00 0.00 306.90
24    70 4.248495 0.0000 0.00 0.00 0.00 381.30
25    90 4.499810 0.0000 0.00 0.00 0.00 432.45
26   110 4.700480 0.0000 0.00 0.00 0.00 455.70



More information about the R-help mailing list