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

조회 수: 1 (최근 30일)
Rory Staunton
Rory Staunton 2011년 4월 29일
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

답변 (1개)

Richard Willey
Richard Willey 2011년 4월 29일
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
Rory Staunton
Rory Staunton 2011년 4월 30일
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 2011년 5월 2일
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?

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

카테고리

Help CenterFile Exchange에서 Statistics and Machine Learning Toolbox에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by