【发布时间】:2014-09-26 03:47:19
【问题描述】:
我是 R 新手(第一次使用它)。我正在按照本教程http://www.walkingrandomly.com/?p=5254 尝试绘制曲线并发现最适合我的数据的函数。到目前为止,我已经尝试过:
> xdata = c(1 ,5, 10, 20, 100)
> ydata = c(23.83333333, 210.3666667, 545.3666667, 1756.866667, 38595.7)
> plot(xdata,ydata)
所以我明白了:
那我试试:
> p1 = 1
> p2 = 0.2
> fit = nls(ydata ~ xdata^2, start=list(p1=p1,p2=p2))
我得到这个错误:
Error in nlsModel(formula, mf, start, wts) :
singular gradient matrix at initial parameter estimates
我做错了什么? 谢谢
【问题讨论】:
标签: r least-squares