I'm having a little problem using the nls function. Could you help me understand and solve the problem below? Note that I can generate for df1 database, but not for df2 database. How to solve?
Executable code below:
df1<-structure(list(Category = c("ABC", "ABC", "ABC"), Days=c(42,43,44), Numbers = c(456.589136904762, 456.589136904762, 456.589136904762)), class= "data.frame", row.names = c(NA, -3L))
mod1 <- nls(Numbers ~ b1*Days^2+b2,start = list(b1 = 0,b2 = 0),data = df1, algorithm = "port")
> mod1
Nonlinear regression model
model: Numbers ~ b1 * Days^2 + b2
data: df1
b1 b2
1.513e-08 4.566e+02
residual sum-of-squares: 1.422e-10
Algorithm "port", convergence message: X-convergence (3)
df2<-structure(list(Category = c("ABC", "ABC", "ABC"), Days=c(42,43,44), Numbers = c(456.594054487179, 456.589136904762, 456.589136904762)), class= "data.frame", row.names = c(NA, -3L))
mod2 <- nls(Numbers ~ b1*Days^2+b2,start = list(b1 = 0,b2 = 0),data = df2, algorithm = "port")
Error in nls(Numbers ~ b1 * Days^2 + b2, start = list(b1 = 0, b2 = 0), :
Convergence failure: false convergence (8)