package prbnmcn-stats

  1. Overview
  2. Docs

Probability density functions (pdfs).

val poisson : lambda:float -> int -> float

poisson ~lambda k is the value of the pdf of the Poisson distribution of parameter lambda at the value k.

val poisson_ln : lambda:float -> int -> Log_space.t

The log-pdf of the Poisson distribution. See poisson.

val gaussian : mean:float -> std:float -> float -> float

The pdf of the normal, aka gaussian, distribution.

val gaussian_ln : mean:float -> std:float -> float -> Log_space.t

The log-pdf of the normal distribution. See gaussian.

val exponential : rate:float -> float -> float

The pdf of the exponential distribution.

val exponential_ln : rate:float -> float -> Log_space.t

The log-pdf of the exponential distribution.

val geometric : p:float -> int -> float

geometric ~p k is the value of pdf of the geometric distribution evaluated at k.

val geometric_ln : p:float -> int -> Log_space.t

geometric_ln is the log-pdf of the geometric distribution. See geometric.

val uniform : Stats_intf.range -> float -> float

uniform {min; max} x is the value of the pdf of the uniform distribution on the interval [min;max]. Note that this may evaluate to Float.infinity if min = max.

val uniform_ln : Stats_intf.range -> float -> Log_space.t

The log-pdf of the uniform distribution. See uniform.

val rectangle : min:float array -> max:float array -> float array -> float

rectangle ~min ~max x computes the density of x of the uniform distribution on the axis-aligned box defined by min and max. Be careful: numerical precision issues might arise if the box is too large or has too many dimensions. Use rectangle_ln instead if you can.

  • raises Invalid_argument

    if Array.length min != Array.length max, if the length of min or max is zero or if there exists an index i such that min.(i) > max.(i).

val rectangle_ln : min:float array -> max:float array -> float array -> Log_space.t

The log-pdf of the n-dimensional uniform distribution on an axis-aligned box. See rectangle.

val binomial : p:float -> n:int -> int -> float

binomial ~p ~n k gives the probability of having k successes in n independent Bernouilli trials with probability p.

  • raises Invalid_argument

    if p is not in the [0;1] interval, if n < 0, if k < 0 or if k > n.

val binomial_ln : p:float -> n:int -> int -> Log_space.t

The log-probability of having k successes in n independent Bernouilli trials with probability p. See binomial.

val gamma : shape:int -> scale:float -> float -> float

gamma ~shape ~scale x is the pdf of the gamma distribution.

val gamma_ln : shape:int -> scale:float -> float -> Log_space.t

gamma_ln is the log-pdf of the gamma distribution. See gamma.

val tup2 : ('a -> float) -> ('b -> float) -> ('a * 'b) -> float

Pdf combinator for random variables with n independent components, n = 2.

val tup3 : ('a -> float) -> ('b -> float) -> ('c -> float) -> ('a * 'b * 'c) -> float

Pdf combinator for random variables with n independent components, n = 3.

val tup4 : ('a -> float) -> ('b -> float) -> ('c -> float) -> ('d -> float) -> ('a * 'b * 'c * 'd) -> float

Pdf combinator for random variables with n independent components, n = 4.

val tup5 : ('a -> float) -> ('b -> float) -> ('c -> float) -> ('d -> float) -> ('e -> float) -> ('a * 'b * 'c * 'd * 'e) -> float

Pdf combinator for random variables with n independent components, n = 5.

val tup6 : ('a -> float) -> ('b -> float) -> ('c -> float) -> ('d -> float) -> ('e -> float) -> ('f -> float) -> ('a * 'b * 'c * 'd * 'e * 'f) -> float

Pdf combinator for random variables with n independent components, n = 6.

val tup2_ln : ('a -> Log_space.t) -> ('b -> Log_space.t) -> ('a * 'b) -> Log_space.t

log-pdf combinator for random variables with n independent components, n = 2.

val tup3_ln : ('a -> Log_space.t) -> ('b -> Log_space.t) -> ('c -> Log_space.t) -> ('a * 'b * 'c) -> Log_space.t

log-pdf combinator for random variables with n independent components, n = 3.

val tup4_ln : ('a -> Log_space.t) -> ('b -> Log_space.t) -> ('c -> Log_space.t) -> ('d -> Log_space.t) -> ('a * 'b * 'c * 'd) -> Log_space.t

log-pdf combinator for random variables with n independent components, n = 4.

val tup5_ln : ('a -> Log_space.t) -> ('b -> Log_space.t) -> ('c -> Log_space.t) -> ('d -> Log_space.t) -> ('e -> Log_space.t) -> ('a * 'b * 'c * 'd * 'e) -> Log_space.t

log-pdf combinator for random variables with n independent components, n = 5.

val tup6_ln : ('a -> Log_space.t) -> ('b -> Log_space.t) -> ('c -> Log_space.t) -> ('d -> Log_space.t) -> ('e -> Log_space.t) -> ('f -> Log_space.t) -> ('a * 'b * 'c * 'd * 'e * 'f) -> Log_space.t

log-pdf combinator for random variables with n independent components, n = 6.

val mixture : float array -> (int -> 'a -> float) -> 'a -> float

mixture weights pdfs is the pdf of the convex combination of pdfs. weights need to be normalized, non-negative floats.

  • raises Invalid_argument

    if mixture is empty or if weights contains a negative weight.

val mixture_ln : float array -> (int -> 'a -> Log_space.t) -> 'a -> Log_space.t

mixture_ln weights log_pdfs is the log-pdf of the convex combination of log_pdfs. weights need to be normalized, non-negative floats.

  • raises Invalid_argument

    if mixture is empty or if weights contains a negative weight.

OCaml

Innovation. Community. Security.