stats

package
v1.4.0 Latest Latest
Warning

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

Go to latest
Published: Nov 19, 2021 License: Apache-2.0 Imports: 1 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Float64Values

type Float64Values []float64

Float64Values is a simple Values implementation around a slice

func (Float64Values) Len

func (vals Float64Values) Len() int

Len returns the number of elements in the array

func (Float64Values) SetValueAt

func (vals Float64Values) SetValueAt(n int, v float64)

SetValueAt sets the value at the nth element

func (Float64Values) ValueAt

func (vals Float64Values) ValueAt(n int) float64

ValueAt returns the value at the nth element

type MutableValues

type MutableValues interface {
	Values

	// SetValueAt sets the value at the nth element
	SetValueAt(n int, v float64)
}

MutableValues is a set of data values that can be modified

type Statistics

type Statistics struct {
	Min    float64
	Max    float64
	Mean   float64
	Count  uint
	Sum    float64
	StdDev float64
}

Statistics are the computation of standard statistics (min, max, mean, count, stddev) over a group of values.

func Calc

func Calc(values Values) Statistics

Calc calculates statistics for a set of values

func Merge

func Merge(statistics []Statistics) Statistics

Merge merges a group of statistics

func SingleCountStatistics

func SingleCountStatistics(value float64) Statistics

SingleCountStatistics returns Statistics for a single value

func ZeroCountStatistics

func ZeroCountStatistics() Statistics

ZeroCountStatistics returns statistics when no values are present (or when all values are NaNs)

type Values

type Values interface {
	// Len returns the number of values present
	Len() int

	// ValueAt returns the value at the nth element
	ValueAt(n int) float64
}

Values presents a set of data values as an array, for the purposes of aggregation

Jump to

Keyboard shortcuts

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