How to enter the R-square fit formula in the m-file?

1 回表示 (過去 30 日間)
Priya
Priya 2014 年 2 月 15 日
編集済み: Priya 2014 年 2 月 21 日
I need to calculate the R-square fit for the model output. I have the formula for calculating it, but how to give it in the code and what is the plot command to get the r-square fit?
Please do help me.

採用された回答

Wayne King
Wayne King 2014 年 2 月 15 日
編集済み: Wayne King 2014 年 2 月 15 日
Residual sum of squares
residsumsq = norm(y-yhat,2)^2;
Total sum of squares
tsumsq = norm(y-mean(y),2)^2;
R2 = 1-(tsumsq/residsumsq);
  3 件のコメント
Wayne King
Wayne King 2014 年 2 月 15 日
The y vector is the vector of your original data. The yhat vector is your fitted data as predicted by your model.
Priya
Priya 2014 年 2 月 21 日
編集済み: Priya 2014 年 2 月 21 日
Please tell me what does the 2(in bold) in the below expression mean?
residsumsq = norm(y-yhat, 2 )^2;
Also, Is the norm function referring to summation?

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

その他の回答 (0 件)

カテゴリ

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