aivika-experiment-4.0.3: Simulation experiments for the Aivika library

CopyrightCopyright (c) 2012-2015, David Sorokin <david.sorokin@gmail.com>
LicenseBSD3
MaintainerDavid Sorokin <david.sorokin@gmail.com>
Stabilityexperimental
Safe HaskellSafe-Inferred
LanguageHaskell98

Simulation.Aivika.Experiment.Histogram

Contents

Description

Tested with: GHC 7.10.1

| This module computes the histogram by the specified data and strategy applied for such computing.

The code in this module is essentially based on the http://hackage.haskell.org/package/Histogram package by Mike Izbicki, who kindly agreed to re-license his library under BSD3, which allowed me to use his code and comments with some modifications.

Synopsis

Creating Histograms

type Histogram = [(Double, [Int])] Source

Holds all the information needed to plot the histogram for a list of different series. Each series produces its own item in the resuling [Int] list that may contain zeros.

histogram :: BinningStrategy -> [[Double]] -> Histogram Source

Creates a histogram by specifying the list of series. Call it with one of the binning strategies that is appropriate to the type of data you have. If you don't know, then try using binSturges.

histogramBinSize :: Double -> [[Double]] -> Histogram Source

Create a histogram by specifying the exact bin size. You probably don't want to use this function, and should use histogram with an appropriate binning strategy.

histogramNumBins :: Int -> [[Double]] -> Histogram Source

Create a histogram by the specified approximated number of bins. You probably don't want to use this function, and should use histogram with an appropriate binning strategy.

Binning Strategies

type BinningStrategy = [Double] -> Int Source

The strategy applied to calculate the histogram bins.

binSturges :: BinningStrategy Source

Sturges' binning strategy is the least computational work, but recommended for only normal data.

binDoane :: BinningStrategy Source

Doane's binning strategy extends Sturges' for non-normal data. It takes a little more time because it must calculate the kurtosis (peakkiness) of the distribution.

binSqrt :: BinningStrategy Source

Using the sqrt of the number of samples is not supported by any theory, but is commonly used by excel and other histogram making software.

binScott :: BinningStrategy Source

Scott's rule is the optimal solution for normal data, but requires more computation than Sturges'.