Header menu logo FSharp.Stats

List Module

Module to compute common statistical measure on list

Functions and values

Function or value Description

List.cov list1 list2

Full Usage: List.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
Type parameters: ^T, ^U, ^a

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)

List.covBy f list

Full Usage: List.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
Type parameters: 'T, ^a, ^U, ^b

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
val xy: {| x: float; y: float |} list
anonymous record field x: float
anonymous record field y: float
Multiple items
module List from Microsoft.FSharp.Collections

--------------------
type List<'T> = | op_Nil | op_ColonColon of Head: 'T * Tail: 'T list interface IReadOnlyList<'T> interface IReadOnlyCollection<'T> interface IEnumerable interface IEnumerable<'T> member GetReverseIndex: rank: int * offset: int -> int member GetSlice: startIndex: int option * endIndex: int option -> 'T list static member Cons: head: 'T * tail: 'T list -> 'T list member Head: 'T member IsEmpty: bool member Item: index: int -> 'T with get ...

List.covOfPairs list

Full Usage: List.covOfPairs list

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

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

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
val xy: (float * float) list
Multiple items
module List from Microsoft.FSharp.Collections

--------------------
type List<'T> = | op_Nil | op_ColonColon of Head: 'T * Tail: 'T list interface IReadOnlyList<'T> interface IReadOnlyCollection<'T> interface IEnumerable interface IEnumerable<'T> member GetReverseIndex: rank: int * offset: int -> int member GetSlice: startIndex: int option * endIndex: int option -> 'T list static member Cons: head: 'T * tail: 'T list -> 'T list member Head: 'T member IsEmpty: bool member Item: index: int -> 'T with get ...

List.covPopulation list1 list2

Full Usage: List.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
Type parameters: ^T, ^U, ^a

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)

List.covPopulationBy f list

Full Usage: List.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
Type parameters: 'T, ^a, ^U, ^b

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
val xy: {| x: float; y: float |} list
anonymous record field x: float
anonymous record field y: float
Multiple items
module List from Microsoft.FSharp.Collections

--------------------
type List<'T> = | op_Nil | op_ColonColon of Head: 'T * Tail: 'T list interface IReadOnlyList<'T> interface IReadOnlyCollection<'T> interface IEnumerable interface IEnumerable<'T> member GetReverseIndex: rank: int * offset: int -> int member GetSlice: startIndex: int option * endIndex: int option -> 'T list static member Cons: head: 'T * tail: 'T list -> 'T list member Head: 'T member IsEmpty: bool member Item: index: int -> 'T with get ...

List.covPopulationOfPairs list

Full Usage: List.covPopulationOfPairs list

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

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

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
val xy: (float * float) list
Multiple items
module List from Microsoft.FSharp.Collections

--------------------
type List<'T> = | op_Nil | op_ColonColon of Head: 'T * Tail: 'T list interface IReadOnlyList<'T> interface IReadOnlyCollection<'T> interface IEnumerable interface IEnumerable<'T> member GetReverseIndex: rank: int * offset: int -> int member GetSlice: startIndex: int option * endIndex: int option -> 'T list static member Cons: head: 'T * tail: 'T list -> 'T list member Head: 'T member IsEmpty: bool member Item: index: int -> 'T with get ...

List.mean items

Full Usage: List.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

List.median xs

Full Usage: List.median xs

Parameters:
    xs : ^T list -

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

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

List.range items

Full Usage: List.range items

Parameters:
    items : 'a list

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

Type something to start searching.