필터 지우기
필터 지우기

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 CenterFile Exchange에서 Linear and Nonlinear Regression에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by