Empirical Module

Represents a probability mass function (map from values to probabilities).

Functions and values

Function or value Description

add equalBandwidthOrNominal histA histB

Full Usage: add equalBandwidthOrNominal histA histB

Parameters:
    equalBandwidthOrNominal : bool - Is the binwidth equal for both distributions? For nominal data set to true.
    histA : Map<'a, ^value> - Empirical distribution A
    histB : Map<'a, ^value> - Empirical distribution B

Returns: Map<'a, ^value> New frequency map that results from merged maps histA and histB. Values from keys that are present in both maps are handled by f
Modifiers: inline

Merges two maps into a single map. If a key exists in both maps, the value from mapB is added to the value of mapA.

When applied to continuous data the bandwidths must be equal!This function is not commutative! (add a b) is not equal to (add b a)

equalBandwidthOrNominal : bool

Is the binwidth equal for both distributions? For nominal data set to true.

histA : Map<'a, ^value>

Empirical distribution A

histB : Map<'a, ^value>

Empirical distribution B

Returns: Map<'a, ^value>

New frequency map that results from merged maps histA and histB. Values from keys that are present in both maps are handled by f

create bandwidth data

Full Usage: create bandwidth data

Parameters:
    bandwidth : float -
    data : seq<float> -

Returns: Map<float, float>

Creates probability mass function of the input sequence.
The bandwidth defines the width of the bins the numbers are sorted into.
Bin intervals are half open excluding the upper border: [lower,upper)

bandwidth : float

data : seq<float>

Returns: Map<float, float>

Example

createNominal data

Full Usage: createNominal data

Parameters:
    data : seq<'a> -

Returns: Map<'a, float>
Modifiers: inline
Type parameters: 'a

Creates probability mass function of the categories in the input sequence.

data : seq<'a>

Returns: Map<'a, float>

Example

createNominalWithTemplate template data

Full Usage: createNominalWithTemplate template data

Parameters:
    template : Set<'a> -
    data : seq<'a> -

Returns: Map<'a, float>
Modifiers: inline
Type parameters: 'a

Creates probability mass function of the categories in the input sequence.
A template defines the search space to exclude certain elements or to include elements that are not in the input sequence.
Frequencies are determined based only on the template set.

template : Set<'a>

data : seq<'a>

Returns: Map<'a, float>

Example

exp pmf

Full Usage: exp pmf

Parameters:
    pmf : Map<'a, float> -

Returns: Map<'a, float>

Exponentiates the probabilities

pmf : Map<'a, float>

Returns: Map<'a, float>

Example

getXValues pmf

Full Usage: getXValues pmf

Parameters:
    pmf : Map<'a, float> -

Returns: seq<'a>

Returns distinct values from pmf

pmf : Map<'a, float>

Returns: seq<'a>

Example

getYValues pmf

Full Usage: getYValues pmf

Parameters:
    pmf : Map<'a, float> -

Returns: seq<float>

Returns distinct values from pmf

pmf : Map<'a, float>

Returns: seq<float>

Example

getZip pmf

Full Usage: getZip pmf

Parameters:
    pmf : Map<'a, float> -

Returns: seq<'a * float>

Returns: tuple of (sorted value sequence, probability sequence)

pmf : Map<'a, float>

Returns: seq<'a * float>

Example

log pmf

Full Usage: log pmf

Parameters:
    pmf : Map<'a, float> -

Returns: Map<'a, float>

Log transforms the probabilities

pmf : Map<'a, float>

Returns: Map<'a, float>

Example

maxLike pmf

Full Usage: maxLike pmf

Parameters:
    pmf : Map<'a, float> -

Returns: float

Returns the largest probability in the map.

pmf : Map<'a, float>

Returns: float

Example

mean pmf

Full Usage: mean pmf

Parameters:
    pmf : Map<float, float> -

Returns: float

Computes the mean of a PMF

pmf : Map<float, float>

Returns: float

Example

merge equalBandwidthOrNominal histA histB

Full Usage: merge equalBandwidthOrNominal histA histB

Parameters:
    equalBandwidthOrNominal : bool - Is the binwidth equal for both distributions? For nominal data set to true.
    histA : Map<'a, 'value> - Empirical distribution A
    histB : Map<'a, 'value> - Empirical distribution B

Returns: Map<'a, 'value> New frequency map that results from merged maps histA and histB.

Merges two maps into a single map. If a key exists in both maps, the value in histA is superseded by the value in histB.

When applied to continuous data the bandwidths must be equal!This function is not commutative! (merge a b) is not equal to (merge b a)

equalBandwidthOrNominal : bool

Is the binwidth equal for both distributions? For nominal data set to true.

histA : Map<'a, 'value>

Empirical distribution A

