Skip to main content
Module

x/simplestatistics/index.js>rSquared

simple statistics for node & browser javascript
Go to Latest
function rSquared
import { rSquared } from "https://deno.land/x/simplestatistics@v7.7.5/index.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

Parameters

x

input data: this should be doubly-nested

func

function called on [i][0] values within the dataset