package prbnmcn-stats
Module Fin.RationalSource
Q-valued finitely supported distributions.
include Stats_intf.Fin_dist with type r = Q.t and type state = Random.State.t
The type of finite probability measures with domain 'a and range r.
The type of finite measures with domain 'a and range r.
Constructing r-valued finitely supported functions.
from_fun len f constructs a finite function with support 0; ...; len-1.
from_array a returns a finite function wrapping the array a.
val of_assoc :
(module Hashtbl.S with type key = 'k) ->
('k * r) array ->
('k, r) Stats_intf.fin_funfrom_assoc h a returns a finite function constructed from the bindings in a. The finite function is backed by a hash table whose implementation is given through the first class module h. The behaviour of the function if elements in the support appear more than once is unspecified.
Constructing measures and probabilities
Creates a finitely supported measure from a finite function. A measure is not necessarily normalized.
Creates a finitely supported probability from a finite function. A probability is normalized.
Forgetful map from the type of finite probabilities to the type of measures.
Computes the empirical measure of an array of elements. Each element present in the array is mapped to its count.
Binomial distribution. binomial p n returns the probability of having k successes over n experiments, according to a biased coin p.
Using measures and probabilities
Integrates a function against a finitely supported measure.
Evaluates a finitely supported probability on argument. Returns 0 if the argument is out of the support.
Evaluates a finitely supported measure on argument. Returns 0 if the argument is out of the support.
Iterates the given function on the support of the probability.
Iterates the given function on the support of the measure.
Samples from a finitely supported distribution presented as an unnormalized measure. This is mostly useful when sampling only once or twice from a distribution: consider converting to a categorical sampler when sampling repeatedly. Complexity: O(n) with n the cardinality of the support.
Returns the total mass associated to a finitely supported measure.
val mean_generic :
(module Basic_structures.Basic_intf.Module with type t = 't and type R.t = r) ->
't mes ->
'tCompute the mean of a finite measure supported on an Intf.Module.
val quantile :
(module Basic_structures.Basic_intf.Ordered with type t = 'elt) ->
'elt mes ->
r ->
'eltquantile ord mes p computes the pth quantile of mes. The underlying data is totally ordered by ord.
Returns the raw data underlying a finitely supported measure.
Returns the raw data underlying a finitely supported probability.
Pretty print a measure, with elements sorted according to the order relation on the support.
val pp_fin_mes_by_measure :
(Format.formatter -> 'a -> unit) ->
Format.formatter ->
'a mes ->
unitPretty print a measure, with elements sorted by increasing measure..