module Alea::CDF

Overview

Alea::CDF is the interface used to calculate the Cumulative Distribution Functions. Given X ~ D and a fixed quantile x, CDFs are defined as the functions that associate x to the probability that the real-valued random X from the distribution D will take a value less or equal to x.

Arguments passed to Alea::CDF methods to shape the distributions are analogous to those used for sampling:

Alea::CDF.normal(0.0)                       # => 0.5
Alea::CDF.normal(2.0, loc: 1.0, sigma: 0.5) # => 0.9772498680518208
Alea::CDF.chisq(5.279, df: 5.0)             # => 0.6172121213841358

NOTE for real-valued quantiles is used x, k for discrete-valued instead.

Defined in:

Class Method Summary

Class Method Detail

def self.chisq(x, df) : Float64 #

Calculate the cumulative distribution function evaluated at x.

@parameters:

  • x: real-valued quantile of which estimate the cdf.
  • df: degrees of freedom of the distribution; usually mentioned as k.

@exceptions:


def self.chisq32(x, df) : Float32 #

Calculate the cumulative distribution function evaluated at x.

@parameters:

  • x: real-valued quantile of which estimate the cdf.
  • df: degrees of freedom of the distribution; usually mentioned as k.

@exceptions:


def self.exp(x, scale = 1.0) : Float64 #

Calculate the cumulative distribution function evaluated at x.

@parameters:

  • x: real-valued quantile of which estimate the cdf.
  • scale: scale parameter of the distribution; usually mentioned as λ^-1.

@exceptions:


def self.exp32(x, scale = 1.0_f32) : Float32 #

Calculate the cumulative distribution function evaluated at x.

@parameters:

  • x: real-valued quantile of which estimate the cdf.
  • scale: scale parameter of the distribution; usually mentioned as λ^-1.

@exceptions:


def self.gamma(x, shape, scale = 1.0) : Float64 #

Calculate the cumulative distribution function evaluated at x.

@parameters:

  • x: real-valued quantile of which estimate the cdf.
  • shape: shape parameter of the distribution; usually mentioned as k.
  • scale: scale parameter of the distribution; usually mentioned as θ.

@exceptions:


def self.gamma32(x, shape, scale = 1.0_f32) : Float32 #

Calculate the cumulative distribution function evaluated at x.

@parameters:

  • x: real-valued quantile of which estimate the cdf.
  • shape: shape parameter of the distribution; usually mentioned as k.
  • scale: scale parameter of the distribution; usually mentioned as θ.

@exceptions:


def self.laplace(x, loc = 0.0, scale = 1.0) : Float64 #

Calculate the cumulative distribution function evaluated at x.

@parameters:

  • x: real-valued quantile of which estimate the cdf.
  • loc: centrality parameter, or mean of the distribution; usually mentioned as μ.
  • scale: scale parameter of the distribution; usually mentioned as b.

@exceptions:


def self.laplace32(x, loc = 0.0_f32, scale = 1.0_f32) : Float32 #

Calculate the cumulative distribution function evaluated at x.

@parameters:

  • x: real-valued quantile of which estimate the cdf.
  • loc: centrality parameter, or mean of the distribution; usually mentioned as μ.
  • scale: scale parameter of the distribution; usually mentioned as b.

@exceptions:


def self.lognormal(x, loc = 0.0, sigma = 1.0) : Float64 #

Calculate the cumulative distribution function evaluated at x.

@parameters:

  • x: real-valued quantile of which estimate the cdf.
  • loc: centrality parameter, or mean of the underlying normal distribution; usually mentioned as μ.
  • sigma: scale parameter, or standard deviation of the underlying normal distribution; usually mentioned as σ.

@exceptions:


def self.lognormal32(x, loc = 0.0_f32, sigma = 1.0_f32) : Float32 #

Calculate the cumulative distribution function evaluated at x.

@parameters:

  • x: real-valued quantile of which estimate the cdf.
  • loc: centrality parameter, or mean of the underlying normal distribution; usually mentioned as μ.
  • sigma: scale parameter, or standard deviation of the underlying normal distribution; usually mentioned as σ.

@exceptions:


def self.normal(x, loc = 0.0, sigma = 1.0) : Float64 #

Calculate the cumulative distribution function evaluated at x.

@parameters:

  • x: real-valued quantile of which estimate the cdf.
  • loc: centrality parameter, or mean of the distribution; usually mentioned as μ.
  • sigma: scale parameter, or standard deviation of the distribution; usually mentioned as σ.

@exceptions:


def self.normal32(x, loc = 0.0_f32, sigma = 1.0_f32) : Float32 #

Calculate the cumulative distribution function evaluated at x.

@parameters:

  • x: real-valued quantile of which estimate the cdf.
  • loc: centrality parameter, or mean of the distribution; usually mentioned as μ.
  • sigma: scale parameter, or standard deviation of the distribution; usually mentioned as σ.

@exceptions:


def self.poisson(k, lam = 1.0) : Float64 #

Calculate the cumulative distribution function evaluated at k.

@parameters:

  • k: discrete-valued quantile of which estimate the cdf.
  • lam: separation parameter of the distribution; usually mentioned as λ.

@exceptions:


def self.poisson32(k, lam = 1.0_f32) : Float32 #

Calculate the cumulative distribution function evaluated at k.

@parameters:

  • k: discrete-valued quantile of which estimate the cdf.
  • lam: separation parameter of the distribution; usually mentioned as λ.

@exceptions:


def self.uniform(x, min, max) : Float64 #

Calculate the cumulative distribution function evaluated at x.

@parameters:

  • x: real-valued quantile of which estimate the cdf.
  • min: left bound parameter of range of the distribution; usually mentioned as a.
  • max: right bound parameter of range of the distribution; usually mentioned as b.

@notes:

  • range is [min, max).

@exceptions:


def self.uniform32(x, min, max) : Float32 #

Calculate the cumulative distribution function evaluated at x.

@parameters:

  • x: real-valued quantile of which estimate the cdf.
  • min: left bound parameter of range of the distribution; usually mentioned as a.
  • max: right bound parameter of range of the distribution; usually mentioned as b.

@notes:

  • range is [min, max).

@exceptions: