statistics-0.9.0.0: A library of statistical types, data, and functions

Portabilityportable
Stabilityexperimental
Maintainerbos@serpentine.com

Statistics.Distribution

Contents

Description

Types classes for probability distrubutions

Synopsis

Type classes

class Distribution d whereSource

Type class common to all distributions. Only c.d.f. could be defined for both discrete and continous distributions.

Methods

cumulative :: d -> Double -> DoubleSource

Cumulative distribution function. The probability that a random variable X is less or equal than x, i.e. P(Xx).

class Distribution d => ContDistr d whereSource

Continuous probability distributuion

Methods

density :: d -> Double -> DoubleSource

Probability density function. Probability that random variable X lies in the infinitesimal interval [x,x+δx) equal to density(x)⋅δx

quantile :: d -> Double -> DoubleSource

Inverse of the cumulative distribution function. The value x for which P(Xx) = p.

Helper functions

findRootSource

Arguments

:: ContDistr d 
=> d

Distribution

-> Double

Probability p

-> Double

Initial guess

-> Double

Lower bound on interval

-> Double

Upper bound on interval

-> Double 

Approximate the value of X for which P(x>X)=p.

This method uses a combination of Newton-Raphson iteration and bisection with the given guess as a starting point. The upper and lower bounds specify the interval in which the probability distribution reaches the value p.

sumProbabilities :: DiscreteDistr d => d -> Int -> Int -> DoubleSource

Sum probabilities in inclusive interval.