rSquared
rSquared(
x,func):number
Defined in: src/r_squared.js:15
The R Squared
value of data compared with a function f
is the sum of the squared differences between the prediction
and the actual value.
Parameters
Section titled “Parameters”number[][]
input data: this should be doubly-nested
Function
function called on [i][0] values within the dataset
Returns
Section titled “Returns”number
r-squared value
Example
Section titled “Example”var samples = [[0, 0], [1, 1]];var regressionLine = linearRegressionLine(linearRegression(samples));rSquared(samples, regressionLine); // = 1 this line is a perfect fit