Filter löschen
Filter löschen

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

146 Ansichten (letzte 30 Tage)
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.

Akzeptierte Antwort

MathWorks Support Team
MathWorks Support Team am 29 Aug. 2019
Bearbeitet: MathWorks Support Team am 28 Aug. 2019
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 Kommentare
John D'Errico
John D'Errico am 29 Aug. 2019
df should be the number of observations minus the number of estimated parameters.

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Produkte


Version

R14SP2

Community Treasure Hunt

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

Start Hunting!

Translated by