When I use the
n0 <- nls(Y~expo.der(x, A, B, C), data=dados_Indice, start=start, na.omit(NA), trace = TRUE)
expo.der is the name of the created function that defines the formula used in the regression, I changed it to MM
MM <- deriv3(~(A*x/(B+x))+C,c("A", "B", "C"),function(x, A, B, C) NULL)
On the start values I'm using
(A)0.9707976, (B)14.50896 e (C) 0.02920242
As previously requested output to > dput (head (index_data, 20)) is
structure(list(Y = c(0.504968267320704, 0.580320008623638, 0.591987263077176,
0.507128952150783, 0.471443542762971, 0.487690808524229, 0.550025947056627,
0.517020993324232, 0.649271477040753, 0.543409645706519, 0.476085216626585,
0.420887866612052, 0.587785676649722, 0.546330880659742, 0.598972408502253,
0.60582105500102, 0.537834815210853, 0.535468008413421, 0.532758019489451,
0.471561274553937), x = c(20, 20, 20, 20, 20, 20, 20, 20, 20,
20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20)), .Names = c("Y",
"x"), row.names = c(NA, 20L), class = "data.frame")
The algorithm returns an error because it exceeds the maximum number of iterations. Querying some alternatives, the recommended solution was to include the nls.control
command as an attribute of the nls
method, so the result was the command below
n0 <- nls(Y~MM(x, A, B, C), data=dados_Indice, start=start, control=nls.control(maxiter = 200, tol = 1e-05, minFactor = (1/2)^30), trace = TRUE, na.omit(NA))
However, after these changes, when you run the above command, it returns the following error:
Error in match.arg(algorithm) : 'arg' must be NULL or a character vector
Why is this error displayed? And what can I do to bypass it by running the nls
function, according to the established control?