Seq Module

Module to compute common statistical measure

Nested modules

Modules Description

UtilityFunctions

A module which implements helper functions to provide special statistical measures

Functions and values

Function or value Description

cov seq1 seq2

Full Usage: cov seq1 seq2

Parameters:
    seq1 : seq<^T> - The first input sequence.
    seq2 : seq<^T> - The second input sequence.

Returns: ^U sample covariance estimator (Bessel's correction by N-1)
Modifiers: inline
Type parameters: ^T, ^b, ^U

Computes the sample covariance of two random variables

Returns NaN if data is empty or if any entry is NaN.

seq1 : seq<^T>

The first input sequence.

seq2 : seq<^T>

The second input sequence.

Returns: ^U

sample covariance estimator (Bessel's correction by N-1)

covBy f seq

Full Usage: covBy f seq

Parameters:
    f : 'T -> ^a * ^a - A function applied to transform each element of the input sequence into a tuple of paired observations.
    seq : seq<'T> - The input sequence.

Returns: ^U sample covariance estimator (Bessel's correction by N-1)
Modifiers: inline

Computes the sample covariance of two random variables generated by applying a function to the input sequence.

Returns NaN if data is empty or if any entry is NaN.

f : 'T -> ^a * ^a

A function applied to transform each element of the input sequence into a tuple of paired observations.

seq : seq<'T>

The input sequence.

Returns: ^U

sample covariance estimator (Bessel's correction by N-1)

Example

 
 // To get the sample covariance between x and y observations:
 let xy = [ {| x = 5.; y = 2. |}
            {| x = 12.; y = 8. |}
            {| x = 18.; y = 18. |}
            {| x = -23.; y = -20. |} 
            {| x = 45.; y = 28. |} ]
 
 xy |> Seq.covBy (fun x -> x.x, x.y) // evaluates to 434.90

covOfPairs seq

Full Usage: covOfPairs seq

Parameters:
    seq : seq<^T * ^T> - The input sequence.

Returns: ^U sample covariance estimator (Bessel's correction by N-1)
Modifiers: inline

Computes the sample covariance of two random variables. The covariance will be calculated between the paired observations.

Returns NaN if data is empty or if any entry is NaN.

seq : seq<^T * ^T>

The input sequence.

Returns: ^U

sample covariance estimator (Bessel's correction by N-1)

Example

 
 // Consider a sequence of paired x and y values:
 // [(x1, y1); (x2, y2); (x3, y3); (x4, y4); ... ]
 let xy = [(5., 2.); (12., 8.); (18., 18.); (-23., -20.); (45., 28.)]
 
 // To get the sample covariance between x and y:
 xy |> Seq.covOfPairs // evaluates to 434.90

covPopulation seq1 seq2

Full Usage: covPopulation seq1 seq2

Parameters:
    seq1 : seq<^T> - The first input sequence.
    seq2 : seq<^T> - The second input sequence.

Returns: ^U population covariance estimator (denominator N)
Modifiers: inline
Type parameters: ^T, ^b, ^U

Computes the population covariance of two random variables

Returns NaN if data is empty or if any entry is NaN.

seq1 : seq<^T>

The first input sequence.

seq2 : seq<^T>

The second input sequence.

Returns: ^U

population covariance estimator (denominator N)

covPopulationBy f seq

Full Usage: covPopulationBy f seq

Parameters:
    f : 'T -> ^a * ^a - A function applied to transform each element of the input sequence into a tuple of paired observations.
    seq : seq<'T> - The input sequence.

Returns: ^U population covariance estimator (denominator N)
Modifiers: inline

Computes the population covariance of two random variables generated by applying a function to the input sequence.

Returns NaN if data is empty or if any entry is NaN.

f : 'T -> ^a * ^a

A function applied to transform each element of the input sequence into a tuple of paired observations.

seq : seq<'T>

The input sequence.

Returns: ^U

population covariance estimator (denominator N)

Example

 
 // To get the population covariance between x and y observations:
 let xy = [ {| x = 5.; y = 2. |}
            {| x = 12.; y = 8. |}
            {| x = 18.; y = 18. |}
            {| x = -23.; y = -20. |} 
            {| x = 45.; y = 28. |} ]
 
 xy |> Seq.covPopulationBy (fun x -> x.x, x.y) // evaluates to 347.92

covPopulationOfPairs seq

Full Usage: covPopulationOfPairs seq

Parameters:
    seq : seq<^T * ^T> - The input sequence.

Returns: ^U population covariance estimator (denominator N)
Modifiers: inline

Computes the population covariance of two random variables. The covariance will be calculated between the paired observations.

Returns NaN if data is empty or if any entry is NaN.

seq : seq<^T * ^T>

The input sequence.

Returns: ^U

population covariance estimator (denominator N)

Example

 
 // Consider a sequence of paired x and y values:
 // [(x1, y1); (x2, y2); (x3, y3); (x4, y4); ... ]
 let xy = [(5., 2.); (12., 8.); (18., 18.); (-23., -20.); (45., 28.)]
 
 // To get the population covariance between x and y:
 xy |> Seq.covPopulationOfPairs // evaluates to 347.92

cv items

Full Usage: cv items

Parameters:
    items : seq<^T> - The input sequence.

Returns: ^U Coefficient of Variation of a sample (Bessel's correction by N-1)
Modifiers: inline
Type parameters: ^T, ^U, ^b, ^c

Computes the Coefficient of Variation of a sample (Bessel's correction by N-1)

Returns NaN if data is empty or if any entry is NaN.

items : seq<^T>

The input sequence.

Returns: ^U

Coefficient of Variation of a sample (Bessel's correction by N-1)

cvBy f items

Full Usage: cvBy f items

Parameters:
    f : 'T -> ^a - A function applied to transform each element of the sequence.
    items : seq<'T> - The input sequence.

Returns: ^U Coefficient of Variation of a sample (Bessel's correction by N-1)
Modifiers: inline

Computes the Coefficient of Variation of a sample (Bessel's correction by N-1)

Returns NaN if data is empty or if any entry is NaN.

f : 'T -> ^a

A function applied to transform each element of the sequence.

items : seq<'T>

The input sequence.

Returns: ^U

Coefficient of Variation of a sample (Bessel's correction by N-1)

cvPopulation items

Full Usage: cvPopulation items

Parameters:
    items : seq<^T> - The input sequence.

Returns: ^U Coefficient of Variation of the population
Modifiers: inline

Computes the Coefficient of Variation of the population (population standard deviation)

Returns NaN if data is empty or if any entry is NaN.

items : seq<^T>

The input sequence.

Returns: ^U

Coefficient of Variation of the population

cvPopulationBy f items

Full Usage: cvPopulationBy f items

Parameters:
    f : 'T -> ^a - A function applied to transform each element of the sequence.
    items : seq<'T> - The input sequence.

Returns: ^U Coefficient of Variation of the population
Modifiers: inline

Computes the Coefficient of Variation of the population (population standard deviation)

Returns NaN if data is empty or if any entry is NaN.

f : 'T -> ^a

A function applied to transform each element of the sequence.

items : seq<'T>

The input sequence.

Returns: ^U

Coefficient of Variation of the population

getCvOfReplicates rep data

Full Usage: getCvOfReplicates rep data

Parameters:
    rep : int -
    data : seq<^a> -

Returns: seq<^a0>
Modifiers: inline
Type parameters: ^a, ^a, ^b, ^c

calculates the coefficient of variation based on the sample standard deviations with a given number of replicates present in the sequence

rep : int

data : seq<^a>

Returns: seq<^a0>

Example

getMeanOfReplicates rep data

Full Usage: getMeanOfReplicates rep data

Parameters:
    rep : int -
    data : seq<^a> -

Returns: seq<^a0>
Modifiers: inline
Type parameters: ^a, ^a

calculates the sample means with a given number of replicates present in the sequence

rep : int

data : seq<^a>

Returns: seq<^a0>

Example

getStDevOfReplicates rep data

Full Usage: getStDevOfReplicates rep data

Parameters:
    rep : int -
    data : seq<^a> -

Returns: seq<^c>
Modifiers: inline
Type parameters: ^a, ^a, ^b, ^c

calculates the sample standard deviations with a given number of replicates present in the sequence

rep : int

data : seq<^a>

Returns: seq<^c>

Example

mean items

Full Usage: mean items

Parameters:
    items : seq<^T> - The input sequence.

Returns: ^U population mean (Normalized by N)
Modifiers: inline
Type parameters: ^T, ^U

Computes the population mean (Normalized by N)

Returns default value if data is empty or if any entry is NaN.

items : seq<^T>

The input sequence.

Returns: ^U

population mean (Normalized by N)

meanBy f items

Full Usage: meanBy f items

Parameters:
    f : 'T -> ^U - A function applied to transform each element of the sequence.
    items : seq<'T> - The input sequence.

Returns: ^U population mean (Normalized by N)
Modifiers: inline
Type parameters: 'T, ^U

Computes the population mean (Normalized by N)s

Returns NaN if data is empty or if any entry is NaN.

f : 'T -> ^U

A function applied to transform each element of the sequence.

items : seq<'T>

The input sequence.

Returns: ^U

population mean (Normalized by N)

meanGeometric items

Full Usage: meanGeometric items

Parameters:
    items : seq<^T> - The input sequence.

Returns: ^U gemetric mean
Modifiers: inline
Type parameters: ^T, ^U

Computes gemetric mean

Returns NaN if data is empty or if any entry is NaN.

items : seq<^T>

The input sequence.

Returns: ^U

gemetric mean

meanGeometricBy f items

Full Usage: meanGeometricBy f items

Parameters:
    f : 'T -> ^a - A function applied to transform each element of the sequence.
    items : seq<'T> - The input sequence.

Returns: ^U gemetric mean
Modifiers: inline

Computes gemetric mean

Returns NaN if data is empty or if any entry is NaN.

f : 'T -> ^a

A function applied to transform each element of the sequence.

items : seq<'T>

The input sequence.

Returns: ^U

gemetric mean

meanHarmonic items

Full Usage: meanHarmonic items

Parameters:
    items : seq<^T> - The input sequence.

Returns: ^U harmonic mean
Modifiers: inline

Computes harmonic mean

Returns NaN if data is empty or if any entry is NaN.

items : seq<^T>

The input sequence.

Returns: ^U

harmonic mean

meanHarmonicBy f items

Full Usage: meanHarmonicBy f items

Parameters:
    f : 'T -> ^U - A function applied to transform each element of the sequence.
    items : seq<'T> - The input sequence.

Returns: ^U harmonic mean
Modifiers: inline
Type parameters: 'T, ^U

Computes harmonic mean

Returns NaN if data is empty or if any entry is NaN.

f : 'T -> ^U

A function applied to transform each element of the sequence.

items : seq<'T>

The input sequence.

Returns: ^U

harmonic mean

meanQuadratic items

Full Usage: meanQuadratic items

Parameters:
    items : seq<^T> - The input sequence.

Returns: ^U quadratic mean
Modifiers: inline

Computes quadratic mean

Returns NaN if data is empty or if any entry is NaN.

items : seq<^T>

The input sequence.

Returns: ^U

quadratic mean

meanQuadraticBy f items

Full Usage: meanQuadraticBy f items

Parameters:
    f : ^a -> ^b - A function applied to transform each element of the sequence.
    items : seq<^T> - The input sequence.

Returns: ^U quadratic mean
Modifiers: inline

Computes quadratic mean

Returns NaN if data is empty or if any entry is NaN.

f : ^a -> ^b

A function applied to transform each element of the sequence.

items : seq<^T>

The input sequence.

Returns: ^U

quadratic mean

meanTruncated percent data

Full Usage: meanTruncated percent data

Parameters:
    percent : float
    data : seq<^T>

Returns: ^U truncated (trimmed) mean
Modifiers: inline
Type parameters: ^T, ^U

Computes the truncated (trimmed) mean where x percent of the highest, and x percent of the lowest values are discarded (total 2x)

Returns NaN if data is empty or if any entry is NaN.

percent : float
data : seq<^T>
Returns: ^U

truncated (trimmed) mean

meanTruncatedBy f percent data

Full Usage: meanTruncatedBy f percent data

Parameters:
    f : 'T -> ^U - A function applied to transform each element of the sequence.
    percent : float
    data : seq<'T>

Returns: ^U truncated (trimmed) mean
Modifiers: inline
Type parameters: 'T, ^U

Computes the truncated (trimmed) mean

Returns NaN if data is empty or if any entry is NaN.

f : 'T -> ^U

A function applied to transform each element of the sequence.

percent : float
data : seq<'T>
Returns: ^U

truncated (trimmed) mean

median items

Full Usage: median items

Parameters:
    items : seq<^T> -

Returns: ^T
Modifiers: inline
Type parameters: ^T, ^a

Sample Median

items : seq<^T>

Returns: ^T

Example

medianAbsoluteDev data

Full Usage: medianAbsoluteDev data

Parameters:
    data : seq<float> -

Returns: float

Median absolute deviation (MAD)

data : seq<float>

Returns: float

Example

range items

Full Usage: range items

Parameters:
    items : seq<'a>

Returns: Interval<'a>
Modifiers: inline
Type parameters: 'a
items : seq<'a>
Returns: Interval<'a>

rangeBy f items

Full Usage: rangeBy f items

Parameters:
    f : 'a -> 'b
    items : seq<'a>

Returns: Interval<'a>
Modifiers: inline
f : 'a -> 'b
items : seq<'a>
Returns: Interval<'a>

sem items

Full Usage: sem items

Parameters:
    items : seq<^T> -

Returns: float
Modifiers: inline

Computes the standard error of the mean (SEM) with bessel corrected sample standard deviation

items : seq<^T>

Returns: float

Example

stDev items

Full Usage: stDev items

Parameters:
    items : seq<^T> - The input sequence.

Returns: ^U standard deviation of a sample (Bessel's correction by N-1)
Modifiers: inline
Type parameters: ^T, ^a, ^b, ^U

Computes the sample standard deviation

Returns NaN if data is empty or if any entry is NaN.

items : seq<^T>

The input sequence.

Returns: ^U

standard deviation of a sample (Bessel's correction by N-1)

stDevBy f items

Full Usage: stDevBy f items

Parameters:
    f : 'T -> ^a - A function applied to transform each element of the sequence.
    items : seq<'T> - The input sequence.

Returns: ^U standard deviation of a sample (Bessel's correction by N-1)
Modifiers: inline

Computes the sample standard deviation

Returns NaN if data is empty or if any entry is NaN.

f : 'T -> ^a

A function applied to transform each element of the sequence.

items : seq<'T>

The input sequence.

Returns: ^U

standard deviation of a sample (Bessel's correction by N-1)

stDevPopulation items

Full Usage: stDevPopulation items

Parameters:
    items : seq<^T> - The input sequence.

Returns: ^U population standard deviation (denominator = N)
Modifiers: inline
Type parameters: ^T, ^a, ^b, ^U

Computes the population standard deviation (denominator = N)

Returns NaN if data is empty or if any entry is NaN.

items : seq<^T>

The input sequence.

Returns: ^U

population standard deviation (denominator = N)

stDevPopulationBy f items

Full Usage: stDevPopulationBy f items

Parameters:
    f : 'T -> ^a - A function applied to transform each element of the sequence.
    items : seq<'T> - The input sequence.

Returns: ^U population standard deviation (denominator = N)
Modifiers: inline

Computes the population standard deviation (denominator = N)

Returns NaN if data is empty or if any entry is NaN.

f : 'T -> ^a

A function applied to transform each element of the sequence.

items : seq<'T>

The input sequence.

Returns: ^U

population standard deviation (denominator = N)

stats items

Full Usage: stats items

Parameters:
    items : seq<^T> -

Returns: SummaryStats<^T>
Modifiers: inline
Type parameters: ^T, ^a, ^b

Returns SummeryStats of deq with N, mean, sum-of-squares, minimum and maximum

items : seq<^T>

Returns: SummaryStats<^T>

Example

var items

Full Usage: var items

Parameters:
    items : seq<^T> - The input sequence.

Returns: ^U variance of a sample (Bessel's correction by N-1)
Modifiers: inline
Type parameters: ^T, ^U, ^a

Computes the sample variance (Bessel's correction by N-1)

Returns NaN if data is empty or if any entry is NaN.

items : seq<^T>

The input sequence.

Returns: ^U

variance of a sample (Bessel's correction by N-1)

varBy f items

Full Usage: varBy f items

Parameters:
    f : 'T -> ^a - A function applied to transform each element of the sequence.
    items : seq<'T> - The input sequence.

Returns: ^U variance of a sample (Bessel's correction by N-1)
Modifiers: inline

Computes the sample variance (Bessel's correction by N-1)

Returns NaN if data is empty or if any entry is NaN.

f : 'T -> ^a

A function applied to transform each element of the sequence.

items : seq<'T>

The input sequence.

Returns: ^U

variance of a sample (Bessel's correction by N-1)

varPopulation items

Full Usage: varPopulation items

Parameters:
    items : seq<^T> - The input sequence.

Returns: ^U population variance estimator (denominator N)
Modifiers: inline
Type parameters: ^T, ^U, ^a

Computes variance of the given values (denominator N)

Returns NaN if data is empty or if any entry is NaN.

items : seq<^T>

The input sequence.

Returns: ^U

population variance estimator (denominator N)

varPopulationBy f items

Full Usage: varPopulationBy f items

Parameters:
    f : 'T -> ^a - A function applied to transform each element of the sequence.
    items : seq<'T> - The input sequence.

Returns: ^U population variance estimator (denominator N)
Modifiers: inline

Computes variance of the given values (denominator N)

Returns NaN if data is empty or if any entry is NaN.

f : 'T -> ^a

A function applied to transform each element of the sequence.

items : seq<'T>

The input sequence.

Returns: ^U

population variance estimator (denominator N)

weightedMean weights items

Full Usage: weightedMean weights items

Parameters:
    weights : seq<^T>
    items : seq<^T>

Returns: ^c -> ^b
Modifiers: inline

Computes the Weighted Mean of the given values.

weights : seq<^T>
items : seq<^T>
Returns: ^c -> ^b