필터 지우기
필터 지우기

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월 29일
편집: 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
John D'Errico
John D'Errico 2019년 8월 29일
df should be the number of observations minus the number of estimated parameters.

댓글을 달려면 로그인하십시오.

추가 답변 (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