f64stat

package module
v0.0.0-...-84707b8 Latest Latest
Warning

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

Go to latest
Published: Apr 20, 2018 License: MIT Imports: 1 Imported by: 1

README

float64stat

Golang package for simple statistics on a single random variable

Documentation

Overview

Package f64stat calculates rudamentary statistics for a single real random variable

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Stat

type Stat struct {
	Sum       float64
	Sum2      float64
	Vmin      float64
	Vmax      float64
	Count     float64
	Last      float64 // Value of last added sample
	Ema       float64 // Exponential moving average
	ExpWeight float64 // Exponential moving average weight

}

Stat is a container for tracking the random variable

func New

func New() *Stat

New creates a new random variable ready to add samples

func (*Stat) Add

func (f *Stat) Add(value float64) *Stat

Add incorporates a sample into the statistical calculations It returns a pointer to the

func (*Stat) Ave

func (f *Stat) Ave() float64

Ave returns the arithmetic mean of the random variable samples

func (*Stat) Max

func (f *Stat) Max() float64

Max returns the maximum sample value

func (*Stat) Min

func (f *Stat) Min() float64

Min returns the minimum sample value

func (*Stat) RMS

func (f *Stat) RMS() float64

RMS returns the root mean squared average of the samples

func (*Stat) Reset

func (f *Stat) Reset() *Stat

Reset zeros out the accumilated data

func (*Stat) Stddev

func (f *Stat) Stddev() float64

Stddev returns standard deviation of the samples

Jump to

Keyboard shortcuts

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