Goodness of Fit from Gaussian Fit

14 ビュー (過去 30 日間)
Benjamin Zaugg
Benjamin Zaugg 2013 年 4 月 24 日
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 件のコメント
Benjamin Zaugg
Benjamin Zaugg 2013 年 4 月 24 日
bump

サインインしてコメントする。

回答 (1 件)

Eric
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

カテゴリ

Help Center および File ExchangeGet Started with Curve Fitting Toolbox についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by