MCPcopy
hub / github.com/montanaflynn/stats / ExampleCorrelation

Function ExampleCorrelation

correlation_test.go:11–18  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

9)
10
11func ExampleCorrelation() {
12 s1 := []float64{1, 2, 3, 4, 5}
13 s2 := []float64{1, 2, 3, 5, 6}
14 a, _ := stats.Correlation(s1, s2)
15 rounded, _ := stats.Round(a, 5)
16 fmt.Println(rounded)
17 // Output: 0.99124
18}
19
20func TestCorrelation(t *testing.T) {
21 s1 := []float64{1, 2, 3, 4, 5}

Callers

nothing calls this directly

Calls 2

CorrelationFunction · 0.92
RoundFunction · 0.92

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…