Hi Rainer,

Sorry, I hadn't read your post quite carefully enough.
The problem appears to be with SSlogis. It seems that
control parameters are not being passed through SSlogis.
If you specify a start vector, minFactor can be set.

  nls( y ~ Asym/(1+exp((xmid-x)/scal)), data = dat,
  start=list(Asym=2e6, xmid=2005, scal=44),
  control=list(minFactor=1e-12), trace=TRUE)

or even

  nls( y ~ SSlogis(x, Asym, xmid, scal), data = dat,
  start=list(Asym=2e6, xmid=2005, scal=44),
  control=list(minFactor=1e-12), trace=TRUE)

or perhaps (but it still won't converge, of course)

  nls( y ~ 1/(1+exp((xmid-x)/scal)), data = dat,
  start=list(xmid=2005, scal=44), algorithm = "plinear",
  control=list(minFactor=1e-12), trace=TRUE)

(I used start values obtained from a fit of dat[-c(1,2),].)

Try it with minFactor=1/4 and with 1/2^20.

 -Peter Ehlers

Rainer M Krug wrote:
On Fri, Oct 2, 2009 at 7:23 PM, Peter Ehlers <ehl...@ucalgary.ca> wrote:

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.


Hi Peter

partly - when I do as you suggest, it definitely works, but this does not
change the behavioyur, that the error message always says:

" step factor 0.000488281 reduced below 'minFactor' of 0.000976562"

and it does not change to whichever value I try to set minFactor.
So either I am misunderstanding what the control argument for nls is doing,
or there is a bug in nls or in the error message.

Rainer




 -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)







______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to