Goodness of Fit from Gaussian Fit
8 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Hi there, I have to analyze data (specificly area under curve) from an table with 2 coloumns and abou 1700 rows. I have used a a fit on the data:
fit_1 = fit(table([x0:x1],[1]),table([x0:x1],[2]),'gauss4');
this gives me the CFIT file named 'fit_1'
However, I would like to find out the Goodness of the fit (R squared) of my fit_1 compared to my table data, without using the cftool but integrate it into my existing function which I wrote.
Can somebody tell me if there is the possibility to do so outside of cftool and where I could find Information of how to do so?
Thanks a lot! Sorry for any typos & lack of knowledge (first post)
Greetings
Antworten (1)
Eric
am 24 Apr. 2013
Bearbeitet: Eric
am 24 Apr. 2013
I use the following:
ybar = mean(y); %Mean of the data
sst = sum( (y - ybar).^2 ); %Total sum of squares
gof.sse = sum( (y - fit_vec).^2 ); %Residual sum of squares
gof.rsquare = 1 - gof.sse/sst;
See http://en.wikipedia.org/wiki/Coefficient_of_determination as a reference for the equation for gof.rsquare.
In this code y is the data and fit_vec is the fitted data.
-Eric
0 Kommentare
Siehe auch
Kategorien
Mehr zu Interpolation finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!