Namespaces

Types in MathNet.Numerics.Statistics

Type Statistics

Namespace MathNet.Numerics.Statistics

Extension methods to return basic statistics on set of data.

Static Functions

Public Static Functions

double Covariance(this IEnumerable<double> samples1, IEnumerable<double> samples2)

Estimates the unbiased population covariance from the provided samples. On a dataset of size N will use an N-1 normalizer (Bessel's correction). Returns NaN if data has less than two entries or if any entry is NaN.
Parameters
IEnumerable<double> samples1

A subset of samples, sampled from the full population.

IEnumerable<double> samples2

A subset of samples, sampled from the full population.

double EmpiricalCDF(this IEnumerable<float> data, float x)

Estimates the empirical cumulative distribution function (CDF) at x from the provided samples.
Parameters
IEnumerable<float> data

The data sample sequence.

float x

The value where to estimate the CDF at.

double EmpiricalCDF(this IEnumerable<double> data, double x)

Estimates the empirical cumulative distribution function (CDF) at x from the provided samples.
Parameters
IEnumerable<double> data

The data sample sequence.

double x

The value where to estimate the CDF at.

Func<double, double> EmpiricalCDFFunc(this IEnumerable<double> data)

Estimates the empirical cumulative distribution function (CDF) at x from the provided samples.
Parameters
IEnumerable<double> data

The data sample sequence.

double EmpiricalInvCDF(this IEnumerable<double> data, double tau)

Estimates the empirical inverse CDF at tau from the provided samples.
Parameters
IEnumerable<double> data

The data sample sequence.

double tau

Quantile selector, between 0.0 and 1.0 (inclusive).

Func<double, double> EmpiricalInvCDFFunc(this IEnumerable<double> data)

Estimates the empirical inverse CDF at tau from the provided samples.
Parameters
IEnumerable<double> data

The data sample sequence.

double Entropy(IEnumerable<double> data)

Calculates the entropy of a stream of double values in bits. Returns NaN if any of the values in the stream are NaN.
Parameters
IEnumerable<double> data

The data sample sequence.

Double[] FiveNumberSummary(this IEnumerable<double> data)

Estimates {min, lower-quantile, median, upper-quantile, max} from the provided samples. Approximately median-unbiased regardless of the sample distribution (R8).
Parameters
IEnumerable<double> data

The data sample sequence.

double GeometricMean(this IEnumerable<double> data)

Evaluates the geometric mean. Returns NaN if data is empty or if any entry is NaN.
Parameters
IEnumerable<double> data

The data to calculate the geometric mean of.

Return
double

The geometric mean of the sample.

double HarmonicMean(this IEnumerable<double> data)

Evaluates the harmonic mean. Returns NaN if data is empty or if any entry is NaN.
Parameters
IEnumerable<double> data

The data to calculate the harmonic mean of.

Return
double

The harmonic mean of the sample.

double InterquartileRange(this IEnumerable<double> data)

Estimates the inter-quartile range from the provided samples. Approximately median-unbiased regardless of the sample distribution (R8).
Parameters
IEnumerable<double> data

The data sample sequence.

double Kurtosis(this IEnumerable<double> samples)

Estimates the unbiased population kurtosis from the provided samples. Uses a normalizer (Bessel's correction; type 2). Returns NaN if data has less than four entries or if any entry is NaN.
Parameters
IEnumerable<double> samples

A subset of samples, sampled from the full population.

double LowerQuartile(this IEnumerable<double> data)

Estimates the first quartile value from the provided samples. Approximately median-unbiased regardless of the sample distribution (R8).
Parameters
IEnumerable<double> data

The data sample sequence.

double Maximum(this IEnumerable<double> data)

Returns the maximum value in the sample data. Returns NaN if data is empty or if any entry is NaN.
Parameters
IEnumerable<double> data

The sample data.

Return
double

The maximum value in the sample data.

double MaximumAbsolute(this IEnumerable<double> data)

Returns the maximum absolute value in the sample data. Returns NaN if data is empty or if any entry is NaN.
Parameters
IEnumerable<double> data

The sample data.

Return
double

The maximum value in the sample data.

Complex MaximumMagnitudePhase(this IEnumerable<Complex> data)

Returns the maximum magnitude and phase value in the sample data. Returns NaN if data is empty or if any entry is NaN.
Parameters
IEnumerable<Complex> data

The sample data.

Return
Complex

The minimum value in the sample data.

double Mean(this IEnumerable<double> data)

Evaluates the sample mean, an estimate of the population mean. Returns NaN if data is empty or if any entry is NaN.
Parameters
IEnumerable<double> data

The data to calculate the mean of.

Return
double

The mean of the sample.

ValueTuple<double, double> MeanStandardDeviation(this IEnumerable<double> samples)

Estimates the sample mean and the unbiased population standard deviation from the provided samples. On a dataset of size N will use an N-1 normalizer (Bessel's correction). Returns NaN for mean if data is empty or if any entry is NaN and NaN for standard deviation if data has less than two entries or if any entry is NaN.
Parameters
IEnumerable<double> samples

The data to calculate the mean of.

Return
ValueTuple<double, double>

The mean of the sample.

ValueTuple<double, double> MeanVariance(this IEnumerable<double> samples)

Estimates the sample mean and the unbiased population variance from the provided samples. On a dataset of size N will use an N-1 normalizer (Bessel's correction). Returns NaN for mean if data is empty or if any entry is NaN and NaN for variance if data has less than two entries or if any entry is NaN.
Parameters
IEnumerable<double> samples

The data to calculate the mean of.

Return
ValueTuple<double, double>

The mean of the sample.

double Median(this IEnumerable<double> data)

Estimates the sample median from the provided samples (R8).
Parameters
IEnumerable<double> data

The data sample sequence.

double Minimum(this IEnumerable<double> data)

Returns the minimum value in the sample data. Returns NaN if data is empty or if any entry is NaN.
Parameters
IEnumerable<double> data

The sample data.

Return
double

The minimum value in the sample data.

double MinimumAbsolute(this IEnumerable<double> data)

Returns the minimum absolute value in the sample data. Returns NaN if data is empty or if any entry is NaN.
Parameters
IEnumerable<double> data

The sample data.

Return
double

The minimum value in the sample data.

Complex MinimumMagnitudePhase(this IEnumerable<Complex> data)

Returns the minimum magnitude and phase value in the sample data. Returns NaN if data is empty or if any entry is NaN.
Parameters
IEnumerable<Complex> data

The sample data.

Return
Complex

The minimum value in the sample data.

IEnumerable<double> MovingAverage(this IEnumerable<double> samples, int windowSize)

Evaluates the sample mean over a moving window, for each samples. Returns NaN if no data is empty or if any entry is NaN.
Parameters
IEnumerable<double> samples

The sample stream to calculate the mean of.

int windowSize

The number of last samples to consider.

double OrderStatistic(IEnumerable<double> data, int order)

Returns the order statistic (order 1..N) from the provided samples.
Parameters
IEnumerable<double> data

The data sample sequence.

int order

One-based order of the statistic, must be between 1 and N (inclusive).

Func<int, double> OrderStatisticFunc(IEnumerable<double> data)

Returns the order statistic (order 1..N) from the provided samples.
Parameters
IEnumerable<double> data

The data sample sequence.

double Percentile(this IEnumerable<double> data, int p)

Estimates the p-Percentile value from the provided samples. If a non-integer Percentile is needed, use Quantile instead. Approximately median-unbiased regardless of the sample distribution (R8).
Parameters
IEnumerable<double> data

The data sample sequence.

int p

Percentile selector, between 0 and 100 (inclusive).

Func<int, double> PercentileFunc(this IEnumerable<double> data)

Estimates the p-Percentile value from the provided samples. If a non-integer Percentile is needed, use Quantile instead. Approximately median-unbiased regardless of the sample distribution (R8).
Parameters
IEnumerable<double> data

The data sample sequence.

double PopulationCovariance(this IEnumerable<double> population1, IEnumerable<double> population2)

Evaluates the population covariance from the provided full populations. On a dataset of size N will use an N normalizer and would thus be biased if applied to a subset. Returns NaN if data is empty or if any entry is NaN.
Parameters
IEnumerable<double> population1

The full population data.

IEnumerable<double> population2

The full population data.

double PopulationKurtosis(this IEnumerable<double> population)

Evaluates the kurtosis from the full population. Does not use a normalizer and would thus be biased if applied to a subset (type 1). Returns NaN if data has less than three entries or if any entry is NaN.
Parameters
IEnumerable<double> population

The full population data.

double PopulationSkewness(this IEnumerable<double> population)

Evaluates the skewness from the full population. Does not use a normalizer and would thus be biased if applied to a subset (type 1). Returns NaN if data has less than two entries or if any entry is NaN.
Parameters
IEnumerable<double> population

The full population data.

ValueTuple<double, double> PopulationSkewnessKurtosis(this IEnumerable<double> population)

Evaluates the skewness and kurtosis from the full population. Does not use a normalizer and would thus be biased if applied to a subset (type 1).
Parameters
IEnumerable<double> population

The full population data.

double PopulationStandardDeviation(this IEnumerable<double> population)

Evaluates the standard deviation from the provided full population. On a dataset of size N will use an N normalizer and would thus be biased if applied to a subset. Returns NaN if data is empty or if any entry is NaN.
Parameters
IEnumerable<double> population

The full population data.

double PopulationVariance(this IEnumerable<double> population)

Evaluates the variance from the provided full population. On a dataset of size N will use an N normalizer and would thus be biased if applied to a subset. Returns NaN if data is empty or if any entry is NaN.
Parameters
IEnumerable<double> population

The full population data.

double Quantile(this IEnumerable<double> data, double tau)

Estimates the tau-th quantile from the provided samples. The tau-th quantile is the data value where the cumulative distribution function crosses tau. Approximately median-unbiased regardless of the sample distribution (R8).
Parameters
IEnumerable<double> data

The data sample sequence.

double tau

Quantile selector, between 0.0 and 1.0 (inclusive).

double QuantileCustom(this IEnumerable<double> data, double tau, QuantileDefinition definition)

Estimates the tau-th quantile from the provided samples. The tau-th quantile is the data value where the cumulative distribution function crosses tau. The quantile definition can be specified to be compatible with an existing system.
Parameters
IEnumerable<double> data

The data sample sequence.

double tau

Quantile selector, between 0.0 and 1.0 (inclusive).

QuantileDefinition definition

Quantile definition, to choose what product/definition it should be consistent with

Func<double, double> QuantileCustomFunc(this IEnumerable<double> data, QuantileDefinition definition)

Estimates the tau-th quantile from the provided samples. The tau-th quantile is the data value where the cumulative distribution function crosses tau. The quantile definition can be specified to be compatible with an existing system.
Parameters
IEnumerable<double> data

The data sample sequence.

QuantileDefinition definition

Quantile definition, to choose what product/definition it should be consistent with

Func<double, double> QuantileFunc(this IEnumerable<double> data)

Estimates the tau-th quantile from the provided samples. The tau-th quantile is the data value where the cumulative distribution function crosses tau. Approximately median-unbiased regardless of the sample distribution (R8).
Parameters
IEnumerable<double> data

The data sample sequence.

double QuantileRank(this IEnumerable<double> data, double x, RankDefinition definition)

Estimates the quantile tau from the provided samples. The tau-th quantile is the data value where the cumulative distribution function crosses tau. The quantile definition can be specified to be compatible with an existing system.
Parameters
IEnumerable<double> data

The data sample sequence.

double x

Quantile value.

RankDefinition definition

Rank definition, to choose how ties should be handled and what product/definition it should be consistent with

double QuantileRank(this IEnumerable<float> data, float x, RankDefinition definition)

Estimates the quantile tau from the provided samples. The tau-th quantile is the data value where the cumulative distribution function crosses tau. The quantile definition can be specified to be compatible with an existing system.
Parameters
IEnumerable<float> data

The data sample sequence.

float x

Quantile value.

RankDefinition definition

Rank definition, to choose how ties should be handled and what product/definition it should be consistent with

Func<double, double> QuantileRankFunc(this IEnumerable<double> data, RankDefinition definition)

Estimates the quantile tau from the provided samples. The tau-th quantile is the data value where the cumulative distribution function crosses tau. The quantile definition can be specified to be compatible with an existing system.
Parameters
IEnumerable<double> data

The data sample sequence.

RankDefinition definition

Rank definition, to choose how ties should be handled and what product/definition it should be consistent with

Double[] Ranks(this IEnumerable<double> data, RankDefinition definition)

Evaluates the rank of each entry of the provided samples. The rank definition can be specified to be compatible with an existing system.
Parameters
IEnumerable<double> data

The data sample sequence.

RankDefinition definition

Rank definition, to choose how ties should be handled and what product/definition it should be consistent with

double RootMeanSquare(this IEnumerable<double> data)

Evaluates the root mean square (RMS) also known as quadratic mean. Returns NaN if data is empty or if any entry is NaN.
Parameters
IEnumerable<double> data

The data to calculate the RMS of.

double Skewness(this IEnumerable<double> samples)

Estimates the unbiased population skewness from the provided samples. Uses a normalizer (Bessel's correction; type 2). Returns NaN if data has less than three entries or if any entry is NaN.
Parameters
IEnumerable<double> samples

A subset of samples, sampled from the full population.

ValueTuple<double, double> SkewnessKurtosis(this IEnumerable<double> samples)

Estimates the unbiased population skewness and kurtosis from the provided samples in a single pass. Uses a normalizer (Bessel's correction; type 2).
Parameters
IEnumerable<double> samples

A subset of samples, sampled from the full population.

double StandardDeviation(this IEnumerable<double> samples)

Estimates the unbiased population standard deviation from the provided samples. On a dataset of size N will use an N-1 normalizer (Bessel's correction). Returns NaN if data has less than two entries or if any entry is NaN.
Parameters
IEnumerable<double> samples

A subset of samples, sampled from the full population.

double UpperQuartile(this IEnumerable<double> data)

Estimates the third quartile value from the provided samples. Approximately median-unbiased regardless of the sample distribution (R8).
Parameters
IEnumerable<double> data

The data sample sequence.

double Variance(this IEnumerable<double> samples)

Estimates the unbiased population variance from the provided samples. On a dataset of size N will use an N-1 normalizer (Bessel's correction). Returns NaN if data has less than two entries or if any entry is NaN.
Parameters
IEnumerable<double> samples

A subset of samples, sampled from the full population.