deno.land / x / simplestatistic@v7.7.1 / test / r_squared.test.js

r_squared.test.js
نووسراو ببینە
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
/* eslint no-shadow: 0 */
const test = require("tap").test;const ss = require("../");
test("r-squared", function (t) { t.test( "says that the r squared of a two-point line is perfect", function (t) { const d = [ [0, 0], [1, 1] ]; const l = ss.linearRegressionLine(ss.linearRegression(d)); t.equal(ss.rSquared(d, l), 1); t.end(); } );
t.test( "says that the r squared of a three-point line is not perfect", function (t) { const d = [ [0, 0], [0.5, 0.2], [1, 1] ]; const l = ss.linearRegressionLine(ss.linearRegression(d)); t.not(ss.rSquared(d, l), 1); t.end(); } );
t.test("r-squared of single sample is 1", function (t) { const d = [[0, 0]]; const l = ss.linearRegressionLine(ss.linearRegression(d)); t.equal(ss.rSquared(d, l), 1); t.end(); }); t.end();});
simplestatistic

Version Info

Tagged at
2 years ago