Goodness of Fit from Gaussian Fit
조회 수: 8 (최근 30일)
이전 댓글 표시
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
답변 (1개)
Eric
2013년 4월 24일
편집: Eric
2013년 4월 24일
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
참고 항목
카테고리
Help Center 및 File Exchange에서 Interpolation에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!