Documentation ¶
Overview ¶
Package stats provides a wrapper around github.com/montanaflynn/stats to compute common statistics for a dataset.
The package requires the dataset to be a slice of float64. The caller has the responsibility of transforming the data into a usable dataset for stats.Compute.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrEmptySlice = errors.New("input slice is empty")
ErrEmptySlice is returned when working on an empty slice.
Functions ¶
This section is empty.
Types ¶
type Common ¶
type Common struct { Min float64 Max float64 Mean float64 Median float64 StdDev float64 // Deciles is an array composed of the nine deciles. // Deciles[0] is the first decile (10%), Deciles[8] // is the 9th decile (90%). Deciles [9]float64 }
Common represents the common statistics computed from a given dataset.
func ComputeCommon ¶
ComputeCommon computes the common statistics for a dataset. Returns ErrCompute if any error occurs during the computation. When returning an error, the value of Stats struct may be partially written.
func (*Common) StringAsTime ¶
StringAsTime returns a string representing the statistics expressed in time.Duration.
{min:100ms max:200ms ...}
type ComputeError ¶
type ComputeError struct {
Errors []string
}
ComputeError is returned when Compute fails to compute a stat.
func (*ComputeError) Error ¶
func (e *ComputeError) Error() string
type StatusDistribution ¶
type StatusDistribution struct { Status1xx int Status2xx int Status3xx int Status4xx int Status5xx int }
func ComputeStatusDistribution ¶
func ComputeStatusDistribution(data []int) (StatusDistribution, error)