拟合函数的置信区间

Confidence intervals of fit function

我正在尝试处理拟合曲线的解释。

出于拟合目的,我使用 Matlab 的 fit 函数使用预定义模型(如 poly2)或自定义模型(如 y=ax^4+bx^2+c)没有任何问题。

我想确定每个参数(abc)的质量,以便能够绘制数据点 (able)、拟合曲线 (able)和 "area where the curve can be with a given probability"(无法)。

如果我运行foo=fit(x,y,'poly1')没有分号,那么return就是:

foo = 

 Linear model Poly1:
 fitNi(x) = p1*x + p2
 Coefficients (with 95% confidence bounds):
   p1 =       40.19  (3.088, 77.28)
   p2 =        1042  (730.1, 1354)

问题是,如何挖掘 3.088, 77.28 值? foo 中描述了 p1 参数的置信区间,我想。

答案不是很明显。

您需要使用:

   CI = confint(foo);

CI(1) => 3.088

CI(2) => 77.28

如果添加参数,您还可以更改置信区间:

CI99 = confint(foo,0.99) %  The 99% confidence interval

正如@Dev-iL 所说:

The bigger picture here is MATLAB classes/objects. You should get into the habit of doing methods(objectname), properties(objectname) and possibly even struct(objectname) to see what is available to you.

methods(foo)    % return methods available for foo (confint(foo))
properties(foo) % return available properties of foo (get(foo,<Property>))
struct(foo)     % available structure values of foo (foo.<Value>)