Rogers, James A [PGRD Groton]
2004-May-06 21:04 UTC
[R] sporadic errors with nlrq() / optim()
Dear List, Apologies if this is a known problem ... I wasn't able to find it on the bug list, but it is a problem that does not seem to occur with a MAC build of R 2.0, so perhaps this problem has already been addressed for the future. I am getting *sporadic* errors when refitting the same model to the same data set, using nlrq() in the nlrq package. The algorithm is not stochastic, so I would expect to get errors either every time, or never. ### library(stats) # or library(nls) if using R < 1.9.0 library(nlrq) test <- data.frame(x = c(7.60090245954208, 6.90775527898214, 6.21460809842219, 5.52146091786225, 4.60517018598809, 3.91202300542815, 3.2188758248682 , 2.52572864430826, 1.83258146374831, 7.60090245954208, 6.90775527898214, 6.21460809842219, 5.52146091786225, 4.60517018598809, 3.91202300542815, 3.2188758248682 , 2.52572864430826, 1.83258146374831, 6.21460809842219, 6.21460809842219), y = c( 11.0161506644269, 9.84267541313937, 8.66146668057266, 7.48099216286952, 6.50578406012823, 6.24027584517077, 5.63121178182137, 5.71702770140622, 5.64190707093811, 10.8983676287705, 9.91857318995417, 8.74608021735751, 7.58120982619635, 6.361302477573 , 5.91889385427315, 5.63835466933375 , 5.80211837537706, 5.64897423816121, 8.6195692580331 , 8.70367275835886) ) i <- 1 while(i < 500) { # I usually hit an error within 50 iterations cat(i, "\n") nlrq(y ~ SSfpl(x, A, B, xmid, scal), data = test) i <- i + 1 } ### Errors occur with version 1.8.1 and 1.9.0 on both Windows (two different machines) and UNIX, but not on version 2.0 on a MAC (these are the only R version - OS permutations I was able to get reports on easily). Anyone understand what is happening here? Thanks, Jim LEGAL NOTICE\ Unless expressly stated otherwise, this messag...{{dropped}}
"Rogers, James A [PGRD Groton]" <James_A_Rogers at groton.pfizer.com> writes:> Dear List, > > Apologies if this is a known problem ... I wasn't able to find it on the bug > list, but it is a problem that does not seem to occur with a MAC build of R > 2.0, so perhaps this problem has already been addressed for the future. > > I am getting *sporadic* errors when refitting the same model to the same > data set, using nlrq() in the nlrq package. The algorithm is not stochastic, > so I would expect to get errors either every time, or never. > > ### > > library(stats) # or library(nls) if using R < 1.9.0 > library(nlrq) > > test <- data.frame(x = c(7.60090245954208, 6.90775527898214, > 6.21460809842219, 5.52146091786225, 4.60517018598809, 3.91202300542815, > 3.2188758248682 , 2.52572864430826, 1.83258146374831, 7.60090245954208, > 6.90775527898214, 6.21460809842219, 5.52146091786225, 4.60517018598809, > 3.91202300542815, 3.2188758248682 , 2.52572864430826, 1.83258146374831, > 6.21460809842219, 6.21460809842219), > y = c( 11.0161506644269, 9.84267541313937, > 8.66146668057266, 7.48099216286952, 6.50578406012823, 6.24027584517077, > 5.63121178182137, 5.71702770140622, 5.64190707093811, 10.8983676287705, > 9.91857318995417, 8.74608021735751, 7.58120982619635, 6.361302477573 , > 5.91889385427315, 5.63835466933375 , 5.80211837537706, 5.64897423816121, > 8.6195692580331 , 8.70367275835886) > ) > > i <- 1 > while(i < 500) { # I usually hit an error within 50 iterations > cat(i, "\n") > nlrq(y ~ SSfpl(x, A, B, xmid, scal), data = test) > i <- i + 1 > } > > ### > > Errors occur with version 1.8.1 and 1.9.0 on both Windows (two different > machines) and UNIX, but not on version 2.0 on a MAC (these are the only R > version - OS permutations I was able to get reports on easily). > > Anyone understand what is happening here?There's no "version 2.0", only "2.0.0 Under development (unstable)". If you look at the NEWS file for that version (or for 1.9.0-patched) under 1.9.1 changes, you'll find o The L-BFGS-B option of optim() apparently needs part of its workspace zeroed. (PR#6720) which gave problems of the sort you experiences. -- O__ ---- Peter Dalgaard Blegdamsvej 3 c/ /'_ --- Dept. of Biostatistics 2200 Cph. N (*) \(*) -- University of Copenhagen Denmark Ph: (+45) 35327918 ~~~~~~~~~~ - (p.dalgaard at biostat.ku.dk) FAX: (+45) 35327907