Skip to content

Commit

Permalink
Make clear which variance is which.
Browse files Browse the repository at this point in the history
  • Loading branch information
bos committed Sep 14, 2009
1 parent 9e7e4c6 commit 74cfaa1
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions Statistics/Sample.hs
Expand Up @@ -132,15 +132,17 @@ robustVar samp = fini . foldlU go (V 0 0) $ samp
n = lengthU samp
m = mean samp

-- | Maximum likelihood estimate of a sample's variance.
-- | Maximum likelihood estimate of a sample's variance. Also known
-- as the population variance.
variance :: Sample -> Double
variance = fini . robustVar
where fini (T v n)
| n > 1 = v / fromIntegral n
| otherwise = 0
{-# INLINE variance #-}

-- | Unbiased estimate of a sample's variance.
-- | Unbiased estimate of a sample's variance. Also known as the
-- sample variance.
varianceUnbiased :: Sample -> Double
varianceUnbiased = fini . robustVar
where fini (T v n)
Expand Down

0 comments on commit 74cfaa1

Please sign in to comment.