How can I compute the standard error for coefficients returned from curve fitting functions in the Curve Fitting Toolbox?

146 次查看(过去 30 天)
I fit my data to a polynomial model using the FIT function from the Curve Fitting Toolbox as follows:
load census
[fitresult,gof1,out1] = fit(cdate,pop,'poly2');
The FIT function returns the following coefficients, along with confidence intervals:
fitresult =
Linear model Poly2:
fit1(x) = p1*x^2 + p2*x + p3
Coefficients (with 95% confidence bounds):
p1 = 0.006541 (0.006124, 0.006958)
p2 = -23.51 (-25.09, -21.93)
p3 = 2.113e+004 (1.964e+004, 2.262e+004)
I am interested in finding the standard error of the coefficients rather than the confidence interval.

采纳的回答

MathWorks Support Team
编辑:MathWorks Support Team 2019-8-28
The FIT function in the Curve Fitting Toolbox does not currently return the standard error or variance information on the estimated coefficients.
You can compute the standard errors from the confidence interval in the following manner.
Let "fitresult" be the result of calling "fit", and "df" be the degrees of freedom:
>> alpha = 0.95
>> ci = confint(fitresult, alpha)
>> t = tinv((1+alpha)/2, df);
>> se = (ci(2,:)-ci(1,:)) ./ (2*t) % Standard Error
Alternatively, models fitted using the Statistics Toolbox methods will have their coefficient-covariance matrices calculated and stored automatically as a model property. For example, you can access the coefficient-covariance matrix of a model "mdl" generated as output of the command "fitlm" by the command "mdl.Coefficient." See the following documentation link for more information:
You can also refer to the following discussion on MATLAB Answers:
  3 个评论

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Fit Postprocessing 的更多信息

标签

产品


版本

R14SP2

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by