Documentation
¶
Index ¶
- func Chatterjee(x, y []float64) float64
- func IsClose(a, b float64, tol ...float64) bool
- func Mean(x []float64) float64
- func Mul(x, y []float64) []float64
- func Pearson(x, y []float64) float64
- func Spearman(x, y []float64) float64
- func Sub(x []float64, y float64) []float64
- func Sum(x []float64) float64
- type Correlation
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Chatterjee ¶
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 Pearson ¶
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
Types ¶
type Correlation ¶
Click to show internal directories.
Click to hide internal directories.