Calculate R squared from a linear regress

5 Ansichten (letzte 30 Tage)
JFz am 22 Jan. 2018
Kommentiert: Star Strider am 22 Jan. 2018
Hi, I have a set of scattered data and I can use the operator "\" to do a linear fit on the data. But is there a simple matlab function to get the R^2? I am trying to skip the calculation shown on page:
BTW, I don't have machine learning toolbox.
Thanks for any help. If there is no simple matlab function, then I will have to try to calculate by using the sample code shown on the above page.

Akzeptierte Antwort

Star Strider
Star Strider am 22 Jan. 2018
It depends on the regression you’re doing. If you have a simple bivariable (as opposed to multivariable) linear regression, you can simply square one of the off-diagonal elements of the (2x2) matrix returned by corrcoef. It will give the same result.
  6 Kommentare
Star Strider
Star Strider am 22 Jan. 2018
As always, my pleasure!

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)



Community Treasure Hunt

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

Start Hunting!

Translated by