how to use cfit to get fitobject and gof from a separately provided line

1 visualización (últimos 30 días)
Hi all,
I have a basic general question:
I am using [fitobject,gof]=fit(x,y,'poly1') to fit line segments.
I want to provide my own fit coefficients and get the same type of output about the goodness of fit.
How can I generate fitobject and gof using my independently provided fit coefficients, so that they will be in the same structure format as those generated by the 'fit' function?
thanks,
Rory

Respuestas (1)

Richard Willey
Richard Willey el 29 de Abr. de 2011
The aren't any constructor options for the Fit Objects in Curve Fitting Toolbox.
The easiest way to accomplish your goal is to set upper and lower bounds for your coefficients that will constraint them to a precise value. For example, suppose that you wanted to force the regression coefficients to be "3" and "8"
X = 1:100
X = X'
Y = 5 + 10*X + randn(100,1)
[foo GoF] = fit(X,Y, 'poly1', 'Lower',[3 8], 'Upper',[3 8])
  2 comentarios
Rory Staunton
Rory Staunton el 30 de Abr. de 2011
Thanks Richard,
The fit lines are being selected manually in a piecewise fashion from scatterplots of noisey experimental data. I have made algorithms for doing this automatically, which use regression to fit the lines, but the trouble lies in choosing the piecewise fitting regions. I want to do it manually so I can train my algorithm and have something trustworthy to check against. (Nothing is better than the eye!)
I think my best bet is to write some quick script that will calculate the sse, rsquare, dfe, adjrsquare, and rmse of my fit line with respect to the part of the raw data I am fitting. These are the parameters in the gof fields. I imagine looking up each of those functions in help will get me what I need.
Thanks again,
Rory
Rory Staunton
Rory Staunton el 2 de Mayo de 2011
It's not clear to me how MATLAB is calculating the number of degrees of freedom. Is this the degrees of freedom of the of the estimate of the population variance of the dependent variable, or the degrees of freedom of the estimate of the underlying population error variance?

Iniciar sesión para comentar.

Categorías

Más información sobre Statistics and Machine Learning Toolbox en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by