I have found similar posts but the solutions did not work for me. I want to fit a curve to some data. I expect the curve to be defined by a function similar to: y = -10*(x-0.3)^2 +1
When I use nls as follows:
fit.2<-nls(co2 ~ F * (mvol+G)^k + C, data=soildata, start=list(F=-1, G=-0.25, C = 1, k=2))
lines(newdat$mvol, predict(fit.2, newdata = newdat), col="red", lwd=2)
I get the error:
> fit.2<-nls(co2 ~ F * (mvol+G)^k + C, data=soildata, start=list(F=-1, G=-0.25, C = 1, k=2))
Error in numericDeriv(form[[3L]], names(ind), env) :
Missing value or an infinity produced when evaluating the model
I've tried adjusting the starting points but doesnt seem to help. I'm new to R but have some experience with matlab.
Let me know if you see whats wrong.
Here's what my data looks like.