correlation

package module
v0.0.0-...-485b28d Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 7, 2025 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

func Chatterjee

func Chatterjee(x, y []float64) float64
Example
package main

import (
	"fmt"

	"github.com/itsubaki/correlation"
)

func main() {
	x := []float64{1, 2, 3, 4, 5}
	y := []float64{5, 6, 7, 8, 7}

	r := correlation.Chatterjee(x, y)
	fmt.Printf("%.4f\n", r)

}
Output:

0.3125

func IsClose

func IsClose(a, b float64, tol ...float64) bool

func Mean

func Mean(x []float64) float64

func Mul

func Mul(x, y []float64) []float64

func Pearson

func Pearson(x, y []float64) float64
Example
package main

import (
	"fmt"

	"github.com/itsubaki/correlation"
)

func main() {
	x := []float64{1, 2, 3, 4, 5}
	y := []float64{5, 6, 7, 8, 7}

	r := correlation.Pearson(x, y)
	fmt.Printf("%.4f\n", r)

}
Output:

0.8321

func Spearman

func Spearman(x, y []float64) float64
Example
package main

import (
	"fmt"

	"github.com/itsubaki/correlation"
)

func main() {
	x := []float64{1, 2, 3, 4, 5} // rx = [1,2,3,4,5]
	y := []float64{5, 6, 7, 8, 7} // ry = [1, 2, 3.5, 5, 3.5]

	r := correlation.Spearman(x, y)
	fmt.Printf("%.4f\n", r)

}
Output:

0.8250

func Sub

func Sub(x []float64, y float64) []float64

func Sum

func Sum(x []float64) float64

Types

type Correlation

type Correlation func(x, y []float64) float64

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL