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

130 vues (au cours des 30 derniers jours)
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.

Réponse acceptée

MathWorks Support Team
MathWorks Support Team le 29 Août 2019
Modifié(e) : MathWorks Support Team le 28 Août 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 commentaires
John D'Errico
John D'Errico le 29 Août 2019
df should be the number of observations minus the number of estimated parameters.

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Interpolation dans Help Center et File Exchange

Produits


Version

R14SP2

Community Treasure Hunt

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

Start Hunting!

Translated by