deltaq-1.0.0.0: Framework for ∆Q System Development
CopyrightPredictable Network Solutions Ltd. 2020-2024
LicenseBSD-3-Clause
Safe HaskellSafe-Inferred
LanguageHaskell2010

DeltaQ.PiecewisePolynomial

Description

DQ is a probability distribution of completion time using the numeric type Rational. This type represents a mixed discrete / continuous probability distribution where the continuous part is represented in terms of piecewise polynomials.

Synopsis

Type

data DQ Source #

Probability distribution of durations.

Instances

Instances details
Show DQ Source # 
Instance details

Defined in DeltaQ.PiecewisePolynomial

Methods

showsPrec :: Int -> DQ -> ShowS #

show :: DQ -> String #

showList :: [DQ] -> ShowS #

NFData DQ Source # 
Instance details

Defined in DeltaQ.PiecewisePolynomial

Methods

rnf :: DQ -> () #

DeltaQ DQ Source # 
Instance details

Defined in DeltaQ.PiecewisePolynomial

Associated Types

type Probability DQ Source #

Outcome DQ Source # 
Instance details

Defined in DeltaQ.PiecewisePolynomial

Associated Types

type Duration DQ Source #

Eq DQ Source # 
Instance details

Defined in DeltaQ.PiecewisePolynomial

Methods

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

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

PartialOrd DQ Source #

Partial order of cumulative distribution functions.

leq x y holds if and only if for all completion times t, the probability to succeed within the time t is always larger (or equal) for x compared to y. In other words, x has a higher probability of completing faster.

x `leq` y  <=>  ∀ t. successWithin x t >= successWithin y t
Instance details

Defined in DeltaQ.PiecewisePolynomial

Methods

leq :: DQ -> DQ -> Bool #

comparable :: DQ -> DQ -> Bool #

type Duration DQ Source # 
Instance details

Defined in DeltaQ.PiecewisePolynomial

type Probability DQ Source # 
Instance details

Defined in DeltaQ.PiecewisePolynomial

distribution :: DQ -> Piecewise (Poly Rational) Source #

Get the distribution function as piecewise function of polynomials.

fromPositiveMeasure :: Measure Rational -> Maybe DQ Source #

Interpret a finite, signed Measure as a probability distribution.

In order to admit an interpretation as probability, the measure needs to be positive. This condition is checked, and if it does not hold, the function returns Nothing.

unsafeFromPositiveMeasure :: Measure Rational -> DQ Source #

Interpret a finite, positive Measure as a probability distribution.

The precondition that the measure is positive is not checked!

Operations

meetsQTA :: DQ -> DQ -> Bool Source #

Test whether the given probability distribution of completion times is equal to or better than a given quantitative timeliness agreement (QTA).

Synonym for leq of the partial order,

p `meetsQTA` qta  =  p `leq` qta

data Moments a #

The first four commonly used moments of a probability distribution.

Constructors

Moments 

Fields

  • mean :: a

    Mean or Expected Value \( \mu \). Defined as \( \mu = E[X] \).

  • variance :: a

    Variance \( \sigma^2 \). Defined as \( \sigma^2 = E[(X - \mu)^2] \). Equal to \( \sigma^2 = E[X^2] - \mu^2 \).

  • skewness :: a

    Skewness \( \gamma_1 \). Defined as \( \gamma_1 = E\left[\left(\frac{(X - \mu)}{\sigma}\right)^3 \right] \).

  • kurtosis :: a

    Kurtosis \( \kappa \). Defined as \( \kappa = E\left[\left(\frac{(X - \mu)}{\sigma}\right)^4 \right] \).

    The kurtosis is bounded below: \( \kappa \geq \gamma_1^2 + 1 \).

Instances

Instances details
Show a => Show (Moments a) 
Instance details

Defined in Numeric.Probability.Moments

Methods

showsPrec :: Int -> Moments a -> ShowS #

show :: Moments a -> String #

showList :: [Moments a] -> ShowS #

Eq a => Eq (Moments a) 
Instance details

Defined in Numeric.Probability.Moments

Methods

(==) :: Moments a -> Moments a -> Bool #

(/=) :: Moments a -> Moments a -> Bool #

moments :: DQ -> (Rational, Moments Rational) Source #

Compute the success probability of a DQ, and the first commonly used Moments of the probability distribution conditioned on success.

Internal

complexity :: DQ -> Int Source #

Size of the representation of a probability distribution, i.e. number of pieces of the piecewise function and degrees of the polynomials.

This quantity is relevant to stating and analyzing the asymptotic time complexity of operations.