I am running nls models in R on several different datasets, using the self-starting Weibull Growth Curve function, e.g.
MOD <- nls(Response ~ SSweibull(Time, Asym, Drop, lrc, pwr), data = DATA)
With data like this, it works as expected:
GOOD.DATA <- data.frame("Time" = c(1:150), "Response" = c(31.2, 20.0, 44.3, 35.2,
31.4, 27.5, 24.1, 25.9, 23.3, 21.2, 21.3, 19.8, 18.4, 17.3, 16.3, 16.3,
16.6, 15.9, 15.9, 15.8, 15.1, 15.6, 15.1, 14.5, 14.2, 14.2, 13.7, 14.1,
13.7, 13.4, 13.0, 12.6, 12.3, 12.0, 11.7, 11.4, 11.1, 11.0, 10.8, 10.6,
10.4, 10.1, 11.6, 12.0, 11.9, 11.7, 11.5, 11.2, 11.5, 11.3, 11.1, 10.9,
10.9, 11.4, 11.2, 11.1, 10.9, 10.9, 10.7, 10.7, 10.5, 10.4, 10.4, 10.3,
10.1, 10.0, 9.9, 9.7, 9.6, 9.7, 9.6, 9.5, 9.5, 9.4, 9.3, 9.2, 9.1, 9.0,
8.9, 9.0, 8.9, 8.8, 8.8, 8.7, 8.6, 8.5, 8.4, 8.3, 8.3, 8.2, 8.1, 8.0,
8.0, 8.0, 7.9, 7.9, 7.8, 7.7, 7.6, 7.6, 7.6, 7.6, 7.5, 7.5, 7.5, 7.5,
7.4, 7.4, 7.3, 7.2, 7.2, 7.1, 7.1, 7.0, 7.0, 6.9, 6.9, 6.8, 6.8, 6.7,
6.7, 6.6, 6.6, 6.5, 6.5, 6.4, 6.4, 6.4, 6.3, 6.3, 6.2, 6.2, 6.2, 6.1
6.1, 6.1, 6.0, 6.0, 5.9, 5.9, 5.9, 5.9, 5.8, 5.8, 5.8, 5.8, 5.8, 5.8,
5.8, 5.7))
But with this data set:
BAD.DATA <- data.frame("Time" = c(1:150), "Response" = c(89.8, 67.0,
51.4, 41.2, 39.4, 38.5, 34.3, 30.9, 29.9, 34.8, 32.5, 30.1, 28.5, 27.0,
26.2, 24.7, 23.8, 23.6, 22.6, 22.0, 21.3, 20.7, 20.1, 19.6, 19.0, 18.4,
17.9, 17.5, 17.1, 23.1, 22.4, 21.9, 23.8, 23.2, 22.6, 22.0, 21.6, 21.1,
20.6, 20.1, 19.7, 19.3, 19.0, 19.2, 18.8, 18.5, 18.3, 19.5, 19.1, 18.7,
18.5, 18.3, 18.0, 17.7, 17.5, 17.3, 17.0, 16.7, 16.7, 16.9, 16.6, 16.4,
16.1, 15.9, 15.8, 15.6, 15.4, 15.2, 15.0, 14.8, 14.7, 14.5, 14.4, 14.2,
14.0, 13.9, 13.7, 13.6, 15.4, 15.2, 15.1, 15.0, 14.9, 14.7, 14.6, 14.5,
14.4, 14.3, 14.4, 14.2, 14.1, 14.0, 13.8, 13.7, 13.6, 13.5, 13.4, 13.2,
13.3, 13.2, 13.1, 13.0, 12.9, 12.8, 12.7, 12.6, 12.5, 12.5, 12.4, 12.3,
12.2, 12.1, 12.1, 11.9, 12.8, 12.7, 12.6, 12.5, 12.4, 14.2, 14.1, 14.0,
14.1, 14.0, 13.9, 13.8, 13.7, 13.7, 13.6, 13.5, 13.4, 13.3, 13.3, 13.2,
13.1, 13.0, 12.9, 12.9, 12.8, 12.7, 12.6, 12.9, 12.8, 12.7, 12.6, 12.5,
12.5, 12.4, 12.3, 12.2))
I get the error;
Error in nls(y ~ cbind(1, -exp(-exp(lrc) * x^pwr)), data = xy, algorithm = "plinear",
: step factor 0.000488281 reduced below 'minFactor' of 0.000976562
By including the control
argument I am able to change the minFactor
for GOOD.DATA
:
MOD <- nls(Response ~ SSweibull(Time, Asym, Drop, lrc, pwr), data = GOOD.DATA,
control = nls.control(minFactor = 1/4096))
But the model was running without errors anyway. With BAD.DATA
and several other datasets, including control
has no effect and I just get the same error message.
Questions
How can I change the
minFactor
for theBAD.DATA
?What's causing the error? (i.e. what is it about the data set that triggers the error?)
Will changing the
minFactor
resolve this error, or is this one of R's obscure error messages and it actually indicates a different issue?