Help us shape the future of Go! Take the 2026 Go Developer Survey

stats

package module
v0.0.0-...-3355c95 Latest Latest
Warning

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

Go to latest
Published: Nov 18, 2019 License: BSD-2-Clause Imports: 3 Imported by: 0

README

stats

Go package for Statistics

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Correlation

func Correlation(a []float64, b []float64) float64

Correlation returns the correlation between two data samples

func Covariance

func Covariance(a []float64, b []float64) float64

Covariance returns the covariance between two data samples

func InterQuartileRange

func InterQuartileRange(input []float64) float64

InterQuartileRange returns the difference between the third and the first quartiles.

func Max

func Max(input []float64) float64

Max returns the maximum value of the sample.

func Mean

func Mean(input []float64) float64

Mean returns the mean of the slice.

func Median

func Median(input []float64) (output float64)

Median returns the median of the slice. Panics if the input is not sorted.

func Min

func Min(input []float64) float64

Min returns the minimum value of the sample.

func OneSampleTTest

func OneSampleTTest(sample []float64, popmean float64, alpha float64, tails TailDirection) (bool, float64)

OneSampleTTest performs a One Sample T Test. This test can be performed when we don't know the populations std dev. It returns true if the null hypoyhesis is accepted and false otherwise. alpha is the significance level of one tail. Right tail : Null hypothesis Ho : sample mean <= pop mean. Alternative hypothesis H1 : sample mean > pop mean. Two tails : Null hypothesis Ho : sample mean = pop mean. Alternative hypothesis H1 : sample mean != pop mean. Left tail : Null hypothesis Ho : sample mean >= pop mean. Alternative hypothesis H1 : sample mean < pop mean.

func OneSampleZTest

func OneSampleZTest(sample []float64, pop pd.Normal, alpha float64, tails TailDirection) (bool, float64)

OneSampleZTest performs a Z Test. Z is the Standard normal distribution N(0,1). This test can be performed when the population is normally distributed and the population variance is known. It returns true if the null hypothesis is accepted and false otherwise. alpha is the significance level of one tail. Right tail (1): Null hypothesis Ho : sample mean <= pop mean. Alternative hypothesis H1 : sample mean > pop mean. Two tails (2): Null hypothesis Ho : sample mean = pop mean. Alternative hypothesis H1 : sample mean != pop mean. Left tail (-1): Null hypothesis Ho : sample mean >= pop mean. Alternative hypothesis H1 : sample mean < pop mean.

func PairedTTest

func PairedTTest(presample []float64, postsample []float64, alpha float64, tails TailDirection) (bool, float64, float64)

PairedTTest function returns the result of a Pared T Test

func Quartile1

func Quartile1(input []float64) (Q1 float64)

Quartile1 returns the first quartile.

func Quartile2

func Quartile2(input []float64) float64

Quartile2 returns the second quartile (equivalent to the median).

func Quartile3

func Quartile3(input []float64) (Q3 float64)

Quartile3 returns the third quartile.

func Range

func Range(input []float64) float64

Range returns the difference between the largest and smallest values.

func StdDev

func StdDev(input []float64) float64

StdDev returns the standard deviation of the sample.

func Variance

func Variance(input []float64) float64

Variance returns the variance of the sample.

Types

type TailDirection

type TailDirection uint8

TailDirection represents the direction of the tails that you consider from a distribution to perform statistical tests.

const (
	// TailRight represents the right tail of the distribution.
	TailRight TailDirection = iota
	// TailLeft represents the left tail of the distribution.
	TailLeft
	// TailBoth represents both left and right tails.
	TailBoth
)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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