How to take R-Square value as a variable

6 ビュー (過去 30 日間)
Jaehwi Bong
Jaehwi Bong 2019 年 6 月 4 日
編集済み: Jaehwi Bong 2019 年 6 月 4 日
I could take some a, b and c value of custom exponential equation.(F.a, F.b and F.c)
I'd like to compute R-square value to a loop to use as a threshold.
When I compute this, it shows several values including R-square. How can I take this value only to use a variable?
A=readtable('R_square_practice.xlsx');
A=table2array(A);
t=A(:,1);
b=A(:,2);
initial=rand(1,3);
ft = fittype('a*exp(-x/b)+c');
F=fit(t,b,'StartPoint',initial(:,:));
[curve2,gof2] = fit(t,b,ft)
-----------------------------------------------------------------------------------
curve2 =
General model:
curve2(x) = a*exp(-x/b)+c
Coefficients (with 95% confidence bounds):
a = 6749 (3683, 9814)
b = 1.185 (-0.009564, 2.379)
c = 4.581e+04 (4.518e+04, 4.643e+04)
gof2 =
struct with fields:
sse: 5.4861e+07
rsquare: 0.4751
dfe: 25
adjrsquare: 0.4331
rmse: 1.4814e+03

採用された回答

Rik
Rik 2019 年 6 月 4 日
If you mean you want to access the value of the rsquare field, you can do that as with any struct (see the line of code below). If this is not what you mean, please edit your question to clarify.
R2_value=gof2.rsquare;
  1 件のコメント
Jaehwi Bong
Jaehwi Bong 2019 年 6 月 4 日
編集済み: Jaehwi Bong 2019 年 6 月 4 日
Thank you!

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeLinear and Nonlinear Regression についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by