import { default } from "https://deno.land/x/simplestatistics@v7.8.3/src/r_squared.js";
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.
Examples
var samples = [[0, 0], [1, 1]];
var regressionLine = linearRegressionLine(linearRegression(samples));
rSquared(samples, regressionLine); // = 1 this line is a perfect fit
var samples = [[0, 0], [1, 1]]; var regressionLine = linearRegressionLine(linearRegression(samples)); rSquared(samples, regressionLine); // = 1 this line is a perfect fit