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

CopyrightCopyright (c) 2010 Patrick Perry <patperry@gmail.com>
LicenseBSD3
MaintainerPatrick Perry <patperry@gmail.com>
Stabilityexperimental
Safe HaskellNone
LanguageHaskell98

Data.Summary.Double

Contents

Description

Summary statistics for Doubles.

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 Source # 

Methods

(==) :: Summary -> Summary -> Bool #

(/=) :: Summary -> Summary -> Bool #

Data Summary Source # 

Methods

gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> Summary -> c Summary #

gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c Summary #

toConstr :: Summary -> Constr #

dataTypeOf :: Summary -> DataType #

dataCast1 :: Typeable (* -> *) t => (forall d. Data d => c (t d)) -> Maybe (c Summary) #

dataCast2 :: Typeable (* -> * -> *) t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Summary) #

gmapT :: (forall b. Data b => b -> b) -> Summary -> Summary #

gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Summary -> r #

gmapQr :: (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Summary -> r #

gmapQ :: (forall d. Data d => d -> u) -> Summary -> [u] #

gmapQi :: Int -> (forall d. Data d => d -> u) -> Summary -> u #

gmapM :: Monad m => (forall d. Data d => d -> m d) -> Summary -> m Summary #

gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> Summary -> m Summary #

gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> Summary -> m Summary #

Show Summary Source # 
Monoid Summary Source # 

Properties

Sum

size :: Summary -> Int Source #

Number of observations.

sum :: Summary -> Double Source #

Sum of values.

sumSquaredErrors :: Summary -> Double Source #

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

Mean

mean :: Summary -> Double Source #

Mean value.

meanSE :: Summary -> Double Source #

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

stddev :: Summary -> Double Source #

Sample standard deviation.

variance :: Summary -> Double Source #

Sample variance.

Extremes

maximum :: Summary -> Double Source #

Maximum value.

minimum :: Summary -> Double Source #

Minimum value.

Construction

empty :: Summary Source #

An empty summary.

singleton :: Double -> Summary Source #

Summarize a single value.

Insertion

insert :: Double -> Summary -> Summary Source #

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 -> Summary Source #

Apply a function and update the summary with the result.

Combination

union :: Summary -> Summary -> Summary Source #

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] -> Summary Source #

Take the union of a list of summaries.

Conversion

Lists

fromList :: [Double] -> Summary Source #

Get a summary of a list of values.

fromListWith :: (a -> Double) -> [a] -> Summary Source #

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

Statistics

toStats :: Summary -> (Int, Double, Double, Double, Double) Source #

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

fromStats :: Int -> Double -> Double -> Double -> Double -> Summary Source #

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