非线性回归寻找函数参数

Nonlinear regression to find function parameters

我知道函数形式:

并有一些测量数据:

[x, y]
[1, 13.5]
[2, 13.25]
[3, 13.167]
[4, 12.125]
[5, 13.1]
[6, 13.083]

现在我必须找到 ab。蛮力方式显然不是很优雅:-)。我found that it is possible to do this type of calculation with regression analysis, but I am not sure, because real measured data are really measured so there could be some errors (I posted simplified version, where a = 2 and b = 13 and I rounded values so not all of them are accurate). I found article about measurement error models,但我对此有点困惑。
有人可以指出我正确的方向吗?也许向我展示一些相关的 C# 代码,或者至少展示正确的步骤列表,我应该怎么做?
我尝试了半蛮力的方法——用两个变量求解六个方程,然后 select 从给定的时间间隔中的最佳组合(与所有测量值的距离最小)。

您可以试试这些库:

他们会为您完成应用统计模型的工作。 在 RStan 中,您可以描述公式让我们从数据中猜测 ab。我认为在 Infer.NET 中它的工作原理类似。