Skip to content

erriapo/stats

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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.

About

Tracking statistics of a stream of observations

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages