Hi I want to change a control parameter for an nls () as I am getting an error message "step factor 0.000488281 reduced below 'minFactor' of 0.000976562". Despite all tries, it seems that the control parameter of the nls, does not seem to get handed down to the function itself, or the error message is using a different one. Below system info and an example highlighting the problem. Thanks, Rainer> version _platform i486-pc-linux-gnu arch i486 os linux-gnu system i486, linux-gnu status major 2 minor 9.2 year 2009 month 08 day 24 svn rev 49384 language R version.string R version 2.9.2 (2009-08-24)> sessionInfo()R version 2.9.2 (2009-08-24) i486-pc-linux-gnu locale: LC_CTYPE=en_ZA.UTF-8;LC_NUMERIC=C;LC_TIME=en_ZA.UTF-8;LC_COLLATE=en_ZA.UTF-8;LC_MONETARY=C;LC_MESSAGES=en_ZA.UTF-8;LC_PAPER=en_ZA.UTF-8;LC_NAME=C;LC_ADDRESS=C;LC_TELEPHONE=C;LC_MEASUREMENT=en_ZA.UTF-8;LC_IDENTIFICATION=C attached base packages: [1] stats graphics grDevices utils datasets methods base other attached packages: [1] R.utils_1.2.0 R.oo_1.5.0 R.methodsS3_1.0.3 maptools_0.7-26 [5] sp_0.9-44 foreign_0.8-37 loaded via a namespace (and not attached): [1] grid_2.9.2 lattice_0.17-25 ############################################# EXAMPLE: dat <- data.frame( x = 2006:2037, y = c(143088, 140218, 137964, 138313, 140005, 141483, 142365, 144114, 145335, 146958, 148584, 149398, 151074, 152241, 153919, 155580, 157258, 158981, 160591, 162126, 163743, 165213, 166695, 168023, 169522, 170746, 172057, 173287, 173977, 175232, 176308, 177484) ) nls( y ~ SSlogis(x, Asym, xmid, scal), data = dat, trace=TRUE) (newMinFactor <- 1/(4*1024)) nls( y ~ SSlogis(x, Asym, xmid, scal), data = dat, control=nls.control(minFactor=newMinFactor), trace=TRUE) nls( y ~ SSlogis(x, Asym, xmid, scal), data = dat, control=c(minFactor=newMinFactor), trace=TRUE) (newMinFactor <- 4/1024) nls( y ~ SSlogis(x, Asym, xmid, scal), data = dat, control=nls.control(minFactor=newMinFactor), trace=TRUE) nls( y ~ SSlogis(x, Asym, xmid, scal), data = dat, control=c(minFactor=newMinFactor), trace=TRUE) -- Rainer M. Krug, PhD (Conservation Ecology, SUN), MSc (Conservation Biology, UCT), Dipl. Phys. (Germany) Centre of Excellence for Invasion Biology Natural Sciences Building Office Suite 2039 Stellenbosch University Main Campus, Merriman Avenue Stellenbosch South Africa Cell: +27 - (0)83 9479 042 Fax: +27 - (0)86 516 2782 Fax: +49 - (0)721 151 334 888 email: Rainer@krugs.de Skype: RMkrug Google: R.M.Krug@gmail.com [[alternative HTML version deleted]]
Hello Rainer, I think that your problem is with trying to fit a logistic model to data that don't support that model. Removing the first two points from your data will work (but of course it may not represent reality). The logistic function does not exhibit the kind of minimum that your data suggest. -Peter Ehlers Rainer M Krug wrote:> Hi > > I want to change a control parameter for an nls () as I am getting an error > message "step factor 0.000488281 reduced below 'minFactor' of 0.000976562". > Despite all tries, it seems that the control parameter of the nls, does not > seem to get handed down to the function itself, or the error message is > using a different one. > > Below system info and an example highlighting the problem. > > Thanks, > > Rainer > > >> version _ > platform i486-pc-linux-gnu > arch i486 > os linux-gnu > system i486, linux-gnu > status > major 2 > minor 9.2 > year 2009 > month 08 > day 24 > svn rev 49384 > language R > version.string R version 2.9.2 (2009-08-24) > >> sessionInfo() > R version 2.9.2 (2009-08-24) > i486-pc-linux-gnu > > locale: > LC_CTYPE=en_ZA.UTF-8;LC_NUMERIC=C;LC_TIME=en_ZA.UTF-8;LC_COLLATE=en_ZA.UTF-8;LC_MONETARY=C;LC_MESSAGES=en_ZA.UTF-8;LC_PAPER=en_ZA.UTF-8;LC_NAME=C;LC_ADDRESS=C;LC_TELEPHONE=C;LC_MEASUREMENT=en_ZA.UTF-8;LC_IDENTIFICATION=C > > attached base packages: > [1] stats graphics grDevices utils datasets methods base > > other attached packages: > [1] R.utils_1.2.0 R.oo_1.5.0 R.methodsS3_1.0.3 maptools_0.7-26 > [5] sp_0.9-44 foreign_0.8-37 > > loaded via a namespace (and not attached): > [1] grid_2.9.2 lattice_0.17-25 > > > ############################################# > > EXAMPLE: > > dat <- data.frame( > x = 2006:2037, > y = c(143088, 140218, 137964, > 138313, 140005, 141483, 142365, > 144114, 145335, 146958, 148584, > 149398, 151074, 152241, 153919, > 155580, 157258, 158981, 160591, > 162126, 163743, 165213, 166695, > 168023, 169522, 170746, 172057, > 173287, 173977, 175232, 176308, > 177484) > ) > > nls( y ~ SSlogis(x, Asym, xmid, scal), data = dat, trace=TRUE) > > (newMinFactor <- 1/(4*1024)) > nls( y ~ SSlogis(x, Asym, xmid, scal), data = dat, > control=nls.control(minFactor=newMinFactor), trace=TRUE) > nls( y ~ SSlogis(x, Asym, xmid, scal), data = dat, > control=c(minFactor=newMinFactor), trace=TRUE) > > > (newMinFactor <- 4/1024) > nls( y ~ SSlogis(x, Asym, xmid, scal), data = dat, > control=nls.control(minFactor=newMinFactor), trace=TRUE) > nls( y ~ SSlogis(x, Asym, xmid, scal), data = dat, > control=c(minFactor=newMinFactor), trace=TRUE) > > >