Borrar filtros
Borrar filtros

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

146 visualizaciones (últimos 30 días)
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.

Respuesta aceptada

MathWorks Support Team
MathWorks Support Team el 29 de Ag. de 2019
Editada: MathWorks Support Team el 28 de Ag. de 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 comentarios
John D'Errico
John D'Errico el 29 de Ag. de 2019
df should be the number of observations minus the number of estimated parameters.

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Fit Postprocessing en Help Center y File Exchange.

Etiquetas

Productos


Versión

R14SP2

Community Treasure Hunt

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

Start Hunting!

Translated by