Skip to content

Latest commit

 

History

History
executable file
·
20 lines (13 loc) · 661 Bytes

README.md

File metadata and controls

executable file
·
20 lines (13 loc) · 661 Bytes

R Squared

R-squared (R2) is a statistical measure that represents the proportion of the variance for a dependent variable that's explained by an independent variable or variables in a regression model. Whereas correlation explains the strength of the relationship between an independent and dependent variable, R-squared explains to what extent the variance of one variable explains the variance of the second variable. (https://www.investopedia.com/terms/r/r-squared.asp)

Installing

Using npm:

$ npm i r-square

Usage

const x = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10];
const y = [1, 2, 3, 3, 4, 6, 7];

rSquare(x, y); // 0.94921875