stats

package
v0.0.0-...-d6e8a04 Latest Latest
Warning

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

Go to latest
Published: Feb 3, 2018 License: MIT Imports: 5 Imported by: 1

Documentation

Overview

Package stats provided functions and methods to compute stat

Index

Constants

This section is empty.

Variables

View Source
var (
	EmptyInput  = statsErr{"Input must not be empty."}
	SampleSize  = statsErr{"Samples number must be less than input length."}
	NaNErr      = statsErr{"Not a number"}
	NegativeErr = statsErr{"Slice must not contain negative values."}
	ZeroErr     = statsErr{"Slice must not contain zero values."}
	BoundsErr   = statsErr{"Input is outside of range."}
	SizeErr     = statsErr{"Slices must be the same length."}
)

These are the package-wide error values. All error identification should use these values.

Functions

func Correlation

func Correlation(d, d1 Data) (float64, error)

Correlation computes the Pearson

func Max

func Max(d Data) (float64, error)

Max computes the maximum value

func Mean

func Mean(i Data) (float64, error)

Mean get the average of a slice of number

func Median

func Median(data Data) (median float64, err error)

Median computes the slice median

func Min

func Min(d Data) (float64, error)

Min computes the minimum value

func Mode

func Mode(i Data) (mode []float64, err error)

Mode computes the mode of a []float64 values and returns a slice of the most frequent

func Pearson

func Pearson(d1, d2 Data) (float64, error)

Pearson computes the pearson moment coef

func PopulationStandardDeviation

func PopulationStandardDeviation(d Data) (float64, error)

PopulationStandardDeviation computes the population StandardDeviation

func PopulationVariance

func PopulationVariance(data Data) (float64, error)

PopulationVariance computes the population variance

func Psdev

func Psdev(d Data) (float64, error)

Psdev is a short for PopulationStandardDeviation

func Pvariance

func Pvariance(data Data) (float64, error)

Pvariance computes the population variance

func Range

func Range(d Data) (float64, error)

Range computes range

func SampleStandardDeviation

func SampleStandardDeviation(d Data) (float64, error)

SampleStandardDeviation computes the sample StandardDeviation

func SampleStandardError

func SampleStandardError(d Data) (float64, error)

SampleStandardError ....

func SampleVariance

func SampleVariance(data Data) (float64, error)

SampleVariance computes the sample variance

func SampleZscore

func SampleZscore(d Data, x float64) (z float64, err error)

SampleZscore this computes ths z score using the SampleStandardDeviation

func Ssdev

func Ssdev(d Data) (float64, error)

Ssdev is a short for SampleStandardDeviation

func StandardDeviation

func StandardDeviation(d Data) (float64, error)

StandardDeviation computes the population StandardDeviation

func Sum

func Sum(d Data) (sum float64, err error)

Sum computes the sum

func Svariance

func Svariance(data Data) (float64, error)

Svariance computes the sample variance

func Variance

func Variance(data Data) (float64, error)

Variance ccomputes the population variance

func Zscore

func Zscore(d Data, x float64) (z float64, err error)

Zscore this computes the z score using the population StandardDeviation

Types

type Data

type Data []float64

Data represents a collection of float64 values. In which operations are done

func Sample

func Sample(d Data, lenght int) (Data, error)

Sample samples Data randomly and returns a new Data

func (Data) Get

func (d Data) Get(i int) float64

Get items in slice

func (*Data) Len

func (d *Data) Len() int

Len return length of slice

func (*Data) Max

func (d *Data) Max() (float64, error)

Max returns the maximux values in data

func (*Data) Mean

func (d *Data) Mean() (float64, error)

Mean Computes the of the data set

func (*Data) Median

func (d *Data) Median() (float64, error)

Median returns the mid item in the data when sorted

func (*Data) Min

func (d *Data) Min() (float64, error)

Min return the minimum item in data

func (*Data) Mode

func (d *Data) Mode() ([]float64, error)

Mode returns the mode of the data

func (*Data) PopulationStandardDeviation

func (d *Data) PopulationStandardDeviation() (float64, error)

PopulationStandardDeviation computes the Population StandardDeviation

func (*Data) PopulationVariance

func (d *Data) PopulationVariance() (float64, error)

PopulationVariance return the Population Variance of data

func (*Data) Range

func (d *Data) Range() (float64, error)

Range return the data range

func (*Data) SampleStandardDeviation

func (d *Data) SampleStandardDeviation() (float64, error)

SampleStandardDeviation computes the sample StandardDeviation

func (*Data) SampleStandardError

func (d *Data) SampleStandardError() (float64, error)

SampleStandardError computes sample StandardError

func (*Data) SampleVariance

func (d *Data) SampleVariance() (float64, error)

SampleVariance returns sample Variance of data

func (*Data) SampleZscore

func (d *Data) SampleZscore(x float64) (float64, error)

SampleZscore computes the number of StandardDeviation from the mean using sample

func (*Data) StandardDeviation

func (d *Data) StandardDeviation() (float64, error)

StandardDeviation computes the Population StandardDeviation

func (*Data) Sum

func (d *Data) Sum() (float64, error)

Sum returns the sum of all the values of data

func (*Data) Variance

func (d *Data) Variance() (float64, error)

Variance computes the Population Variance of data

func (*Data) Zscore

func (d *Data) Zscore(x float64) (float64, error)

Zscore computes the number of StandardDeviation from the mean using Population

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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