I'm working to build some models in R and am having trouble not returning the error:
Warning messages:
1: In min(x) : no non-missing arguments to min; returning Inf
2: In max(x) : no non-missing arguments to max; returning -Inf
For reference, my dataset and the code I am trying is:
x <- c(1:7)
y <- c(21, 27, 26, 33, 52, 68, 96)
fit8 <- nls(y ~ a*exp(b*x), data=base, start=list(a=16, b = .22))
Where the starting values were found in Excel, but I still return the same error when using them in R.
In general, are there easy ways to loop through unknown starting values to avoid the error? I need to create a systemic way to determine the best fit lines for ~1,000 different datasets within a larger dataset.
When I run your code without data=base, I get the output as expected. Is it possible you have assigned other values to a data frame called base?
nls(y ~ a*exp(b*x), start=list(a=16, b=.22))
It returns the output as expected:
Nonlinear regression model
model: y ~ a * exp(b * x)
...
a b
11.8560 0.2953
...