List Module

Module to compute common statistical measure on list

Functions and values

Function or value Description

cov list1 list2

Full Usage: cov list1 list2

Parameters:
    list1 : ^T list - The first input list.
    list2 : ^T list - The second input list.

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

Computes the sample covariance of two random variables

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

list1 : ^T list

The first input list.

list2 : ^T list

The second input list.

Returns: ^U

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

covBy f list

Full Usage: covBy f list

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

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 list.

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 list into a tuple of paired observations.

list : 'T list

The input list.

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 |> List.covBy (fun x -> x.x, x.y) // evaluates to 434.90

covOfPairs list

Full Usage: covOfPairs list

Parameters:
    list : (^T * ^T) list - The input list.

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.

list : (^T * ^T) list

The input list.

Returns: ^U

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

Example

 
 // Consider a list 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 |> List.covOfPairs // evaluates to 434.90

covPopulation list1 list2

Full Usage: covPopulation list1 list2

Parameters:
    list1 : ^T list - The first input list.
    list2 : ^T list - The second input list.

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

Computes the population covariance of two random variables

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

list1 : ^T list

The first input list.

list2 : ^T list

The second input list.

Returns: ^U

population covariance estimator (denominator N)

covPopulationBy f list

Full Usage: covPopulationBy f list

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

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 list.

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 list into a tuple of paired observations.

list : 'T list

The input list.

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 |> List.covPopulationBy (fun x -> x.x, x.y) // evaluates to 347.92

covPopulationOfPairs list

Full Usage: covPopulationOfPairs list

Parameters:
    list : (^T * ^T) list - The input list.

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.

list : (^T * ^T) list

The input list.

Returns: ^U

population covariance estimator (denominator N)

Example

 
 // Consider a list 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 |> List.covPopulationOfPairs // evaluates to 347.92

mean items

Full Usage: mean items

Parameters:
    items : ^T list -

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

computes the population mean (normalized by n)

items : ^T list

Returns: ^a

Example

median xs

Full Usage: median xs

Parameters:
    xs : ^T list -

Returns: ^T
Modifiers: inline

Calculate the median of a list of items.
The result is a tuple of two items whose mean is the median.

xs : ^T list

Returns: ^T

Example

range items

Full Usage: range items

Parameters:
    items : 'a list

Returns: Interval<'a>
items : 'a list
Returns: Interval<'a>