MichaelChirico / r-bugs

A ⚠️read-only⚠️mirror of https://bugs.r-project.org/
20 stars 0 forks source link

[BUGZILLA #1533] nls #1340

Closed MichaelChirico closed 4 years ago

MichaelChirico commented 4 years ago

From: scs10@<::CENSORED -- SEE ORIGINAL ON BUGZILLA::>-and.ac.uk Full_Name: Sophie Smout Version: 1.5.0 OS: windows 2000, pc Submission from: (NULL) (138.251.190.17)

I'm finding that nls iterates to the end of its iteration setting and does not jump out to report convergence even when it has clearly converged. It is also mis-reporting the number of iterations completed. These may not be unconnected...

This is an example:

[note - details of my computer, version etc are at the end of this message]

##### some 'data'

x

[1] 1 2 3 4 5 6 7 8 9 10

y

[1] 0.9090909 2.8571429 4.7368421 6.1538462 7.1428571 7.8260870 8.3050847 [8] 8.6486486 8.9010989 9.0909091

### call to nls

nls(y~a*x^m/(1+b*x^m),start=list(a=1.1,m=2.1,b=.11),trace=TRUE)

### nls spits out

1.474151 : 1.10 2.10 0.11 0.01060234 : 1.0092752 1.9893808 0.1012907 5.066689e-07 : 0.9999465 2.0000191 0.0999903 3.651161e-15 : 1.0 2.0 0.1 1.518557e-29 : 1.0 2.0 0.1 8.09815e-30 : 1.0 2.0 0.1 8.09815e-30 : 1.0 2.0 0.1 8.09815e-30 : 1.0 2.0 0.1 8.09815e-30 : 1.0 2.0 0.1 8.09815e-30 : 1.0 2.0 0.1 8.09815e-30 : 1.0 2.0 0.1 8.09815e-30 : 1.0 2.0 0.1 8.09815e-30 : 1.0 2.0 0.1 8.09815e-30 : 1.0 2.0 0.1 8.09815e-30 : 1.0 2.0 0.1 8.09815e-30 : 1.0 2.0 0.1 8.09815e-30 : 1.0 2.0 0.1 8.09815e-30 : 1.0 2.0 0.1 8.09815e-30 : 1.0 2.0 0.1 8.09815e-30 : 1.0 2.0 0.1 8.09815e-30 : 1.0 2.0 0.1 8.09815e-30 : 1.0 2.0 0.1 8.09815e-30 : 1.0 2.0 0.1 8.09815e-30 : 1.0 2.0 0.1 8.09815e-30 : 1.0 2.0 0.1 8.09815e-30 : 1.0 2.0 0.1 8.09815e-30 : 1.0 2.0 0.1 8.09815e-30 : 1.0 2.0 0.1 8.09815e-30 : 1.0 2.0 0.1 8.09815e-30 : 1.0 2.0 0.1 8.09815e-30 : 1.0 2.0 0.1 8.09815e-30 : 1.0 2.0 0.1 8.09815e-30 : 1.0 2.0 0.1 8.09815e-30 : 1.0 2.0 0.1 8.09815e-30 : 1.0 2.0 0.1 8.09815e-30 : 1.0 2.0 0.1 8.09815e-30 : 1.0 2.0 0.1 8.09815e-30 : 1.0 2.0 0.1 8.09815e-30 : 1.0 2.0 0.1 8.09815e-30 : 1.0 2.0 0.1 8.09815e-30 : 1.0 2.0 0.1 8.09815e-30 : 1.0 2.0 0.1 8.09815e-30 : 1.0 2.0 0.1 8.09815e-30 : 1.0 2.0 0.1 8.09815e-30 : 1.0 2.0 0.1 8.09815e-30 : 1.0 2.0 0.1 8.09815e-30 : 1.0 2.0 0.1 8.09815e-30 : 1.0 2.0 0.1 8.09815e-30 : 1.0 2.0 0.1 8.09815e-30 : 1.0 2.0 0.1 8.09815e-30 : 1.0 2.0 0.1 Error in nls(y∼ a x^m/(1 + b x^m), start = list(a = 1.1, m = 2.1, : number of iterations exceeded maximum of 5.27058e-308

### ??? the converged parameter values are correct ### but nls has not reported convergence. Instead it's just gone on iterating, ### but not 5.27058e-308 times, which would in any case be tricky...

### try another simple example ### generate some data

x<-c(1:10)
y<-3*x^2+1
y

[1] 4 13 28 49 76 109 148 193 244 301

x

[1] 1 2 3 4 5 6 7 8 9 10

### call to nls

nls(y~a*x^b+c,start=list(a=1,b=1,c=1))

Error in nls(y∼ a * x^b + c, start = list(a = 1, b = 1, c = 1)) : number of iterations exceeded maximum of 5.27058e-308

### another call to nls with more details requested


nls(y~a*x^b+c,start=list(a=1,b=1,c=1),trace=TRUE,control=nls.control(maxiter=10))

210232 : 1 1 1 209552.9 : 0.3814959 1.4296089 1.7349535 191724.4 : 0.2824096 1.9134931 1.9513585 165276.9 : 0.4484658 1.9827257 1.8983138 125378.7 : 0.7671348 1.9977192 1.7865044 70298.31 : 1.325342 1.999960 1.589895 17571.14 : 2.162671 2.000005 1.294948 4.457052e-06 : 3.0000000 1.9999979 0.9999999 2.200966e-17 : 3 2 1 6.125505e-27 : 3 2 1 6.12235e-27 : 3 2 1 Error in nls(y∼ a * x^b + c, start = list(a = 1, b = 1, c = 1), trace = TRUE, : number of iterations exceeded maximum of 5.27058e-308

#### same problem!! ##############################################

here is what I get when I type 'version' to get details of computer etc.

platform i386-pc-mingw32 arch i386
os mingw32
system i386, mingw32
status
major 1
minor 5.0
year 2002
month 04
day 29
language R
###############################################


METADATA

MichaelChirico commented 4 years ago

From: ripley@<::CENSORED -- SEE ORIGINAL ON BUGZILLA::> The iteration count is being reported incorrectly as a real not an integer, and I've fixed that for 1.5.1.

I can't reproduce your first example, but I suspect the numbers have lost digits. It looks as if the model you are fitting is an exact fit (to machine accuracy). nls() cannot fit exact fits: rounding error gets in the way.

On Thu, 9 May 2002 scs10@<::CENSORED -- SEE ORIGINAL ON BUGZILLA::>-and.ac.uk wrote:

Full_Name: Sophie Smout
Version: 1.5.0
OS: windows 2000, pc
Submission from: (NULL) (138.251.190.17)

I'm finding that nls iterates to the end of its iteration setting and does
not
jump out to report convergence even when it has clearly converged. It is also
mis-reporting the number of iterations completed. These may not be
unconnected...

This is an example:

[note - details of my computer, version etc are at the end of this message]

##### some 'data'

> x
[1]  1  2  3  4  5  6  7  8  9 10

> y
[1] 0.9090909 2.8571429 4.7368421 6.1538462 7.1428571 7.8260870 8.3050847
[8] 8.6486486 8.9010989 9.0909091

### call to nls

> nls(y~a*x^m/(1+b*x^m),start=list(a=1.1,m=2.1,b=.11),trace=TRUE)

### nls spits out

1.474151 :  1.10 2.10 0.11
0.01060234 :  1.0092752 1.9893808 0.1012907
5.066689e-07 :  0.9999465 2.0000191 0.0999903
3.651161e-15 :  1.0 2.0 0.1
1.518557e-29 :  1.0 2.0 0.1
8.09815e-30 :  1.0 2.0 0.1
8.09815e-30 :  1.0 2.0 0.1
8.09815e-30 :  1.0 2.0 0.1
8.09815e-30 :  1.0 2.0 0.1
8.09815e-30 :  1.0 2.0 0.1
8.09815e-30 :  1.0 2.0 0.1
8.09815e-30 :  1.0 2.0 0.1
8.09815e-30 :  1.0 2.0 0.1
8.09815e-30 :  1.0 2.0 0.1
8.09815e-30 :  1.0 2.0 0.1
8.09815e-30 :  1.0 2.0 0.1
8.09815e-30 :  1.0 2.0 0.1
8.09815e-30 :  1.0 2.0 0.1
8.09815e-30 :  1.0 2.0 0.1
8.09815e-30 :  1.0 2.0 0.1
8.09815e-30 :  1.0 2.0 0.1
8.09815e-30 :  1.0 2.0 0.1
8.09815e-30 :  1.0 2.0 0.1
8.09815e-30 :  1.0 2.0 0.1
8.09815e-30 :  1.0 2.0 0.1
8.09815e-30 :  1.0 2.0 0.1
8.09815e-30 :  1.0 2.0 0.1
8.09815e-30 :  1.0 2.0 0.1
8.09815e-30 :  1.0 2.0 0.1
8.09815e-30 :  1.0 2.0 0.1
8.09815e-30 :  1.0 2.0 0.1
8.09815e-30 :  1.0 2.0 0.1
8.09815e-30 :  1.0 2.0 0.1
8.09815e-30 :  1.0 2.0 0.1
8.09815e-30 :  1.0 2.0 0.1
8.09815e-30 :  1.0 2.0 0.1
8.09815e-30 :  1.0 2.0 0.1
8.09815e-30 :  1.0 2.0 0.1
8.09815e-30 :  1.0 2.0 0.1
8.09815e-30 :  1.0 2.0 0.1
8.09815e-30 :  1.0 2.0 0.1
8.09815e-30 :  1.0 2.0 0.1
8.09815e-30 :  1.0 2.0 0.1
8.09815e-30 :  1.0 2.0 0.1
8.09815e-30 :  1.0 2.0 0.1
8.09815e-30 :  1.0 2.0 0.1
8.09815e-30 :  1.0 2.0 0.1
8.09815e-30 :  1.0 2.0 0.1
8.09815e-30 :  1.0 2.0 0.1
8.09815e-30 :  1.0 2.0 0.1
8.09815e-30 :  1.0 2.0 0.1
Error in nls(y ~ a * x^m/(1 + b * x^m), start = list(a = 1.1, m = 2.1,  :
number of iterations exceeded maximum of 5.27058e-308
>
### ??? the converged parameter values are correct
### but nls has not reported convergence. Instead it's just gone on
iterating,
### but not 5.27058e-308 times, which would in any case be tricky...

### try another simple example
### generate some data

> x<-c(1:10)
> y<-3*x^2+1
> y
[1]   4  13  28  49  76 109 148 193 244 301
> x
[1]  1  2  3  4  5  6  7  8  9 10

### call to nls

> nls(y~a*x^b+c,start=list(a=1,b=1,c=1))

Error in nls(y ~ a * x^b + c, start = list(a = 1, b = 1, c = 1)) :
number of iterations exceeded maximum of 5.27058e-308

### another call to nls with more details requested

>
nls(y~a*x^b+c,start=list(a=1,b=1,c=1),trace=TRUE,control=nls.control(maxiter=10))
210232 :  1 1 1
209552.9 :  0.3814959 1.4296089 1.7349535
191724.4 :  0.2824096 1.9134931 1.9513585
165276.9 :  0.4484658 1.9827257 1.8983138
125378.7 :  0.7671348 1.9977192 1.7865044
70298.31 :  1.325342 1.999960 1.589895
17571.14 :  2.162671 2.000005 1.294948
4.457052e-06 :  3.0000000 1.9999979 0.9999999
2.200966e-17 :  3 2 1
6.125505e-27 :  3 2 1
6.12235e-27 :  3 2 1
Error in nls(y ~ a * x^b + c, start = list(a = 1, b = 1, c = 1), trace =
TRUE,
:
number of iterations exceeded maximum of 5.27058e-308

#### same problem!!
##############################################

here is what I get when I type 'version'
to get details of computer etc.

platform i386-pc-mingw32
arch     i386
os       mingw32
system   i386, mingw32
status
major    1
minor    5.0
year     2002
month    04
day      29
language R
###############################################

-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-devel 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-devel-request@<::CENSORED -- SEE ORIGINAL ON BUGZILLA::>

_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._

-- Brian D. Ripley, ripley@<::CENSORED -- SEE ORIGINAL ON BUGZILLA::> Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ <CENSORING FROM DETECTED PHONE NUMBER ONWARDS; SEE BUGZILLA>


METADATA

MichaelChirico commented 4 years ago

From: Douglas Bates <bates@<::CENSORED -- SEE ORIGINAL ON BUGZILLA::>> Your results are not reproducible

library(nls)
x = 1:10
y = c(0.9090909, 2.8571429, 4.7368421, 6.1538462, 7.1428571, 7.8260870,
8.3050847, 8.6486486, 8.9010989, 9.0909091)
nls(y~a*x^m/(1+b*x^m),start=list(a=1.1,m=2.1,b=.11),trace=TRUE)

1.474151 : 1.10 2.10 0.11 0.01060234 : 1.0092752 1.9893808 0.1012907 5.066695e-07 : 0.9999465 2.0000191 0.0999903 1.421765e-14 : 1.0 2.0 0.1 1.056486e-14 : 1.0 2.0 0.1 Nonlinear regression model model: y∼ a x^m/(1 + b x^m) data: parent.frame a m b 1.0 2.0 0.1 residual sum-of-squares: 1.056486e-14

You are encountering a well-known anomaly which occurs only in artificial examples with a zero residual sum of squares. The statistical model to be fit with nls is y = f(x, theta) + eps but your data are y = f(x, theta)

If there is any noise in the data, such as created from my copying and pasting above, nls performs correctly.

scs10@<::CENSORED -- SEE ORIGINAL ON BUGZILLA::>-and.ac.uk writes:

Full_Name: Sophie Smout
Version: 1.5.0
OS: windows 2000, pc
Submission from: (NULL) (138.251.190.17)

I'm finding that nls iterates to the end of its iteration setting and does
not
jump out to report convergence even when it has clearly converged. It is also
mis-reporting the number of iterations completed. These may not be
unconnected...

This is an example:

[note - details of my computer, version etc are at the end of this message]

##### some 'data'

> x
[1]  1  2  3  4  5  6  7  8  9 10

> y
[1] 0.9090909 2.8571429 4.7368421 6.1538462 7.1428571 7.8260870 8.3050847
[8] 8.6486486 8.9010989 9.0909091

### call to nls

> nls(y~a*x^m/(1+b*x^m),start=list(a=1.1,m=2.1,b=.11),trace=TRUE)

### nls spits out

1.474151 :  1.10 2.10 0.11 
0.01060234 :  1.0092752 1.9893808 0.1012907 
5.066689e-07 :  0.9999465 2.0000191 0.0999903 
3.651161e-15 :  1.0 2.0 0.1 
1.518557e-29 :  1.0 2.0 0.1 
8.09815e-30 :  1.0 2.0 0.1 
8.09815e-30 :  1.0 2.0 0.1 
8.09815e-30 :  1.0 2.0 0.1 
8.09815e-30 :  1.0 2.0 0.1 
8.09815e-30 :  1.0 2.0 0.1 
8.09815e-30 :  1.0 2.0 0.1 
8.09815e-30 :  1.0 2.0 0.1 
8.09815e-30 :  1.0 2.0 0.1 
8.09815e-30 :  1.0 2.0 0.1 
8.09815e-30 :  1.0 2.0 0.1 
8.09815e-30 :  1.0 2.0 0.1 
8.09815e-30 :  1.0 2.0 0.1 
8.09815e-30 :  1.0 2.0 0.1 
8.09815e-30 :  1.0 2.0 0.1 
8.09815e-30 :  1.0 2.0 0.1 
8.09815e-30 :  1.0 2.0 0.1 
8.09815e-30 :  1.0 2.0 0.1 
8.09815e-30 :  1.0 2.0 0.1 
8.09815e-30 :  1.0 2.0 0.1 
8.09815e-30 :  1.0 2.0 0.1 
8.09815e-30 :  1.0 2.0 0.1 
8.09815e-30 :  1.0 2.0 0.1 
8.09815e-30 :  1.0 2.0 0.1 
8.09815e-30 :  1.0 2.0 0.1 
8.09815e-30 :  1.0 2.0 0.1 
8.09815e-30 :  1.0 2.0 0.1 
8.09815e-30 :  1.0 2.0 0.1 
8.09815e-30 :  1.0 2.0 0.1 
8.09815e-30 :  1.0 2.0 0.1 
8.09815e-30 :  1.0 2.0 0.1 
8.09815e-30 :  1.0 2.0 0.1 
8.09815e-30 :  1.0 2.0 0.1 
8.09815e-30 :  1.0 2.0 0.1 
8.09815e-30 :  1.0 2.0 0.1 
8.09815e-30 :  1.0 2.0 0.1 
8.09815e-30 :  1.0 2.0 0.1 
8.09815e-30 :  1.0 2.0 0.1 
8.09815e-30 :  1.0 2.0 0.1 
8.09815e-30 :  1.0 2.0 0.1 
8.09815e-30 :  1.0 2.0 0.1 
8.09815e-30 :  1.0 2.0 0.1 
8.09815e-30 :  1.0 2.0 0.1 
8.09815e-30 :  1.0 2.0 0.1 
8.09815e-30 :  1.0 2.0 0.1 
8.09815e-30 :  1.0 2.0 0.1 
8.09815e-30 :  1.0 2.0 0.1 
Error in nls(y ~ a * x^m/(1 + b * x^m), start = list(a = 1.1, m = 2.1,  : 
number of iterations exceeded maximum of 5.27058e-308
> 
### ??? the converged parameter values are correct
### but nls has not reported convergence. Instead it's just gone on
iterating,
### but not 5.27058e-308 times, which would in any case be tricky...

### try another simple example
### generate some data 

> x<-c(1:10)
> y<-3*x^2+1
> y
[1]   4  13  28  49  76 109 148 193 244 301
> x
[1]  1  2  3  4  5  6  7  8  9 10

### call to nls

> nls(y~a*x^b+c,start=list(a=1,b=1,c=1))

Error in nls(y ~ a * x^b + c, start = list(a = 1, b = 1, c = 1)) : 
number of iterations exceeded maximum of 5.27058e-308

### another call to nls with more details requested

>
nls(y~a*x^b+c,start=list(a=1,b=1,c=1),trace=TRUE,control=nls.control(maxiter=10))
210232 :  1 1 1 
209552.9 :  0.3814959 1.4296089 1.7349535 
191724.4 :  0.2824096 1.9134931 1.9513585 
165276.9 :  0.4484658 1.9827257 1.8983138 
125378.7 :  0.7671348 1.9977192 1.7865044 
70298.31 :  1.325342 1.999960 1.589895 
17571.14 :  2.162671 2.000005 1.294948 
4.457052e-06 :  3.0000000 1.9999979 0.9999999 
2.200966e-17 :  3 2 1 
6.125505e-27 :  3 2 1 
6.12235e-27 :  3 2 1 
Error in nls(y ~ a * x^b + c, start = list(a = 1, b = 1, c = 1), trace =
TRUE, 
: 
number of iterations exceeded maximum of 5.27058e-308

#### same problem!!
##############################################

here is what I get when I type 'version'
to get details of computer etc.

platform i386-pc-mingw32
arch     i386           
os       mingw32        
system   i386, mingw32  
status                  
major    1              
minor    5.0            
year     2002           
month    04             
day      29             
language R   
###############################################

-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-devel 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-devel-request@<::CENSORED -- SEE ORIGINAL ON BUGZILLA::>

_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._

-- Douglas Bates bates@<::CENSORED -- SEE ORIGINAL ON BUGZILLA::> Statistics Department 608/262-2598 University of Wisconsin - Madison http://www.stat.wisc.edu/~bates/


METADATA

MichaelChirico commented 4 years ago

From: Ben Bolker <ben@<::CENSORED -- SEE ORIGINAL ON BUGZILLA::>>

OK, this is a FAQ (perhaps it should be added as a "Note" in the nls documentation??):

nls() uses convergence criteria that don't work well for artificial data where the fit is perfect (but work reasonably well for "real" data -- it's a reasonable tradeoff) There may still be a "bug" in nls() in terms of what it actually reports (it should still report what it is doing correctly, even in a pathological case). Try

ys <- y+rnorm(10,sd=0.001) nls(y∼ax^m/(1+bx^m),start=list(a=1.1,m=2.1,b=.11),trace=TRUE)

See: http://maths.newcastle.edu.au/~rking/R/devel/00b/0102.html (and following thread) http://maths.newcastle.edu.au/~rking/R/help/00b/2547.html (one-paragraph comment at the end)

On Thu, 9 May 2002 scs10@<::CENSORED -- SEE ORIGINAL ON BUGZILLA::>-and.ac.uk wrote:

Full_Name: Sophie Smout
Version: 1.5.0
OS: windows 2000, pc
Submission from: (NULL) (138.251.190.17)

I'm finding that nls iterates to the end of its iteration setting and does
not
jump out to report convergence even when it has clearly converged. It is also
mis-reporting the number of iterations completed. These may not be
unconnected...

This is an example:

[note - details of my computer, version etc are at the end of this message]

##### some 'data'

> x
[1]  1  2  3  4  5  6  7  8  9 10

> y
[1] 0.9090909 2.8571429 4.7368421 6.1538462 7.1428571 7.8260870 8.3050847
[8] 8.6486486 8.9010989 9.0909091

### call to nls

> nls(y~a*x^m/(1+b*x^m),start=list(a=1.1,m=2.1,b=.11),trace=TRUE)

### nls spits out

1.474151 :  1.10 2.10 0.11
0.01060234 :  1.0092752 1.9893808 0.1012907
5.066689e-07 :  0.9999465 2.0000191 0.0999903
3.651161e-15 :  1.0 2.0 0.1
1.518557e-29 :  1.0 2.0 0.1
8.09815e-30 :  1.0 2.0 0.1
8.09815e-30 :  1.0 2.0 0.1
8.09815e-30 :  1.0 2.0 0.1
8.09815e-30 :  1.0 2.0 0.1
8.09815e-30 :  1.0 2.0 0.1
8.09815e-30 :  1.0 2.0 0.1
8.09815e-30 :  1.0 2.0 0.1
8.09815e-30 :  1.0 2.0 0.1
8.09815e-30 :  1.0 2.0 0.1
8.09815e-30 :  1.0 2.0 0.1
8.09815e-30 :  1.0 2.0 0.1
8.09815e-30 :  1.0 2.0 0.1
8.09815e-30 :  1.0 2.0 0.1
8.09815e-30 :  1.0 2.0 0.1
8.09815e-30 :  1.0 2.0 0.1
8.09815e-30 :  1.0 2.0 0.1
8.09815e-30 :  1.0 2.0 0.1
8.09815e-30 :  1.0 2.0 0.1
8.09815e-30 :  1.0 2.0 0.1
8.09815e-30 :  1.0 2.0 0.1
8.09815e-30 :  1.0 2.0 0.1
8.09815e-30 :  1.0 2.0 0.1
8.09815e-30 :  1.0 2.0 0.1
8.09815e-30 :  1.0 2.0 0.1
8.09815e-30 :  1.0 2.0 0.1
8.09815e-30 :  1.0 2.0 0.1
8.09815e-30 :  1.0 2.0 0.1
8.09815e-30 :  1.0 2.0 0.1
8.09815e-30 :  1.0 2.0 0.1
8.09815e-30 :  1.0 2.0 0.1
8.09815e-30 :  1.0 2.0 0.1
8.09815e-30 :  1.0 2.0 0.1
8.09815e-30 :  1.0 2.0 0.1
8.09815e-30 :  1.0 2.0 0.1
8.09815e-30 :  1.0 2.0 0.1
8.09815e-30 :  1.0 2.0 0.1
8.09815e-30 :  1.0 2.0 0.1
8.09815e-30 :  1.0 2.0 0.1
8.09815e-30 :  1.0 2.0 0.1
8.09815e-30 :  1.0 2.0 0.1
8.09815e-30 :  1.0 2.0 0.1
8.09815e-30 :  1.0 2.0 0.1
8.09815e-30 :  1.0 2.0 0.1
8.09815e-30 :  1.0 2.0 0.1
8.09815e-30 :  1.0 2.0 0.1
8.09815e-30 :  1.0 2.0 0.1
Error in nls(y ~ a * x^m/(1 + b * x^m), start = list(a = 1.1, m = 2.1,  :
number of iterations exceeded maximum of 5.27058e-308
>
### ??? the converged parameter values are correct
### but nls has not reported convergence. Instead it's just gone on
iterating,
### but not 5.27058e-308 times, which would in any case be tricky...

### try another simple example
### generate some data

> x<-c(1:10)
> y<-3*x^2+1
> y
[1]   4  13  28  49  76 109 148 193 244 301
> x
[1]  1  2  3  4  5  6  7  8  9 10

### call to nls

> nls(y~a*x^b+c,start=list(a=1,b=1,c=1))

Error in nls(y ~ a * x^b + c, start = list(a = 1, b = 1, c = 1)) :
number of iterations exceeded maximum of 5.27058e-308

### another call to nls with more details requested

>
nls(y~a*x^b+c,start=list(a=1,b=1,c=1),trace=TRUE,control=nls.control(maxiter=10))
210232 :  1 1 1
209552.9 :  0.3814959 1.4296089 1.7349535
191724.4 :  0.2824096 1.9134931 1.9513585
165276.9 :  0.4484658 1.9827257 1.8983138
125378.7 :  0.7671348 1.9977192 1.7865044
70298.31 :  1.325342 1.999960 1.589895
17571.14 :  2.162671 2.000005 1.294948
4.457052e-06 :  3.0000000 1.9999979 0.9999999
2.200966e-17 :  3 2 1
6.125505e-27 :  3 2 1
6.12235e-27 :  3 2 1
Error in nls(y ~ a * x^b + c, start = list(a = 1, b = 1, c = 1), trace =
TRUE,
:
number of iterations exceeded maximum of 5.27058e-308

#### same problem!!
##############################################

here is what I get when I type 'version'
to get details of computer etc.

platform i386-pc-mingw32
arch     i386
os       mingw32
system   i386, mingw32
status
major    1
minor    5.0
year     2002
month    04
day      29
language R
###############################################

-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-devel 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-devel-request@<::CENSORED -- SEE ORIGINAL ON BUGZILLA::>

_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._

-- 318 Carr Hall bolker@<::CENSORED -- SEE ORIGINAL ON BUGZILLA::> Zoology Department, University of Florida http://www.zoo.ufl.edu/bolker <CENSORING FROM DETECTED PHONE NUMBER ONWARDS; SEE BUGZILLA>


METADATA

MichaelChirico commented 4 years ago

From: Douglas Bates <bates@<::CENSORED -- SEE ORIGINAL ON BUGZILLA::>> Ben Bolker <ben@<::CENSORED -- SEE ORIGINAL ON BUGZILLA::>> writes:

OK, this is a FAQ (perhaps it should be added as a "Note" in the nls
documentation??):

Agreed! I am in the process of doing so.


METADATA

MichaelChirico commented 4 years ago

NOTES: 1) maxIter has formeated as double is fixed for 1.5.1 2) documentation has added warning


METADATA

MichaelChirico commented 4 years ago

Audit (from Jitterbug): Fri May 10 08:14:32 2002 ripley changed notes Fri May 10 08:14:32 2002 ripley foobar Fri May 10 08:14:32 2002 ripley moved from incoming to Add-ons-fixed


METADATA