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:
alea/prob/cdf.cralea/prob/pchisq.cr
alea/prob/pexp.cr
alea/prob/pgamma.cr
alea/prob/plaplace.cr
alea/prob/plognor.cr
alea/prob/pnorm.cr
alea/prob/ppoiss.cr
alea/prob/punif.cr
Class Method Summary
-
.chisq(x, df) : Float64
Calculate the cumulative distribution function evaluated at
x
. -
.chisq32(x, df) : Float32
Calculate the cumulative distribution function evaluated at
x
. -
.exp(x, scale = 1.0) : Float64
Calculate the cumulative distribution function evaluated at
x
. -
.exp32(x, scale = 1.0_f32) : Float32
Calculate the cumulative distribution function evaluated at
x
. -
.gamma(x, shape, scale = 1.0) : Float64
Calculate the cumulative distribution function evaluated at
x
. -
.gamma32(x, shape, scale = 1.0_f32) : Float32
Calculate the cumulative distribution function evaluated at
x
. -
.laplace(x, loc = 0.0, scale = 1.0) : Float64
Calculate the cumulative distribution function evaluated at
x
. -
.laplace32(x, loc = 0.0_f32, scale = 1.0_f32) : Float32
Calculate the cumulative distribution function evaluated at
x
. -
.lognormal(x, loc = 0.0, sigma = 1.0) : Float64
Calculate the cumulative distribution function evaluated at
x
. -
.lognormal32(x, loc = 0.0_f32, sigma = 1.0_f32) : Float32
Calculate the cumulative distribution function evaluated at
x
. -
.normal(x, loc = 0.0, sigma = 1.0) : Float64
Calculate the cumulative distribution function evaluated at
x
. -
.normal32(x, loc = 0.0_f32, sigma = 1.0_f32) : Float32
Calculate the cumulative distribution function evaluated at
x
. -
.poisson(k, lam = 1.0) : Float64
Calculate the cumulative distribution function evaluated at
k
. -
.poisson32(k, lam = 1.0_f32) : Float32
Calculate the cumulative distribution function evaluated at
k
. -
.uniform(x, min, max) : Float64
Calculate the cumulative distribution function evaluated at
x
. -
.uniform32(x, min, max) : Float32
Calculate the cumulative distribution function evaluated at
x
.
Class Method Detail
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 ask
.
@exceptions:
Alea::NaNError
if any of the arguments isNaN
.Alea::InfinityError
if any of the arguments isInfinity
.Alea::UndefinedError
ifdf
is negative or zero.
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 ask
.
@exceptions:
Alea::NaNError
if any of the arguments isNaN
.Alea::InfinityError
if any of the arguments isInfinity
.Alea::UndefinedError
ifdf
is negative or zero.
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:
Alea::NaNError
if any of the arguments isNaN
.Alea::InfinityError
if any of the arguments isInfinity
.Alea::UndefinedError
ifscale
is negative or zero.
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:
Alea::NaNError
if any of the arguments isNaN
.Alea::InfinityError
if any of the arguments isInfinity
.Alea::UndefinedError
ifscale
is negative or zero.
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 ask
.scale
: scale parameter of the distribution; usually mentioned asθ
.
@exceptions:
Alea::NaNError
if any of the arguments isNaN
.Alea::InfinityError
if any of the arguments isInfinity
.Alea::UndefinedError
if any ofshape
orscale
is negative or zero.
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 ask
.scale
: scale parameter of the distribution; usually mentioned asθ
.
@exceptions:
Alea::NaNError
if any of the arguments isNaN
.Alea::InfinityError
if any of the arguments isInfinity
.Alea::UndefinedError
if any ofshape
orscale
is negative or zero.
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 asb
.
@exceptions:
Alea::NaNError
if any of the arguments isNaN
.Alea::InfinityError
if any of the arguments isInfinity
.Alea::UndefinedError
ifscale
is negative or zero.
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 asb
.
@exceptions:
Alea::NaNError
if any of the arguments isNaN
.Alea::InfinityError
if any of the arguments isInfinity
.Alea::UndefinedError
ifscale
is negative or zero.
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:
Alea::NaNError
if any of the arguments isNaN
.Alea::InfinityError
if any of the arguments isInfinity
.Alea::UndefinedError
ifsigma
is negative or zero.
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:
Alea::NaNError
if any of the arguments isNaN
.Alea::InfinityError
if any of the arguments isInfinity
.Alea::UndefinedError
ifsigma
is negative or zero.
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:
Alea::NaNError
if any of the arguments isNaN
.Alea::InfinityError
if any of the arguments isInfinity
.Alea::UndefinedError
ifsigma
is negative or zero.
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:
Alea::NaNError
if any of the arguments isNaN
.Alea::InfinityError
if any of the arguments isInfinity
.Alea::UndefinedError
ifsigma
is negative or zero.
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:
Alea::NaNError
if any of the arguments isNaN
.Alea::InfinityError
if any of the arguments isInfinity
.Alea::UndefinedError
iflam
is negative or zero.
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:
Alea::NaNError
if any of the arguments isNaN
.Alea::InfinityError
if any of the arguments isInfinity
.Alea::UndefinedError
iflam
is negative or zero.
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 asa
.max
: right bound parameter of range of the distribution; usually mentioned asb
.
@notes:
- range is
[min, max)
.
@exceptions:
Alea::NaNError
if any of the arguments bound isNaN
.Alea::InfinityError
if any of the arguments bound isInfinity
.Alea::UndefinedError
ifmax
is less thanmin
.
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 asa
.max
: right bound parameter of range of the distribution; usually mentioned asb
.
@notes:
- range is
[min, max)
.
@exceptions:
Alea::NaNError
if any of the arguments bound isNaN
.Alea::InfinityError
if any of the arguments bound isInfinity
.Alea::UndefinedError
ifmax
is less thanmin
.