Online Mean Variance (9/365)

I am uploading a module I had written to compute the mean and the estimated variance in a streaming fashion as described here. I’ve wrapped it in a Monoid for convinence. The module can be found here.

ghci> :l OMVar.lhs
ghci> let m1 = mconcat $ zipWith mkMeanVar (repeat 1) [1..10]
ghci> let m2 = mconcat $ zipWith mkMeanVar (repeat 1) [11..20]
ghci> print (meanVar m1)
  (10.0,5.5,9.166666666666668)

ghci> print (meanVar $ m1 <> m2)
  (20.0,10.5,35.0)
Advertisements
This entry was posted in Uncategorized and tagged , . Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s