Resolving minFactor error when using nls in R
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?
r nls non-linear-regression
add a comment |
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?
r nls non-linear-regression
add a comment |
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?
r nls non-linear-regression
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?
r nls non-linear-regression
r nls non-linear-regression
asked Nov 23 '18 at 8:55
EcologyTomEcologyTom
7741820
7741820
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
It seems the control
option does not work in your case, since the code breaks at getInitial
while self-starting, that is, before using your provided control
parameters. One way would be to try specifying some starting parameters, instead of the naive self-starting. For nls
it is often the case that playing with the initial parameters will make-or-break it, not entirely sure for the specific Weibull case though, but should be the same.
To see that you don't arrive to the actual control
, you can try with nls.control(printEval = T)
and see that there's no print.
Thanks for this. At least it's good to understand why theminFactor
argument was being ignored. I opted for the self-start model because I was struggling to find reasonable start values. It is so sensitive to the start values that I end up with the same error, even once I've increased themaxiter
to 10,000.
– EcologyTom
Nov 23 '18 at 10:57
For the future, in many cases tryingdebugonce()
, i.e.,debugonce(nls)
, and seeing what happens inside the code is a good start to see why something doesn't work
– Nutle
Nov 23 '18 at 10:59
add a comment |
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53443377%2fresolving-minfactor-error-when-using-nls-in-r%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
It seems the control
option does not work in your case, since the code breaks at getInitial
while self-starting, that is, before using your provided control
parameters. One way would be to try specifying some starting parameters, instead of the naive self-starting. For nls
it is often the case that playing with the initial parameters will make-or-break it, not entirely sure for the specific Weibull case though, but should be the same.
To see that you don't arrive to the actual control
, you can try with nls.control(printEval = T)
and see that there's no print.
Thanks for this. At least it's good to understand why theminFactor
argument was being ignored. I opted for the self-start model because I was struggling to find reasonable start values. It is so sensitive to the start values that I end up with the same error, even once I've increased themaxiter
to 10,000.
– EcologyTom
Nov 23 '18 at 10:57
For the future, in many cases tryingdebugonce()
, i.e.,debugonce(nls)
, and seeing what happens inside the code is a good start to see why something doesn't work
– Nutle
Nov 23 '18 at 10:59
add a comment |
It seems the control
option does not work in your case, since the code breaks at getInitial
while self-starting, that is, before using your provided control
parameters. One way would be to try specifying some starting parameters, instead of the naive self-starting. For nls
it is often the case that playing with the initial parameters will make-or-break it, not entirely sure for the specific Weibull case though, but should be the same.
To see that you don't arrive to the actual control
, you can try with nls.control(printEval = T)
and see that there's no print.
Thanks for this. At least it's good to understand why theminFactor
argument was being ignored. I opted for the self-start model because I was struggling to find reasonable start values. It is so sensitive to the start values that I end up with the same error, even once I've increased themaxiter
to 10,000.
– EcologyTom
Nov 23 '18 at 10:57
For the future, in many cases tryingdebugonce()
, i.e.,debugonce(nls)
, and seeing what happens inside the code is a good start to see why something doesn't work
– Nutle
Nov 23 '18 at 10:59
add a comment |
It seems the control
option does not work in your case, since the code breaks at getInitial
while self-starting, that is, before using your provided control
parameters. One way would be to try specifying some starting parameters, instead of the naive self-starting. For nls
it is often the case that playing with the initial parameters will make-or-break it, not entirely sure for the specific Weibull case though, but should be the same.
To see that you don't arrive to the actual control
, you can try with nls.control(printEval = T)
and see that there's no print.
It seems the control
option does not work in your case, since the code breaks at getInitial
while self-starting, that is, before using your provided control
parameters. One way would be to try specifying some starting parameters, instead of the naive self-starting. For nls
it is often the case that playing with the initial parameters will make-or-break it, not entirely sure for the specific Weibull case though, but should be the same.
To see that you don't arrive to the actual control
, you can try with nls.control(printEval = T)
and see that there's no print.
answered Nov 23 '18 at 9:31
NutleNutle
305215
305215
Thanks for this. At least it's good to understand why theminFactor
argument was being ignored. I opted for the self-start model because I was struggling to find reasonable start values. It is so sensitive to the start values that I end up with the same error, even once I've increased themaxiter
to 10,000.
– EcologyTom
Nov 23 '18 at 10:57
For the future, in many cases tryingdebugonce()
, i.e.,debugonce(nls)
, and seeing what happens inside the code is a good start to see why something doesn't work
– Nutle
Nov 23 '18 at 10:59
add a comment |
Thanks for this. At least it's good to understand why theminFactor
argument was being ignored. I opted for the self-start model because I was struggling to find reasonable start values. It is so sensitive to the start values that I end up with the same error, even once I've increased themaxiter
to 10,000.
– EcologyTom
Nov 23 '18 at 10:57
For the future, in many cases tryingdebugonce()
, i.e.,debugonce(nls)
, and seeing what happens inside the code is a good start to see why something doesn't work
– Nutle
Nov 23 '18 at 10:59
Thanks for this. At least it's good to understand why the
minFactor
argument was being ignored. I opted for the self-start model because I was struggling to find reasonable start values. It is so sensitive to the start values that I end up with the same error, even once I've increased the maxiter
to 10,000.– EcologyTom
Nov 23 '18 at 10:57
Thanks for this. At least it's good to understand why the
minFactor
argument was being ignored. I opted for the self-start model because I was struggling to find reasonable start values. It is so sensitive to the start values that I end up with the same error, even once I've increased the maxiter
to 10,000.– EcologyTom
Nov 23 '18 at 10:57
For the future, in many cases trying
debugonce()
, i.e., debugonce(nls)
, and seeing what happens inside the code is a good start to see why something doesn't work– Nutle
Nov 23 '18 at 10:59
For the future, in many cases trying
debugonce()
, i.e., debugonce(nls)
, and seeing what happens inside the code is a good start to see why something doesn't work– Nutle
Nov 23 '18 at 10:59
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53443377%2fresolving-minfactor-error-when-using-nls-in-r%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown