I am new to R (first time using it). and I am following this tutorial http://www.walkingrandomly.com/?p=5254 to try to plot a curve and discover the function that best fits my data. So far I have tryed:
> xdata = c(1 ,5, 10, 20, 100)
> ydata = c(23.83333333, 210.3666667, 545.3666667, 1756.866667, 38595.7)
> plot(xdata,ydata)
So I get this:
Then I try:
> p1 = 1
> p2 = 0.2
> fit = nls(ydata ~ xdata^2, start=list(p1=p1,p2=p2))
And I get this error:
Error in nlsModel(formula, mf, start, wts) :
singular gradient matrix at initial parameter estimates
What am I doing wrong? Thanks