monte-carlo-0.6.1: A monad and transformer for Monte Carlo calculations.

Stability experimental Patrick Perry None

Data.Summary.Double

Description

Summary statistics for `Double`s.

Synopsis

# Summary type

data Summary Source

A type for storing summary statistics for a data set including sample size, min and max values, and first and second moments.

Instances

 Eq Summary Data Summary Show Summary Typeable Summary Monoid Summary

# Properties

## Sum

Number of observations.

Sum of values.

Sum of squared errors `(x[i] - mean)^2`.

## Mean

Mean value.

Standard error of the mean.

meanCI :: Double -> Summary -> (Double, Double)Source

Get a Central Limit Theorem based confidence interval for the population mean with the specified coverage level. The level must be in the range `(0,1)`.

## Scale

Sample standard deviation.

Sample variance.

Maximum value.

Minimum value.

# Construction

An empty summary.

Summarize a single value.

# Insertion

Update the summary with a data point. Running mean and variance computed as in Knuth, Vol 2, page 232, 3rd edition, see http://www.johndcook.com/standard_deviation.html for a description.

insertWith :: (a -> Double) -> a -> Summary -> SummarySource

Apply a function and update the summary with the result.

# Combination

Take the union of two summaries. Use the updating rules from Chan et al. "Updating Formulae and a Pairwise Algorithm for Computing Sample Variances," available at http://infolab.stanford.edu/pub/cstr/reports/cs/tr/79/773/CS-TR-79-773.pdf.

unions :: [Summary] -> SummarySource

Take the union of a list of summaries.

# Conversion

## Lists

fromList :: [Double] -> SummarySource

Get a summary of a list of values.

fromListWith :: (a -> Double) -> [a] -> SummarySource

Map a function over a list of values and summarize the results.

## Statistics

Convert to (size, mean, sumSquaredErrors, minimum, maximum).

Convert from (size, mean, sumSquaredErrors, minimum, maximum). No validation is performed.