histB : Map<'a, 'value>

Empirical distribution B

Returns: Map<'a, 'value>

New frequency map that results from merged maps histA and histB.

mergeBy equalBandwidthOrNominal f histA histB

Full Usage: mergeBy equalBandwidthOrNominal f histA histB

Parameters:
    equalBandwidthOrNominal : bool - Is the binwidth equal for both distributions? For nominal data set to true.
    f : 'value -> 'value -> 'value - Function to transform values if key is present in both histograms. `histA-value → histB-value → newValue`
    histA : Map<'a, 'value>
    histB : Map<'a, 'value>

Returns: Map<'a, 'value> New frequency map that results from merged maps mapA and mapB. Values from keys that are present in both maps are handled by f

Merges two maps into a single map. If a key exists in both maps, the value is determined by f with the first value being from mapA and the second originating from mapB.

When applied to continuous data the bandwidths must be equal!This function is not commutative! (mergeBy f a b) is not equal to (mergeBy f b a)

equalBandwidthOrNominal : bool

Is the binwidth equal for both distributions? For nominal data set to true.

f : 'value -> 'value -> 'value

Function to transform values if key is present in both histograms. `histA-value → histB-value → newValue`

histA : Map<'a, 'value>
histB : Map<'a, 'value>
Returns: Map<'a, 'value>

New frequency map that results from merged maps mapA and mapB. Values from keys that are present in both maps are handled by f

normalize pmf

Full Usage: normalize pmf

Parameters:
    pmf : Map<'a, float> -

Returns: Map<'a, float>

Normalizes this PMF so the sum of all probabilities equals 1.
Discrete Probability Distribution

pmf : Map<'a, float>

Returns: Map<'a, float>

Example

normalizeBandwidth bw pmf

Full Usage: normalizeBandwidth bw pmf

Parameters:
    bw : float -
    pmf : Map<'a, float> -

Returns: Map<'a, float>

Normalizes this PMF by the bandwidth n/Δx
Frequency Denisty Distribution

bw : float

pmf : Map<'a, float>

Returns: Map<'a, float>

Example

normalizePDD bw pmf

Full Usage: normalizePDD bw pmf

Parameters:
    bw : float -
    pmf : Map<'a, float> -

Returns: Map<'a, float>

Normalizes this PMF by the bandwidth to area equals 1. (n/N)/Δx
Probability Denisty Distribution

bw : float

pmf : Map<'a, float>

Returns: Map<'a, float>

Example

normalizePercentage pmf

Full Usage: normalizePercentage pmf

Parameters:
    pmf : Map<'a, float> -

Returns: Map<'a, float>

Normalizes this PMF so the sum of all probabilities equals 100 percent
Discrete Percentage Probability Distribution

pmf : Map<'a, float>

Returns: Map<'a, float>

Example

normalizewith fraction pmf

Full Usage: normalizewith fraction pmf

Parameters:
    fraction : float -
    pmf : Map<'a, float> -

Returns: Map<'a, float>

Normalizes this PMF so the sum of all probabilities equals fraction

fraction : float

pmf : Map<'a, float>

Returns: Map<'a, float>

Example

ofHistogram hist

Full Usage: ofHistogram hist

Parameters:
    hist : Map<'a, int> -

Returns: Map<'a, float>

Creates Pmf of a Histogram (normalize by n)

hist : Map<'a, int>

Returns: Map<'a, float>

Example

probabilities pmf

Full Usage: probabilities pmf

Parameters:
    pmf : Map<'a, float>

Returns: seq<float>

Gets an unsorted sequence of probabilities

pmf : Map<'a, float>
Returns: seq<float>

probabilityAt pmf x

Full Usage: probabilityAt pmf x

Parameters:
    pmf : Map<'a, float>
    x : 'a

Returns: float

Gets the probability associated with the value x

pmf : Map<'a, float>
x : 'a
Returns: float

sampleFrom pmf

Full Usage: sampleFrom pmf

Parameters:
    pmf : Map<float, float> -

Returns: float

Chooses a random element from this PMF

pmf : Map<float, float>

Returns: float

Example

sum pmf

Full Usage: sum pmf

Parameters:
    pmf : Map<'a, float> -

Returns: float

Returns the total of the probabilities in the map

pmf : Map<'a, float>

Returns: float

Example

var pmf

Full Usage: var pmf

Parameters:
    pmf : Map<float, float> -

Returns: float

Computes the variance of a PMF

pmf : Map<float, float>

Returns: float

Example

varAround mu pmf

Full Usage: varAround mu pmf

Parameters:
    mu : float -
    pmf : Map<float, float> -

Returns: float

Computes the variance of a PMF around mu

mu : float

pmf : Map<float, float>

Returns: float

Example