Skip to content

Latest commit

 

History

History
32 lines (20 loc) · 960 Bytes

README.md

File metadata and controls

32 lines (20 loc) · 960 Bytes

Build Status

Go Report Card

GoDoc

An implementation of B.P. Welford's algorithm to maintain a running variance over a stream of observations.

This code is based on a John D Cook's blogpost.

Example usage

s := stats.NewSink()
s.Push(-1.1813782)
s.Push(-0.2449577)
s.Push(0.8799429)

fmt.Printf("Mean = %v\n", s.Mean()) // -0.182131...
fmt.Printf("Standard Deviation = %v\n", s.StandardDeviation()) // 1.032095...

Todos

  • Add a method that returns the running median.
  • Make the implementation multi-goroutine safe.

License

  • Code is released under MIT license.