- newtype Count a = Count {
- calcCountI :: a
- asCount :: Count a -> Count a
- data Mean = Mean !Int !Double
- asMean :: Mean -> Mean
- data Variance = Variance !Int !Double !Double
- asVariance :: Variance -> Variance
- class CalcCount m where
- class CalcMean m where
- class CalcVariance m where
- calcVariance :: m -> Double
- calcVarianceUnbiased :: m -> Double
- calcStddev :: CalcVariance m => m -> Double
- calcStddevUnbiased :: CalcVariance m => m -> Double
- newtype Max = Max {}
- newtype Min = Min {}
- class ConvertibleToDouble a where
Mean and variance
Simplest statistics. Number of elements in the sample
Count | |
|
Mean of sample. Samples of Double,Float and bui;t-in integral types are supported
Numeric stability of mappend
is not proven.
Intermediate quantities to calculate the standard deviation.
Show Variance | |
Monoid Variance | Using parallel algorithm from: Chan, Tony F.; Golub, Gene H.; LeVeque, Randall J. (1979), Updating Formulae and a Pairwise Algorithm for Computing Sample Variances., Technical Report STAN-CS-79-773, Department of Computer Science, Stanford University. Page 4. ftp://reports.stanford.edu/pub/cstr/reports/cs/tr/79/773/CS-TR-79-773.pdf |
CalcVariance Variance | |
CalcMean Variance | |
CalcCount Variance | |
ConvertibleToDouble a => StatMonoid Variance a |
asVariance :: Variance -> VarianceSource
Fix type of monoid
Ad-hoc accessors
class CalcVariance m whereSource
calcVariance :: m -> DoubleSource
Calculate biased estimate of variance
calcVarianceUnbiased :: m -> DoubleSource
Calculate unbiased estimate of the variance, where the denominator is $n-1$.
calcStddev :: CalcVariance m => m -> DoubleSource
Calculate sample standard deviation (biased estimator, $s$, where the denominator is $n-1$).
calcStddevUnbiased :: CalcVariance m => m -> DoubleSource
Calculate standard deviation of the sample (unbiased estimator, $sigma$, where the denominator is $n$).
Maximum and minimum
Calculate maximum of sample. For empty sample returns NaN. Any NaN encountedred will be ignored.
Calculate minimum of sample. For empty sample returns NaN. Any NaN encountedred will be ignored.
Conversion to Double
class ConvertibleToDouble a whereSource
Data type which could be convered to Double