hmatrix-gsl-stats-0.1.3: GSL Statistics interface

Portabilityuses ffi
Stabilityprovisional
Maintainerhaskell.vivian.mcphail <at> gmail <dot> com
Safe HaskellSafe-Infered

Numeric.GSL.Histogram

Contents

Description

Synopsis

Creation

data Histogram Source

A histogram structure

emptyRangesSource

Arguments

:: Vector Double

the ranges

-> Histogram

result

create a histogram with n bins from ranges (x0->x1),(x1->x2)..(xn->xn+1)

emptyLimitsSource

Arguments

:: Int

bins

-> (Double, Double)

lower and upper limits

-> Histogram

result

create a histogram with n bins and lower and upper limits

fromRangesSource

Arguments

:: Vector Double

the ranges

-> Vector Double

the data

-> Histogram

result

create a histogram with n bins from ranges (x0->x1),(x1->x2)..(xn->xn+1) and increment from a vector

fromLimitsSource

Arguments

:: Int

bins

-> (Double, Double)

lower and upper limits

-> Vector Double

the data

-> Histogram

result

create a histogram with n bins and lower and upper limits and increment from a vector

Loading

addList :: Histogram -> [Double] -> HistogramSource

adds 1.0 to the correct bin for each element of the list

addVector :: Histogram -> Vector Double -> HistogramSource

adds 1.0 to the correct bin for each element of the vector

addListWeighted :: Histogram -> [(Double, Double)] -> HistogramSource

adds the appropriate weight for each element of the list

addVectorWeighted :: Histogram -> Vector Double -> Vector Double -> HistogramSource

adds the appropriate weight for each element of the list

Marshalling

toVectorsSource

Arguments

:: Histogram 
-> (Vector Double, Vector Double)

(ranges,bins)

extract the ranges and bin weights

fromVectors :: Vector Double -> Vector Double -> HistogramSource

create a histogram from the ranges and bin weights

Information

getBin :: Histogram -> Int -> DoubleSource

returns the contents of the i-th bin

getRange :: Histogram -> Int -> (Double, Double)Source

returns the upper and lower limits of the i-th bin

getMax :: Histogram -> DoubleSource

the maximum upper range limit

getMin :: Histogram -> DoubleSource

the minimum lower range limit

getBins :: Histogram -> IntSource

the number of bins

Querying

find :: Histogram -> Double -> Maybe IntSource

find the bin corresponding to the value

count :: Histogram -> Vector Double -> Vector DoubleSource

find the number of occurences for each element of the input vector

prob :: Histogram -> Vector Double -> Vector DoubleSource

find the probability of occurring for each element of the input vector

countInstance :: Histogram -> Double -> DoubleSource

find the number of occurences for the input

probability :: Histogram -> Double -> DoubleSource

find the probability of the input

maxVal :: Histogram -> DoubleSource

the maximum value contained in the bins

maxBin :: Histogram -> IntSource

the index of the bin containing the maximum value

minVal :: Histogram -> DoubleSource

the minimum value contained in the bins

minBin :: Histogram -> IntSource

the index of the bin containing the minimum value

Statistics

mean :: Histogram -> DoubleSource

the mean of the values, accuracy limited by bin width

stddev :: Histogram -> DoubleSource

the standard deviation of the values, accuracy limited by bin width

sum :: Histogram -> DoubleSource

the sum of the values, accuracy limited by bin width

equalBins :: Histogram -> Histogram -> BoolSource

returns True of all the individual bin ranges of the two histograms are identical

Mathematics

add :: Histogram -> Histogram -> HistogramSource

adds the contents of the bins of the second histogram to the first

subtract :: Histogram -> Histogram -> HistogramSource

subtracts the contents of the bins of the second histogram from the first

multiply :: Histogram -> Histogram -> HistogramSource

multiplies the contents of the bins of the second histogram by the first

divide :: Histogram -> Histogram -> HistogramSource

divides the contents of the bins of the first histogram by the second

shift :: Histogram -> Double -> HistogramSource

adds a constant to the contents of the bins

scale :: Histogram -> Double -> HistogramSource

multiplies the contents of the bins by a constant

Files

fwriteHistogram :: FilePath -> Histogram -> IO ()Source

write a histogram in the native binary format (may not be portable)

freadHistogram :: FilePath -> Int -> IO HistogramSource

read a histogram in the native binary format, number of bins must be known

fprintfHistogram :: FilePath -> String -> String -> Histogram -> IO ()Source

saves the histogram with the given formats (%f,%e,%g) for ranges and bins each line comprises: range[i] range[i+1] bin[i]

fscanfHistogram :: FilePath -> Int -> IO HistogramSource

reads formatted data as written by fprintf, the number of bins must be known in advance

PDF

data HistogramPDF Source

A histogram-derived cumulative distribution function (CDF)

fromHistogram :: Histogram -> HistogramPDFSource

create a histogram PDF from a histogram

sample :: HistogramPDF -> Double -> DoubleSource

given a random number from the uniform distribution [0,1], draw a random sample from the PDF