Generated by DocFX

Class Measures

Set of statistics measures, such as Mean(Double[]), Variance(Double[]) and StandardDeviation(Double[], Boolean).

Inheritance
System.Object
Measures
Namespace: ISynergy.Framework.Mathematics.Statistics
Assembly: ISynergy.Framework.Mathematics.dll
Syntax
public static class Measures : object

Methods

View Source

ContraHarmonicMean(Double[])

Computes the contraharmonic mean of the given values.

Declaration
public static double ContraHarmonicMean(double[] values)
Parameters
Type Name Description
System.Double[] values

A unsigned short array containing the vector members.

Returns
Type Description
System.Double

The contraharmonic mean of the given data.

View Source

ContraHarmonicMean(Double[], Int32)

Computes the contraharmonic mean of the given values.

Declaration
public static double ContraHarmonicMean(double[] values, int order)
Parameters
Type Name Description
System.Double[] values

A unsigned short array containing the vector members.

System.Int32 order

The order of the harmonic mean. Default is 1.

Returns
Type Description
System.Double

The contraharmonic mean of the given data.

View Source

Correlation(Double[][])

Calculates the correlation matrix for a matrix of samples.

Declaration
public static double[][] Correlation(this double[][] matrix)
Parameters
Type Name Description
System.Double[][] matrix

A multi-dimensional array containing the matrix values.

Returns
Type Description
System.Double[][]

The correlation matrix.

Remarks

In statistics and probability theory, the correlation matrix is the same as the covariance matrix of the standardized random variables.

View Source

Correlation(Double[][], Double[], Double[])

Calculates the correlation matrix for a matrix of samples.

Declaration
public static double[][] Correlation(this double[][] matrix, double[] means, double[] standardDeviations)
Parameters
Type Name Description
System.Double[][] matrix

A multi-dimensional array containing the matrix values.

System.Double[] means

The mean value of the given values, if already known.

System.Double[] standardDeviations

The values' standard deviation vector, if already known.

Returns
Type Description
System.Double[][]

The correlation matrix.

Remarks

In statistics and probability theory, the correlation matrix is the same as the covariance matrix of the standardized random variables.

View Source

Correlation(Double[,])

Calculates the correlation matrix for a matrix of samples.

Declaration
public static double[, ] Correlation(this double[, ] matrix)
Parameters
Type Name Description
System.Double[,] matrix

A multi-dimensional array containing the matrix values.

Returns
Type Description
System.Double[,]

The correlation matrix.

Remarks

In statistics and probability theory, the correlation matrix is the same as the covariance matrix of the standardized random variables.

View Source

Correlation(Double[,], Double[], Double[])

Calculates the correlation matrix for a matrix of samples.

Declaration
public static double[, ] Correlation(this double[, ] matrix, double[] means, double[] standardDeviations)
Parameters
Type Name Description
System.Double[,] matrix

A multi-dimensional array containing the matrix values.

System.Double[] means

The mean value of the given values, if already known.

System.Double[] standardDeviations

The values' standard deviation vector, if already known.

Returns
Type Description
System.Double[,]

The correlation matrix.

Remarks

In statistics and probability theory, the correlation matrix is the same as the covariance matrix of the standardized random variables.

View Source

Covariance(Double[], Double, Double[], Double, Boolean)

Computes the Covariance between two arrays of values.

Declaration
public static double Covariance(this double[] vector1, double mean1, double[] vector2, double mean2, bool unbiased = true)
Parameters
Type Name Description
System.Double[] vector1

A number array containing the first vector elements.

System.Double mean1

The mean value of vector1, if known.

System.Double[] vector2

A number array containing the second vector elements.

System.Double mean2

The mean value of vector2, if known.

System.Boolean unbiased

Pass true to compute the sample variance; or pass false to compute the population variance. See remarks for more details.

Returns
Type Description
System.Double

The variance of the given data.

Remarks

Setting unbiased to true will make this method compute the variance σ² using the sample variance, which is an unbiased estimator of the true population variance. Setting this parameter to true will thus compute σ² using the following formula:

                      N
   σ² = 1 / (N - 1)  ∑   (x_i − μ)²
                      i=1

Setting unbiased to false will assume the given values already represent the whole population, and will compute the population variance using the formula:

                      N
   σ² =   (1 / N)    ∑   (x_i − μ)²
                      i=1
View Source

Covariance(Double[], Double[], Boolean)

Computes the Covariance between two arrays of values.

Declaration
public static double Covariance(this double[] vector1, double[] vector2, bool unbiased = true)
Parameters
Type Name Description
System.Double[] vector1

A number array containing the first vector elements.

System.Double[] vector2

A number array containing the second vector elements.

System.Boolean unbiased

Pass true to compute the sample variance; or pass false to compute the population variance. See remarks for more details.

Returns
Type Description
System.Double

The variance of the given data.

Remarks

Setting unbiased to true will make this method compute the variance σ² using the sample variance, which is an unbiased estimator of the true population variance. Setting this parameter to true will thus compute σ² using the following formula:

                      N
   σ² = 1 / (N - 1)  ∑   (x_i − μ)²
                      i=1

Setting unbiased to false will assume the given values already represent the whole population, and will compute the population variance using the formula:

                      N
   σ² =   (1 / N)    ∑   (x_i − μ)²
                      i=1
View Source

Covariance(Double[][])

Calculates the covariance matrix of a sample matrix.

Declaration
public static double[][] Covariance(this double[][] matrix)
Parameters
Type Name Description
System.Double[][] matrix

A number multi-dimensional array containing the matrix values.

Returns
Type Description
System.Double[][]

The covariance matrix.

Remarks

In statistics and probability theory, the covariance matrix is a matrix of covariances between elements of a vector. It is the natural generalization to higher dimensions of the concept of the variance of a scalar-valued random variable.

View Source

Covariance(Double[][], Double[])

Calculates the covariance matrix of a sample matrix.

Declaration
public static double[][] Covariance(this double[][] matrix, double[] means)
Parameters
Type Name Description
System.Double[][] matrix

A number multi-dimensional array containing the matrix values.

System.Double[] means

The mean value of the given values, if already known.

Returns
Type Description
System.Double[][]

The covariance matrix.

Remarks

In statistics and probability theory, the covariance matrix is a matrix of covariances between elements of a vector. It is the natural generalization to higher dimensions of the concept of the variance of a scalar-valued random variable.

View Source

Covariance(Double[][], Int32)

Calculates the covariance matrix of a sample matrix.

Declaration
public static double[][] Covariance(this double[][] matrix, int dimension)
Parameters
Type Name Description
System.Double[][] matrix

A number multi-dimensional array containing the matrix values.

System.Int32 dimension

The dimension of the matrix to consider as observations. Pass 0 if the matrix has observations as rows and variables as columns, pass 1 otherwise. Default is 0.

Returns
Type Description
System.Double[][]

The covariance matrix.

Remarks

In statistics and probability theory, the covariance matrix is a matrix of covariances between elements of a vector. It is the natural generalization to higher dimensions of the concept of the variance of a scalar-valued random variable.

View Source

Covariance(Double[,])

Calculates the covariance matrix of a sample matrix.

Declaration
public static double[, ] Covariance(this double[, ] matrix)
Parameters
Type Name Description
System.Double[,] matrix

A number multi-dimensional array containing the matrix values.

Returns
Type Description
System.Double[,]

The covariance matrix.

Remarks

In statistics and probability theory, the covariance matrix is a matrix of covariances between elements of a vector. It is the natural generalization to higher dimensions of the concept of the variance of a scalar-valued random variable.

View Source

Covariance(Double[,], Double[])

Calculates the covariance matrix of a sample matrix.

Declaration
public static double[, ] Covariance(this double[, ] matrix, double[] means)
Parameters
Type Name Description
System.Double[,] matrix

A number multi-dimensional array containing the matrix values.

System.Double[] means

The mean value of the given values, if already known.

Returns
Type Description
System.Double[,]

The covariance matrix.

Remarks

In statistics and probability theory, the covariance matrix is a matrix of covariances between elements of a vector. It is the natural generalization to higher dimensions of the concept of the variance of a scalar-valued random variable.

View Source

Covariance(Double[,], Int32)

Calculates the covariance matrix of a sample matrix.

Declaration
public static double[, ] Covariance(this double[, ] matrix, int dimension)
Parameters
Type Name Description
System.Double[,] matrix

A number multi-dimensional array containing the matrix values.

System.Int32 dimension

The dimension of the matrix to consider as observations. Pass 0 if the matrix has observations as rows and variables as columns, pass 1 otherwise. Default is 0.

Returns
Type Description
System.Double[,]

The covariance matrix.

Remarks

In statistics and probability theory, the covariance matrix is a matrix of covariances between elements of a vector. It is the natural generalization to higher dimensions of the concept of the variance of a scalar-valued random variable.

View Source

Entropy(IList<Int32>, Int32)

Computes the entropy for the given values.

Declaration
public static double Entropy(IList<int> values, int classes)
Parameters
Type Name Description
IList<System.Int32> values

An array of integer symbols.

System.Int32 classes

The number of distinct classes.

Returns
Type Description
System.Double

The evaluated entropy.

View Source

Entropy(IList<Int32>, Int32, Int32)

Computes the entropy for the given values.

Declaration
public static double Entropy(IList<int> values, int startValue, int endValue)
Parameters
Type Name Description
IList<System.Int32> values

An array of integer symbols.

System.Int32 startValue

The starting symbol.

System.Int32 endValue

The ending symbol.

Returns
Type Description
System.Double

The evaluated entropy.

View Source

Entropy(Boolean, Boolean)

Computes the entropy function between an expected value and a predicted value.

Declaration
public static double Entropy(bool expected, bool predicted)
Parameters
Type Name Description
System.Boolean expected
System.Boolean predicted
Returns
Type Description
System.Double
View Source

Entropy(Boolean, Double)

Computes the entropy function between an expected value and a predicted value between 0 and 1.

Declaration
public static double Entropy(bool expected, double predicted)
Parameters
Type Name Description
System.Boolean expected
System.Double predicted
Returns
Type Description
System.Double
View Source

Entropy(Double[])

Computes the entropy for the given values.

Declaration
public static double Entropy(this double[] values)
Parameters
Type Name Description
System.Double[] values

A number array containing the vector values.

Returns
Type Description
System.Double

The calculated entropy for the given values.

View Source

Entropy(Double[], Func<Double, Double>)

Computes the entropy function for a set of numerical values in a given Probability Density Function (pdf).

Declaration
public static double Entropy(this double[] values, Func<double, double> pdf)
Parameters
Type Name Description
System.Double[] values

A number array containing the vector values.

Func<System.Double, System.Double> pdf

A probability distribution function.

Returns
Type Description
System.Double

The distribution's entropy for the given values.

View Source

Entropy(Double[], NumericRange)

Computes the entropy for the given values.

Declaration
public static double Entropy(double[] values, NumericRange valueRange)
Parameters
Type Name Description
System.Double[] values

An array of integer symbols.

NumericRange valueRange

The range of symbols.

Returns
Type Description
System.Double

The evaluated entropy.

View Source

Entropy(Double[], Double)

Computes the entropy for the given values.

Declaration
public static double Entropy(this double[] values, double eps = null)
Parameters
Type Name Description
System.Double[] values

A number array containing the vector values.

System.Double eps

A small constant to avoid s in case the there is a zero between the given values.

Returns
Type Description
System.Double

The calculated entropy for the given values.

View Source

Entropy(Double[], Double, Double)

Computes the entropy for the given values.

Declaration
public static double Entropy(double[] values, double startValue, double endValue)
Parameters
Type Name Description
System.Double[] values

An array of integer symbols.

System.Double startValue

The starting symbol.

System.Double endValue

The ending symbol.

Returns
Type Description
System.Double

The evaluated entropy.

View Source

Entropy(Double[], Double[], Func<Double, Double>)

Computes the entropy function for a set of numerical values in a given Probability Density Function (pdf).

Declaration
public static double Entropy(this double[] values, double[] weights, Func<double, double> pdf)
Parameters
Type Name Description
System.Double[] values

A number array containing the vector values.

System.Double[] weights

The importance for each sample.

Func<System.Double, System.Double> pdf

A probability distribution function.

Returns
Type Description
System.Double

The distribution's entropy for the given values.

View Source

Entropy(Double[,])

Computes the entropy for the given values.

Declaration
public static double Entropy(this double[, ] values)
Parameters
Type Name Description
System.Double[,] values

A number matrix containing the matrix values.

Returns
Type Description
System.Double

The calculated entropy for the given values.

View Source

Entropy(Double[,], Double)

Computes the entropy for the given values.

Declaration
public static double Entropy(this double[, ] values, double eps = null)
Parameters
Type Name Description
System.Double[,] values

A number matrix containing the matrix values.

System.Double eps

A small constant to avoid s in case the there is a zero between the given values.

Returns
Type Description
System.Double

The calculated entropy for the given values.

View Source

Entropy(Int32[], Int32)

Computes the entropy for the given values.

Declaration
public static double Entropy(int[] values, int classes)
Parameters
Type Name Description
System.Int32[] values

An array of integer symbols.

System.Int32 classes

The number of distinct classes.

Returns
Type Description
System.Double

The evaluated entropy.

View Source

ExponentialWeightedCovariance(Double[][], Double, Boolean)

Calculates the exponentially weighted covariance matrix.

Declaration
public static double[, ] ExponentialWeightedCovariance(this double[][] matrix, double alpha = null, bool unbiased = false)
Parameters
Type Name Description
System.Double[][] matrix

A matrix of observations whose EW covariance matrix will be calculated. It is assumed that the matrix is ordered with the most recent observations at the bottom of the matrix.

System.Double alpha

The weighting to be applied to the calculation. A higher alpha discounts older observations faster. Alpha must be between 0 and 1 (inclusive).

System.Boolean unbiased

Use a standard estimation bias correction.

Returns
Type Description
System.Double[,]

Returns a vector containing the exponentially weighted average of the columns of the given matrix.

Examples

The following example shows how to compute the EW covariance matrix.

View Source

ExponentialWeightedCovariance(Double[][], Int32, Double, Boolean)

Calculates the exponentially weighted covariance matrix.

Declaration
public static double[, ] ExponentialWeightedCovariance(this double[][] matrix, int window, double alpha = null, bool unbiased = false)
Parameters
Type Name Description
System.Double[][] matrix

A matrix of observations whose EW covariance matrix will be calculated. It is assumed that the matrix is ordered with the most recent observations at the bottom of the matrix.

System.Int32 window

The number of rows to be used in the calculation.

System.Double alpha

The weighting to be applied to the calculation. A higher alpha discounts older observations faster. Alpha must be between 0 and 1 (inclusive).

System.Boolean unbiased

Use a standard estimation bias correction.

Returns
Type Description
System.Double[,]

Returns a vector containing the exponentially weighted average of the columns of the given matrix.

Examples

The following example shows how to compute the EW covariance matrix.

View Source

ExponentialWeightedMean(Double[], Double)

Calculates the exponentially weighted mean.

Declaration
public static double ExponentialWeightedMean(this double[] values, double alpha = null)
Parameters
Type Name Description
System.Double[] values

A vector of observations whose EW mean will be calculated. It is assumed that the vector is ordered with the most recent observations at the end of the vector (and the oldest observations at the start).

System.Double alpha

The weighting to be applied to the calculation. A higher alpha discounts older observations faster. Alpha must be between 0 and 1 (inclusive).

Returns
Type Description
System.Double

Returns a giving the exponentially weighted average of the vector.

Examples

The following example shows how to compute the EW mean.

View Source

ExponentialWeightedMean(Double[], Int32, Double)

Calculates the exponentially weighted mean.

Declaration
public static double ExponentialWeightedMean(this double[] values, int window, double alpha = null)
Parameters
Type Name Description
System.Double[] values

A vector of observations whose EW mean will be calculated. It is assumed that the vector is ordered with the most recent observations at the end of the vector (and the oldest observations at the start).

System.Int32 window

The number of samples to be used in the calculation.

System.Double alpha

The weighting to be applied to the calculation. A higher alpha discounts older observations faster. Alpha must be between 0 and 1 (inclusive).

Returns
Type Description
System.Double

Returns a giving the exponentially weighted average of the vector.

Examples

The following example shows how to compute the EW mean.

View Source

ExponentialWeightedMean(Double[][], Double)

Calculates the exponentially weighted mean vector.

Declaration
public static double[] ExponentialWeightedMean(this double[][] matrix, double alpha = null)
Parameters
Type Name Description
System.Double[][] matrix

A matrix of observations whose EW mean vector will be calculated. It is assumed that the matrix is ordered with the most recent observations at the bottom of the matrix.

System.Double alpha

The weighting to be applied to the calculation. A higher alpha discounts older observations faster. Alpha must be between 0 and 1 (inclusive).

Returns
Type Description
System.Double[]

Returns a vector containing the exponentially weighted average of the columns of the given matrix.

Examples

The following example shows how to compute the EW mean.

View Source

ExponentialWeightedMean(Double[][], Int32, Double)

Calculates the exponentially weighted mean vector.

Declaration
public static double[] ExponentialWeightedMean(this double[][] matrix, int window, double alpha = null)
Parameters
Type Name Description
System.Double[][] matrix

A matrix of observations whose EW mean vector will be calculated. It is assumed that the matrix is ordered with the most recent observations at the bottom of the matrix.

System.Int32 window

The number of rows to be used in the calculation.

System.Double alpha

The weighting to be applied to the calculation. A higher alpha discounts older observations faster. Alpha must be between 0 and 1 (inclusive).

Returns
Type Description
System.Double[]

Returns a vector containing the exponentially weighted average of the columns of the given matrix.

Examples

The following example shows how to compute the EW mean.

View Source

ExponentialWeightedVariance(Double[], Double, Boolean)

Calculates the exponentially weighted variance.

Declaration
public static double ExponentialWeightedVariance(this double[] values, double alpha = null, bool unbiased = false)
Parameters
Type Name Description
System.Double[] values

A vector of observations whose EW variance will be calculated. It is assumed that the vector is ordered with the most recent observations at the end of the vector (and the oldest observations at the start).

System.Double alpha

The weighting to be applied to the calculation. A higher alpha discounts older observations faster. Alpha must be between 0 and 1 (inclusive).

System.Boolean unbiased

Use a standard estimation bias correction.

Returns
Type Description
System.Double

Returns a giving the exponentially weighted variance.

Examples

The following example shows how to compute the EW variance.

View Source

ExponentialWeightedVariance(Double[], Int32, Double, Boolean)

Calculates the exponentially weighted variance.

Declaration
public static double ExponentialWeightedVariance(this double[] values, int window, double alpha = null, bool unbiased = false)
Parameters
Type Name Description
System.Double[] values

A vector of observations whose EW variance will be calculated. It is assumed that the vector is ordered with the most recent observations at the end of the vector (and the oldest observations at the start).

System.Int32 window

The number of samples to be used in the calculation.

System.Double alpha

The weighting to be applied to the calculation. A higher alpha discounts older observations faster. Alpha must be between 0 and 1 (inclusive).

System.Boolean unbiased

Use a standard estimation bias correction.

Returns
Type Description
System.Double

Returns a giving the exponentially weighted variance.

Examples

The following example shows how to compute the EW variance.

View Source

GeometricMean(Double[])

Computes the Geometric mean of the given values.

Declaration
public static double GeometricMean(this double[] values)
Parameters
Type Name Description
System.Double[] values

A double array containing the vector members.

Returns
Type Description
System.Double

The geometric mean of the given data.

View Source

GeometricMean(Int32[])

Computes the geometric mean of the given values.

Declaration
public static double GeometricMean(this int[] values)
Parameters
Type Name Description
System.Int32[] values

A double array containing the vector members.

Returns
Type Description
System.Double

The geometric mean of the given data.

View Source

GetHistogramRange(Int32[], Double)

Get range around median of an histogram containing specified percentage of values.

Declaration
public static NumericRange GetHistogramRange(this int[] values, double percent)
Parameters
Type Name Description
System.Int32[] values

Histogram array.

System.Double percent

Values percentage around median.

Returns
Type Description
NumericRange

Returns the range which contains specified percentage of values.

Remarks

The input array is treated as histogram, i.e. its indexes are treated as values of stochastic function, but array values are treated as "probabilities" (total amount of hits).

The method calculates range of stochastic variable, which summary probability comprises the specified percentage of histogram's hits.

View Source

GrandMean(Double[], Int32[])

Computes the (weighted) grand mean of a set of samples.

Declaration
public static double GrandMean(double[] means, int[] samples)
Parameters
Type Name Description
System.Double[] means

A double array containing the sample means.

System.Int32[] samples

A integer array containing the sample's sizes.

Returns
Type Description
System.Double

The grand mean of the samples.

View Source

HistogramEntropy(Int32[])

Calculate entropy value of an histogram.

Declaration
public static double HistogramEntropy(this int[] values)
Parameters
Type Name Description
System.Int32[] values

Histogram array.

Returns
Type Description
System.Double

Returns entropy value of the specified histogram array.

Remarks

The input array is treated as histogram, i.e. its indexes are treated as values of stochastic function, but array values are treated as "probabilities" (total amount of hits).

View Source

HistogramMax(Int32[])

Gets the maximum value in the histogram.

Declaration
public static int HistogramMax(this int[] values)
Parameters
Type Name Description
System.Int32[] values

Histogram array.

Returns
Type Description
System.Int32

The maximum value in the histogram.

View Source

HistogramMean(Int32[])

Calculate mean value of an histogram.

Declaration
public static double HistogramMean(this int[] values)
Parameters
Type Name Description
System.Int32[] values

Histogram array.

Returns
Type Description
System.Double

Returns mean value.

Remarks

The input array is treated as histogram, i.e. its indexes are treated as values of stochastic function, but array values are treated as "probabilities" (total amount of hits).

View Source

HistogramMedian(Int32[])

Calculate median value of an histogram.

Declaration
public static int HistogramMedian(this int[] values)
Parameters
Type Name Description
System.Int32[] values

Histogram array.

Returns
Type Description
System.Int32

Returns value of median.

Remarks

The input array is treated as histogram, i.e. its indexes are treated as values of stochastic function, but array values are treated as "probabilities" (total amount of hits).

note

The median value is calculated accumulating histogram's values starting from the left point until the sum reaches 50% of histogram's sum.

View Source

HistogramMin(Int32[])

Gets the minimum value in the histogram.

Declaration
public static int HistogramMin(this int[] values)
Parameters
Type Name Description
System.Int32[] values

Histogram array.

Returns
Type Description
System.Int32

The minimum value in the histogram.

View Source

HistogramMode(Int32[])

Calculate mode value of an histogram.

Declaration
public static int HistogramMode(this int[] values)
Parameters
Type Name Description
System.Int32[] values

Histogram array.

Returns
Type Description
System.Int32

Returns mode value of the histogram array.

Remarks

The input array is treated as histogram, i.e. its indexes are treated as values of stochastic function, but array values are treated as "probabilities" (total amount of hits).

note

Returns the minimum mode value if the specified histogram is multimodal.

View Source

HistogramStandardDeviation(Int32[])

Calculate standard deviation of an histogram.

Declaration
public static double HistogramStandardDeviation(this int[] values)
Parameters
Type Name Description
System.Int32[] values

Histogram array.

Returns
Type Description
System.Double

Returns value of standard deviation.

Remarks

The input array is treated as histogram, i.e. its indexes are treated as values of stochastic function, but array values are treated as "probabilities" (total amount of hits).

View Source

HistogramStandardDeviation(Int32[], Double)

Calculate standard deviation of an histogram.

Declaration
public static double HistogramStandardDeviation(this int[] values, double mean)
Parameters
Type Name Description
System.Int32[] values

Histogram array.

System.Double mean

Mean value of the histogram.

Returns
Type Description
System.Double

Returns value of standard deviation.

Remarks

The input array is treated as histogram, i.e. its indexes are treated as values of stochastic function, but array values are treated as "probabilities" (total amount of hits).

The method is an equivalent to the HistogramStandardDeviation(Int32[]) method, but it relies on the passed mean value, which is previously calculated using HistogramMean(Int32[]) method.

View Source

HistogramSum(Int32[])

Calculates the total number of samples in a histogram.

Declaration
public static long HistogramSum(this int[] values)
Parameters
Type Name Description
System.Int32[] values

The histogram array.

Returns
Type Description
System.Int64

The total number of samples in the histogram.

View Source

Kurtosis(Double[], Boolean)

Computes the Kurtosis for the given values.

Declaration
public static double Kurtosis(this double[] values, bool unbiased = true)
Parameters
Type Name Description
System.Double[] values

A number array containing the vector values.

System.Boolean unbiased

True to compute the unbiased estimate of the population kurtosis, false otherwise. Default is true (compute the unbiased estimator).

Returns
Type Description
System.Double

The kurtosis of the given data.

Remarks

The framework uses the same definition used by default in SAS and SPSS.

View Source

Kurtosis(Double[], Double, Boolean)

Computes the Kurtosis for the given values.

Declaration
public static double Kurtosis(this double[] values, double mean, bool unbiased = true)
Parameters
Type Name Description
System.Double[] values

A number array containing the vector values.

System.Double mean

The values' mean, if already known.

System.Boolean unbiased

True to compute the unbiased estimate of the population kurtosis, false otherwise. Default is true (compute the unbiased estimator).

Returns
Type Description
System.Double

The kurtosis of the given data.

Remarks

The framework uses the same definition used by default in SAS and SPSS.

View Source

Kurtosis(Double[][], Boolean)

Computes the Kurtosis vector for the given matrix.

Declaration
public static double[] Kurtosis(this double[][] matrix, bool unbiased = true)
Parameters
Type Name Description
System.Double[][] matrix

A number multi-dimensional array containing the matrix values.

System.Boolean unbiased

True to compute the unbiased estimate of the population kurtosis, false otherwise. Default is true (compute the unbiased estimator).

Returns
Type Description
System.Double[]

The kurtosis vector of the given data.

Remarks

The framework uses the same definition used by default in SAS and SPSS.

View Source

Kurtosis(Double[][], Double[], Boolean)

Computes the Kurtosis vector for the given matrix.

Declaration
public static double[] Kurtosis(this double[][] matrix, double[] means, bool unbiased = true)
Parameters
Type Name Description
System.Double[][] matrix

A number multi-dimensional array containing the matrix values.

System.Double[] means

The mean value of the given values, if already known.

System.Boolean unbiased

True to compute the unbiased estimate of the population kurtosis, false otherwise. Default is true (compute the unbiased estimator).

Returns
Type Description
System.Double[]

The kurtosis vector of the given data.

Remarks

The framework uses the same definition used by default in SAS and SPSS.

View Source

Kurtosis(Double[,], Boolean)

Computes the Kurtosis vector for the given matrix.

Declaration
public static double[] Kurtosis(this double[, ] matrix, bool unbiased = true)
Parameters
Type Name Description
System.Double[,] matrix

A number multi-dimensional array containing the matrix values.

System.Boolean unbiased

True to compute the unbiased estimate of the population kurtosis, false otherwise. Default is true (compute the unbiased estimator).

Returns
Type Description
System.Double[]

The kurtosis vector of the given data.

Remarks

The framework uses the same definition used by default in SAS and SPSS.

View Source

Kurtosis(Double[,], Double[], Boolean)

Computes the sample Kurtosis vector for the given matrix.

Declaration
public static double[] Kurtosis(this double[, ] matrix, double[] means, bool unbiased = true)
Parameters
Type Name Description
System.Double[,] matrix

A number multi-dimensional array containing the matrix values.

System.Double[] means

The mean value of the given values, if already known.

System.Boolean unbiased

True to compute the unbiased estimate of the population kurtosis, false otherwise. Default is true (compute the unbiased estimator).

Returns
Type Description
System.Double[]

The sample kurtosis vector of the given data.

Remarks

The framework uses the same definition used by default in SAS and SPSS.

View Source

LogGeometricMean(Double[])

Computes the log geometric mean of the given values.

Declaration
public static double LogGeometricMean(this double[] values)
Parameters
Type Name Description
System.Double[] values

A double array containing the vector members.

Returns
Type Description
System.Double

The log geometric mean of the given data.

View Source

LogGeometricMean(Int32[])

Computes the log geometric mean of the given values.

Declaration
public static double LogGeometricMean(this int[] values)
Parameters
Type Name Description
System.Int32[] values

A double array containing the vector members.

Returns
Type Description
System.Double

The log geometric mean of the given data.

View Source

LowerQuartile(Double[], Boolean, QuantileMethod, Boolean)

Computes the lower quartile (Q1) for the given data.

Declaration
public static double LowerQuartile(this double[] values, bool alreadySorted = false, QuantileMethod type = default(QuantileMethod), bool inPlace = false)
Parameters
Type Name Description
System.Double[] values

An integer array containing the vector members.

System.Boolean alreadySorted

A boolean parameter informing if the given values have already been sorted.

QuantileMethod type

The quartile definition that should be used. See QuantileMethod for datails.

System.Boolean inPlace

Pass true if the method is allowed to sort values in place, overwriting the its original order.

Returns
Type Description
System.Double

The first quartile of the given data.

View Source

Mean(Double[])

Computes the mean of the given values.

Declaration
public static double Mean(this double[] values)
Parameters
Type Name Description
System.Double[] values

A double array containing the vector members.

Returns
Type Description
System.Double

The mean of the given data.

View Source

Mean(Double[][])

Computes the mean value across all dimensions of the given matrix.

Declaration
public static double Mean(this double[][] matrix)
Parameters
Type Name Description
System.Double[][] matrix
Returns
Type Description
System.Double
View Source

Mean(Double[][], Double[])

Calculates the matrix Mean vector.

Declaration
public static double[] Mean(this double[][] matrix, double[] sums)
Parameters
Type Name Description
System.Double[][] matrix

A matrix whose means will be calculated.

System.Double[] sums

The sum vector containing already calculated sums for each column of the matrix.

Returns
Type Description
System.Double[]

Returns a vector containing the means of the given matrix.

View Source

Mean(Double[][], Int32)

Calculates the matrix Mean vector.

Declaration
public static double[] Mean(this double[][] matrix, int dimension)
Parameters
Type Name Description
System.Double[][] matrix

A matrix whose means will be calculated.

System.Int32 dimension

The dimension along which the means will be calculated. Pass 0 to compute a row vector containing the mean of each column, or 1 to compute a column vector containing the mean of each row. Default value is 0.

Returns
Type Description
System.Double[]

Returns a vector containing the means of the given matrix.

Examples
double[][] matrix = 
{
    new double[] { 2, -1.0, 5 },
    new double[] { 7,  0.5, 9 },
};

// column means are equal to (4.5, -0.25, 7.0)
double[] colMeans = Stats.Mean(matrix, 0);

// row means are equal to (2.0, 5.5)
double[] rowMeans = Stats.Mean(matrix, 1);
View Source

Mean(Double[,])

Computes the mean value across all dimensions of the given matrix.

Declaration
public static double Mean(this double[, ] matrix)
Parameters
Type Name Description
System.Double[,] matrix
Returns
Type Description
System.Double
View Source

Mean(Double[,], Double[])

Calculates the matrix Mean vector.

Declaration
public static double[] Mean(this double[, ] matrix, double[] sums)
Parameters
Type Name Description
System.Double[,] matrix

A matrix whose means will be calculated.

System.Double[] sums

The sum vector containing already calculated sums for each column of the matrix.

Returns
Type Description
System.Double[]

Returns a vector containing the means of the given matrix.

View Source

Mean(Double[,], Int32)

Calculates the matrix Mean vector.

Declaration
public static double[] Mean(this double[, ] matrix, int dimension)
Parameters
Type Name Description
System.Double[,] matrix

A matrix whose means will be calculated.

System.Int32 dimension

The dimension along which the means will be calculated. Pass 0 to compute a row vector containing the mean of each column, or 1 to compute a column vector containing the mean of each row. Default value is 0.

Returns
Type Description
System.Double[]

Returns a vector containing the means of the given matrix.

Examples
double[,] matrix = 
{
   { 2, -1.0, 5 },
   { 7,  0.5, 9 },
};

// column means are equal to (4.5, -0.25, 7.0)
double[] colMeans = Stats.Mean(matrix, 0);

// row means are equal to (2.0, 5.5)
double[] rowMeans = Stats.Mean(matrix, 1);
View Source

Mean(Int32[])

Computes the mean of the given values.

Declaration
public static double Mean(this int[] values)
Parameters
Type Name Description
System.Int32[] values

An integer array containing the vector members.

Returns
Type Description
System.Double

The mean of the given data.

View Source

Mean(Single[])

Computes the mean of the given values.

Declaration
public static float Mean(this float[] values)
Parameters
Type Name Description
System.Single[] values

A float array containing the vector members.

Returns
Type Description
System.Single

The mean of the given data.

View Source

Mean(UInt16[])

Computes the mean of the given values.

Declaration
public static double Mean(this ushort[] values)
Parameters
Type Name Description
System.UInt16[] values

A unsigned short array containing the vector members.

Returns
Type Description
System.Double

The mean of the given data.

View Source

Median(Double[], Boolean, QuantileMethod, Boolean)

Computes the Median of the given values.

Declaration
public static double Median(this double[] values, bool alreadySorted = false, QuantileMethod type = default(QuantileMethod), bool inPlace = false)
Parameters
Type Name Description
System.Double[] values

An integer array containing the vector members.

System.Boolean alreadySorted

A boolean parameter informing if the given values have already been sorted.

QuantileMethod type

The quartile definition that should be used. See QuantileMethod for datails.

System.Boolean inPlace

Pass true if the method is allowed to sort values in place, overwriting the its original order.

Returns
Type Description
System.Double

The median of the given data.

View Source

Median(Double[][], QuantileMethod)

Calculates the matrix Medians vector.

Declaration
public static double[] Median(this double[][] matrix, QuantileMethod type = default(QuantileMethod))
Parameters
Type Name Description
System.Double[][] matrix

A matrix whose medians will be calculated.

QuantileMethod type

The quartile definition that should be used. See QuantileMethod for datails.

Returns
Type Description
System.Double[]

Returns a vector containing the medians of the given matrix.

View Source

Median(Double[,], QuantileMethod)

Calculates the matrix Medians vector.

Declaration
public static double[] Median(this double[, ] matrix, QuantileMethod type = default(QuantileMethod))
Parameters
Type Name Description
System.Double[,] matrix

A matrix whose medians will be calculated.

QuantileMethod type

The quartile definition that should be used. See QuantileMethod for datails.

Returns
Type Description
System.Double[]

Returns a vector containing the medians of the given matrix.

View Source

Median(Int32[], Boolean, QuantileMethod, Boolean)

Computes the Median of the given values.

Declaration
public static double Median(this int[] values, bool alreadySorted = false, QuantileMethod type = default(QuantileMethod), bool inPlace = false)
Parameters
Type Name Description
System.Int32[] values

An integer array containing the vector members.

System.Boolean alreadySorted

A boolean parameter informing if the given values have already been sorted.

QuantileMethod type

The quartile definition that should be used. See QuantileMethod for datails.

System.Boolean inPlace

Pass true if the method is allowed to sort values in place, overwriting the its original order.

Returns
Type Description
System.Double

The median of the given data.

View Source

Mode<T>(T[])

Computes the Mode of the given values.

Declaration
public static T Mode<T>(this T[] values)
Parameters
Type Name Description
T[] values

A number array containing the vector values.

Returns
Type Description
T

The most common value in the given data.

Type Parameters
Name Description
T
View Source

Mode<T>(T[], Boolean, Boolean)

Computes the Mode of the given values.

Declaration
public static T Mode<T>(this T[] values, bool inPlace, bool alreadySorted = false)
Parameters
Type Name Description
T[] values

A number array containing the vector values.

System.Boolean inPlace

True to perform the operation in place, altering the original input vector.

System.Boolean alreadySorted

Pass true if the list of values is already sorted.

Returns
Type Description
T

The most common value in the given data.

Type Parameters
Name Description
T
View Source

Mode<T>(T[], out Int32)

Computes the Mode of the given values.

Declaration
public static T Mode<T>(this T[] values, out int count)
Parameters
Type Name Description
T[] values

A number array containing the vector values.

System.Int32 count

Returns how many times the detected mode happens in the values.

Returns
Type Description
T

The most common value in the given data.

Type Parameters
Name Description
T
View Source

Mode<T>(T[], out Int32, Boolean, Boolean)

Computes the Mode of the given values.

Declaration
public static T Mode<T>(this T[] values, out int count, bool inPlace, bool alreadySorted = false)
Parameters
Type Name Description
T[] values

A number array containing the vector values.

System.Int32 count

Returns how many times the detected mode happens in the values.

System.Boolean inPlace

True to perform the operation in place, altering the original input vector.

System.Boolean alreadySorted

Pass true if the list of values is already sorted.

Returns
Type Description
T

The most common value in the given data.

Type Parameters
Name Description
T
View Source

Mode<T>(T[][])

Calculates the matrix Modes vector.

Declaration
public static T[] Mode<T>(this T[][] matrix)
Parameters
Type Name Description
T[][] matrix

A matrix whose modes will be calculated.

Returns
Type Description
T[]

Returns a vector containing the modes of the given matrix.

Type Parameters
Name Description
T
View Source

Mode<T>(T[,])

Calculates the matrix Modes vector.

Declaration
public static T[] Mode<T>(this T[, ] matrix)
Parameters
Type Name Description
T[,] matrix

A matrix whose modes will be calculated.

Returns
Type Description
T[]

Returns a vector containing the modes of the given matrix.

Type Parameters
Name Description
T
View Source

PooledCovariance(Double[,][], Double[])

Calculates the weighted pooled covariance matrix from a set of covariance matrices.

Declaration
public static double[, ] PooledCovariance(double[, ][] covariances, double[] weights)
Parameters
Type Name Description
System.Double[,][] covariances
System.Double[] weights
Returns
Type Description
System.Double[,]
View Source

PooledStandardDeviation(Boolean, Double[][])

Computes the pooled standard deviation of the given values.

Declaration
public static double PooledStandardDeviation(bool unbiased, params double[][] samples)
Parameters
Type Name Description
System.Boolean unbiased

True to compute a pooled standard deviation using unbiased estimates of the population variance; false otherwise. Default is true.

System.Double[][] samples

The grouped samples.

Returns
Type Description
System.Double
View Source

PooledStandardDeviation(Double[][])

Computes the pooled standard deviation of the given values.

Declaration
public static double PooledStandardDeviation(params double[][] samples)
Parameters
Type Name Description
System.Double[][] samples

The grouped samples.

Returns
Type Description
System.Double
View Source

PooledStandardDeviation(Int32[], Double[], Boolean)

Computes the pooled standard deviation of the given values.

Declaration
public static double PooledStandardDeviation(int[] sizes, double[] variances, bool unbiased = true)
Parameters
Type Name Description
System.Int32[] sizes

The number of samples used to compute the variances.

System.Double[] variances

The unbiased variances for the samples.

System.Boolean unbiased

True to compute a pooled standard deviation using unbiased estimates of the population variance; false otherwise. Default is true.

Returns
Type Description
System.Double
View Source

PooledVariance(Boolean, Double[][])

Computes the pooled variance of the given values.

Declaration
public static double PooledVariance(bool unbiased, params double[][] samples)
Parameters
Type Name Description
System.Boolean unbiased

True to obtain an unbiased estimate of the population variance; false otherwise. Default is true.

System.Double[][] samples

The grouped samples.

Returns
Type Description
System.Double
View Source

PooledVariance(Double[][])

Computes the pooled variance of the given values.

Declaration
public static double PooledVariance(params double[][] samples)
Parameters
Type Name Description
System.Double[][] samples

The grouped samples.

Returns
Type Description
System.Double
View Source

PooledVariance(Int32[], Double[], Boolean)

Computes the pooled variance of the given values.

Declaration
public static double PooledVariance(int[] sizes, double[] variances, bool unbiased = true)
Parameters
Type Name Description
System.Int32[] sizes

The number of samples used to compute the variances.

System.Double[] variances

The unbiased variances for the samples.

System.Boolean unbiased

True to obtain an unbiased estimate of the population variance; false otherwise. Default is true.

Returns
Type Description
System.Double
View Source

Quantile(Double[], Double, Boolean, QuantileMethod, Boolean)

Computes single quantile for the given sequence.

Declaration
public static double Quantile(this double[] values, double probabilities, bool alreadySorted = false, QuantileMethod type = default(QuantileMethod), bool inPlace = false)
Parameters
Type Name Description
System.Double[] values

The sequence of observations.

System.Double probabilities

The auantile probability.

System.Boolean alreadySorted

A boolean parameter informing if the given values have already been sorted.

QuantileMethod type

The quantile type, 1...9.

System.Boolean inPlace

Pass true if the method is allowed to sort values in place, overwriting the its original order.

Returns
Type Description
System.Double

Quantile value.

View Source

Quantiles(Double[], Double[], Boolean, QuantileMethod, Boolean)

Computes multiple quantiles for the given sequence.

Declaration
public static double[] Quantiles(this double[] values, double[] probabilities, bool alreadySorted = false, QuantileMethod type = default(QuantileMethod), bool inPlace = false)
Parameters
Type Name Description
System.Double[] values

The sequence of observations.

System.Double[] probabilities

The sequence of quantile probabilities.

System.Boolean alreadySorted

A boolean parameter informing if the given values have already been sorted.

QuantileMethod type

The quantile type, 1...9.

System.Boolean inPlace

Pass true if the method is allowed to sort values in place, overwriting the its original order.

Returns
Type Description
System.Double[]

Quantile value.

View Source

Quartiles(Double[], out NumericRange, Boolean, QuantileMethod, Boolean)

Computes the Quartiles of the given values.

Declaration
public static double Quartiles(this double[] values, out NumericRange range, bool alreadySorted = false, QuantileMethod type = default(QuantileMethod), bool inPlace = false)
Parameters
Type Name Description
System.Double[] values

An integer array containing the vector members.

NumericRange range

The inter-quartile range for the values.

System.Boolean alreadySorted

A boolean parameter informing if the given values have already been sorted.

QuantileMethod type

The quartile definition that should be used. See QuantileMethod for datails.

System.Boolean inPlace

Pass true if the method is allowed to sort values in place, overwriting the its original order.

Returns
Type Description
System.Double

The second quartile, the median of the given data.

View Source

Quartiles(Double[], out Double, out Double, Boolean, QuantileMethod, Boolean)

Computes the Quartiles of the given values.

Declaration
public static double Quartiles(this double[] values, out double q1, out double q3, bool alreadySorted = false, QuantileMethod type = default(QuantileMethod), bool inPlace = false)
Parameters
Type Name Description
System.Double[] values

An integer array containing the vector members.

System.Double q1

The first quartile.

System.Double q3

The third quartile.

System.Boolean alreadySorted

A boolean parameter informing if the given values have already been sorted.

QuantileMethod type

The quartile definition that should be used. See QuantileMethod for datails.

System.Boolean inPlace

Pass true if the method is allowed to sort values in place, overwriting the its original order.

Returns
Type Description
System.Double

The second quartile, the median of the given data.

View Source

Quartiles(Double[][], out NumericRange[], QuantileMethod)

Computes the Quartiles of the given values.

Declaration
public static double[] Quartiles(this double[][] matrix, out NumericRange[] range, QuantileMethod type = default(QuantileMethod))
Parameters
Type Name Description
System.Double[][] matrix

A matrix whose medians and quartiles will be calculated.

NumericRange[] range

The inter-quartile range for the values.

QuantileMethod type

The quartile definition that should be used. See QuantileMethod for datails.

Returns
Type Description
System.Double[]

The second quartile, the median of the given data.

View Source

Quartiles(Double[][], out Double[], out Double[], QuantileMethod)

Computes the Quartiles of the given values.

Declaration
public static double[] Quartiles(double[][] matrix, out double[] q1, out double[] q3, QuantileMethod type = default(QuantileMethod))
Parameters
Type Name Description
System.Double[][] matrix

A matrix whose medians and quartiles will be calculated.

System.Double[] q1

The first quartile for each column.

System.Double[] q3

The third quartile for each column.

QuantileMethod type

The quartile definition that should be used. See QuantileMethod for datails.

Returns
Type Description
System.Double[]

The second quartile, the median of the given data.

View Source

Quartiles(Double[,], out NumericRange[], QuantileMethod)

Computes the Quartiles of the given values.

Declaration
public static double[] Quartiles(this double[, ] matrix, out NumericRange[] range, QuantileMethod type = default(QuantileMethod))
Parameters
Type Name Description
System.Double[,] matrix

A matrix whose medians and quartiles will be calculated.

NumericRange[] range

The inter-quartile range for the values.

QuantileMethod type

The quartile definition that should be used. See QuantileMethod for datails.

Returns
Type Description
System.Double[]

The second quartile, the median of the given data.

View Source

Quartiles(Double[,], out Double[], out Double[], QuantileMethod)

Computes the Quartiles of the given values.

Declaration
public static double[] Quartiles(double[, ] matrix, out double[] q1, out double[] q3, QuantileMethod type = default(QuantileMethod))
Parameters
Type Name Description
System.Double[,] matrix

A matrix whose medians and quartiles will be calculated.

System.Double[] q1

The first quartile for each column.

System.Double[] q3

The third quartile for each column.

QuantileMethod type

The quartile definition that should be used. See QuantileMethod for datails.

Returns
Type Description
System.Double[]

The second quartile, the median of the given data.

View Source

Scatter(Double[][], Double, Int32)

Calculates the scatter matrix of a sample matrix.

Declaration
public static double[][] Scatter(this double[][] matrix, double divisor, int dimension = 0)
Parameters
Type Name Description
System.Double[][] matrix

A number multi-dimensional array containing the matrix values.

System.Double divisor

A real number to divide each member of the matrix.

System.Int32 dimension

Pass 0 to if mean vector is a row vector, 1 otherwise. Default value is 0.

Returns
Type Description
System.Double[][]

The covariance matrix.

Remarks

By dividing the Scatter matrix by the sample size, we get the population Covariance matrix. By dividing by the sample size minus one, we get the sample Covariance matrix.

View Source

Scatter(Double[][], Double[])

Calculates the scatter matrix of a sample matrix.

Declaration
public static double[][] Scatter(this double[][] matrix, double[] means)
Parameters
Type Name Description
System.Double[][] matrix

A number multi-dimensional array containing the matrix values.

System.Double[] means

The mean value of the given values, if already known.

Returns
Type Description
System.Double[][]

The covariance matrix.

Remarks

By dividing the Scatter matrix by the sample size, we get the population Covariance matrix. By dividing by the sample size minus one, we get the sample Covariance matrix.

View Source

Scatter(Double[][], Double[], Double)

Calculates the scatter matrix of a sample matrix.

Declaration
public static double[][] Scatter(this double[][] matrix, double[] means, double divisor)
Parameters
Type Name Description
System.Double[][] matrix

A number multi-dimensional array containing the matrix values.

System.Double[] means

The mean value of the given values, if already known.

System.Double divisor

A real number to divide each member of the matrix.

Returns
Type Description
System.Double[][]

The covariance matrix.

Remarks

By dividing the Scatter matrix by the sample size, we get the population Covariance matrix. By dividing by the sample size minus one, we get the sample Covariance matrix.

View Source

Scatter(Double[][], Double[], Double, Int32)

Calculates the scatter matrix of a sample matrix.

Declaration
public static double[][] Scatter(double[][] matrix, double[] means, double divisor, int dimension)
Parameters
Type Name Description
System.Double[][] matrix

A number multi-dimensional array containing the matrix values.

System.Double[] means

The mean value of the given values, if already known.

System.Double divisor

A real number to divide each member of the matrix.

System.Int32 dimension

Pass 0 to if mean vector is a row vector, 1 otherwise. Default value is 0.

Returns
Type Description
System.Double[][]

The covariance matrix.

Remarks

By dividing the Scatter matrix by the sample size, we get the population Covariance matrix. By dividing by the sample size minus one, we get the sample Covariance matrix.

View Source

Scatter(Double[][], Double[], Int32)

Calculates the scatter matrix of a sample matrix.

Declaration
public static double[][] Scatter(this double[][] matrix, double[] means, int dimension)
Parameters
Type Name Description
System.Double[][] matrix

A number multi-dimensional array containing the matrix values.

System.Double[] means

The mean value of the given values, if already known.

System.Int32 dimension

Pass 0 to if mean vector is a row vector, 1 otherwise. Default value is 0.

Returns
Type Description
System.Double[][]

The covariance matrix.

Remarks

By dividing the Scatter matrix by the sample size, we get the population Covariance matrix. By dividing by the sample size minus one, we get the sample Covariance matrix.

View Source

Scatter(Double[,], Double[])

Calculates the scatter matrix of a sample matrix.

Declaration
public static double[, ] Scatter(this double[, ] matrix, double[] means)
Parameters
Type Name Description
System.Double[,] matrix

A number multi-dimensional array containing the matrix values.

System.Double[] means

The mean value of the given values, if already known.

Returns
Type Description
System.Double[,]

The covariance matrix.

Remarks

By dividing the Scatter matrix by the sample size, we get the population Covariance matrix. By dividing by the sample size minus one, we get the sample Covariance matrix.

View Source

Scatter(Double[,], Double[], Double)

Calculates the scatter matrix of a sample matrix.

Declaration
public static double[, ] Scatter(this double[, ] matrix, double[] means, double divisor)
Parameters
Type Name Description
System.Double[,] matrix

A number multi-dimensional array containing the matrix values.

System.Double[] means

The mean value of the given values, if already known.

System.Double divisor

A real number to divide each member of the matrix.

Returns
Type Description
System.Double[,]

The covariance matrix.

Remarks

By dividing the Scatter matrix by the sample size, we get the population Covariance matrix. By dividing by the sample size minus one, we get the sample Covariance matrix.

View Source

Scatter(Double[,], Double[], Double, Int32)

Calculates the scatter matrix of a sample matrix.

Declaration
public static double[, ] Scatter(this double[, ] matrix, double[] means, double divisor, int dimension)
Parameters
Type Name Description
System.Double[,] matrix

A number multi-dimensional array containing the matrix values.

System.Double[] means

The mean value of the given values, if already known.

System.Double divisor

A real number to divide each member of the matrix.

System.Int32 dimension

Pass 0 if the mean vector is a row vector, 1 otherwise. Default value is 0.

Returns
Type Description
System.Double[,]

The covariance matrix.

Remarks

By dividing the Scatter matrix by the sample size, we get the population Covariance matrix. By dividing by the sample size minus one, we get the sample Covariance matrix.

View Source

Scatter(Double[,], Double[], Int32)

Calculates the scatter matrix of a sample matrix.

Declaration
public static double[, ] Scatter(this double[, ] matrix, double[] means, int dimension)
Parameters
Type Name Description
System.Double[,] matrix

A number multi-dimensional array containing the matrix values.

System.Double[] means

The mean value of the given values, if already known.

System.Int32 dimension

Pass 0 to if mean vector is a row vector, 1 otherwise. Default value is 0.

Returns
Type Description
System.Double[,]

The covariance matrix.

Remarks

By dividing the Scatter matrix by the sample size, we get the population Covariance matrix. By dividing by the sample size minus one, we get the sample Covariance matrix.

View Source

Skewness(Double[], Boolean)

Computes the Skewness for the given values.

Declaration
public static double Skewness(this double[] values, bool unbiased = true)
Parameters
Type Name Description
System.Double[] values

A number array containing the vector values.

System.Boolean unbiased

True to compute the unbiased estimate of the population skewness, false otherwise. Default is true (compute the unbiased estimator).

Returns
Type Description
System.Double

The skewness of the given data.

Remarks

Skewness characterizes the degree of asymmetry of a distribution around its mean. Positive skewness indicates a distribution with an asymmetric tail extending towards more positive values. Negative skewness indicates a distribution with an asymmetric tail extending towards more negative values.

View Source

Skewness(Double[], Double, Boolean)

Computes the Skewness for the given values.

Declaration
public static double Skewness(this double[] values, double mean, bool unbiased = true)
Parameters
Type Name Description
System.Double[] values

A number array containing the vector values.

System.Double mean

The values' mean, if already known.

System.Boolean unbiased

True to compute the unbiased estimate of the population skewness, false otherwise. Default is true (compute the unbiased estimator).

Returns
Type Description
System.Double

The skewness of the given data.

Remarks

Skewness characterizes the degree of asymmetry of a distribution around its mean. Positive skewness indicates a distribution with an asymmetric tail extending towards more positive values. Negative skewness indicates a distribution with an asymmetric tail extending towards more negative values.

View Source

Skewness(Double[][], Boolean)

Computes the Skewness for the given values.

Declaration
public static double[] Skewness(this double[][] matrix, bool unbiased = true)
Parameters
Type Name Description
System.Double[][] matrix

A number matrix containing the matrix values.

System.Boolean unbiased

True to compute the unbiased estimate of the population skewness, false otherwise. Default is true (compute the unbiased estimator).

Returns
Type Description
System.Double[]

The skewness of the given data.

Remarks

Skewness characterizes the degree of asymmetry of a distribution around its mean. Positive skewness indicates a distribution with an asymmetric tail extending towards more positive values. Negative skewness indicates a distribution with an asymmetric tail extending towards more negative values.

View Source

Skewness(Double[][], Double[], Boolean)

Computes the Skewness vector for the given matrix.

Declaration
public static double[] Skewness(this double[][] matrix, double[] means, bool unbiased = true)
Parameters
Type Name Description
System.Double[][] matrix

A number array containing the vector values.

System.Double[] means

The column means, if known.

System.Boolean unbiased

True to compute the unbiased estimate of the population skewness, false otherwise. Default is true (compute the unbiased estimator).

Returns
Type Description
System.Double[]

The skewness of the given data.

Remarks

Skewness characterizes the degree of asymmetry of a distribution around its mean. Positive skewness indicates a distribution with an asymmetric tail extending towards more positive values. Negative skewness indicates a distribution with an asymmetric tail extending towards more negative values.

View Source

Skewness(Double[,], Boolean)

Computes the Skewness for the given values.

Declaration
public static double[] Skewness(this double[, ] matrix, bool unbiased = true)
Parameters
Type Name Description
System.Double[,] matrix

A number matrix containing the matrix values.

System.Boolean unbiased

True to compute the unbiased estimate of the population skewness, false otherwise. Default is true (compute the unbiased estimator).

Returns
Type Description
System.Double[]

The skewness of the given data.

Remarks

Skewness characterizes the degree of asymmetry of a distribution around its mean. Positive skewness indicates a distribution with an asymmetric tail extending towards more positive values. Negative skewness indicates a distribution with an asymmetric tail extending towards more negative values.

View Source

Skewness(Double[,], Double[], Boolean)

Computes the Skewness vector for the given matrix.

Declaration
public static double[] Skewness(this double[, ] matrix, double[] means, bool unbiased = true)
Parameters
Type Name Description
System.Double[,] matrix

A number array containing the vector values.

System.Double[] means

The mean value for the given values, if already known.

System.Boolean unbiased

True to compute the unbiased estimate of the population skewness, false otherwise. Default is true (compute the unbiased estimator).

Returns
Type Description
System.Double[]

The skewness of the given data.

Remarks

Skewness characterizes the degree of asymmetry of a distribution around its mean. Positive skewness indicates a distribution with an asymmetric tail extending towards more positive values. Negative skewness indicates a distribution with an asymmetric tail extending towards more negative values.

View Source

StandardDeviation(Double[], Boolean)

Computes the Standard Deviation of the given values.

Declaration
public static double StandardDeviation(this double[] values, bool unbiased = true)
Parameters
Type Name Description
System.Double[] values

A double array containing the vector members.

System.Boolean unbiased

Pass true to compute the standard deviation using the sample variance. Pass false to compute it using the population variance. See remarks for more details.

Returns
Type Description
System.Double

The standard deviation of the given data.

Remarks

Setting unbiased to true will make this method compute the standard deviation σ using the sample variance, which is an unbiased estimator of the true population variance. Setting this parameter to true will thus compute σ using the following formula:

                      N
   σ² = 1 / (N - 1)  ∑   (x_i − μ)²
                      i=1

Setting unbiased to false will assume the given values already represent the whole population, and will compute the population variance using the formula:

                      N
   σ² =   (1 / N)    ∑   (x_i − μ)²
                      i=1
View Source

StandardDeviation(Double[], Double, Boolean)

Computes the Standard Deviation of the given values.

Declaration
public static double StandardDeviation(this double[] values, double mean, bool unbiased = true)
Parameters
Type Name Description
System.Double[] values

A double array containing the vector members.

System.Double mean

The mean of the vector, if already known.

System.Boolean unbiased

Pass true to compute the standard deviation using the sample variance. Pass false to compute it using the population variance. See remarks for more details.

Returns
Type Description
System.Double

The standard deviation of the given data.

Remarks

Setting unbiased to true will make this method compute the standard deviation σ using the sample variance, which is an unbiased estimator of the true population variance. Setting this parameter to true will thus compute σ using the following formula:

                      N
   σ² = 1 / (N - 1)  ∑   (x_i − μ)²
                      i=1

Setting unbiased to false will assume the given values already represent the whole population, and will compute the population variance using the formula:

                      N
   σ² =   (1 / N)    ∑   (x_i − μ)²
                      i=1
View Source

StandardDeviation(Double[][], Boolean)

Calculates the matrix Standard Deviations vector.

Declaration
public static double[] StandardDeviation(this double[][] matrix, bool unbiased = true)
Parameters
Type Name Description
System.Double[][] matrix

A matrix whose deviations will be calculated.

System.Boolean unbiased

Pass true to compute the standard deviation using the sample variance. Pass false to compute it using the population variance. See remarks for more details.

Returns
Type Description
System.Double[]

Returns a vector containing the standard deviations of the given matrix.

Remarks

Setting unbiased to true will make this method compute the standard deviation σ using the sample variance, which is an unbiased estimator of the true population variance. Setting this parameter to true will thus compute σ using the following formula:

                      N
   σ² = 1 / (N - 1)  ∑   (x_i − μ)²
                      i=1

Setting unbiased to false will assume the given values already represent the whole population, and will compute the population variance using the formula:

                      N
   σ² =   (1 / N)    ∑   (x_i − μ)²
                      i=1
View Source

StandardDeviation(Double[][], Double[], Boolean)

Calculates the matrix Standard Deviations vector.

Declaration
public static double[] StandardDeviation(this double[][] matrix, double[] means, bool unbiased = true)
Parameters
Type Name Description
System.Double[][] matrix

A matrix whose deviations will be calculated.

System.Double[] means

The mean vector containing already calculated means for each column of the matrix.

System.Boolean unbiased

Pass true to compute the standard deviation using the sample variance. Pass false to compute it using the population variance. See remarks for more details.

Returns
Type Description
System.Double[]

Returns a vector containing the standard deviations of the given matrix.

Remarks

Setting unbiased to true will make this method compute the standard deviation σ using the sample variance, which is an unbiased estimator of the true population variance. Setting this parameter to true will thus compute σ using the following formula:

                      N
   σ² = 1 / (N - 1)  ∑   (x_i − μ)²
                      i=1

Setting unbiased to false will assume the given values already represent the whole population, and will compute the population variance using the formula:

                      N
   σ² =   (1 / N)    ∑   (x_i − μ)²
                      i=1
View Source

StandardDeviation(Double[,])

Calculates the matrix Standard Deviations vector.

Declaration
public static double[] StandardDeviation(this double[, ] matrix)
Parameters
Type Name Description
System.Double[,] matrix

A matrix whose deviations will be calculated.

Returns
Type Description
System.Double[]

Returns a vector containing the standard deviations of the given matrix.

View Source

StandardDeviation(Double[,], Double[])

Calculates the matrix Standard Deviations vector.

Declaration
public static double[] StandardDeviation(this double[, ] matrix, double[] means)
Parameters
Type Name Description
System.Double[,] matrix

A matrix whose deviations will be calculated.

System.Double[] means

The mean vector containing already calculated means for each column of the matrix.

Returns
Type Description
System.Double[]

Returns a vector containing the standard deviations of the given matrix.

View Source

StandardDeviation(Int32[], Double)

Computes the Standard Deviation of the given values.

Declaration
public static double StandardDeviation(this int[] values, double mean)
Parameters
Type Name Description
System.Int32[] values

An integer array containing the vector members.

System.Double mean

The mean of the vector, if already known.

Returns
Type Description
System.Double

The standard deviation of the given data.

View Source

StandardDeviation(Single[])

Computes the Standard Deviation of the given values.

Declaration
public static double StandardDeviation(this float[] values)
Parameters
Type Name Description
System.Single[] values

A double array containing the vector members.

Returns
Type Description
System.Double

The standard deviation of the given data.

View Source

StandardDeviation(Single[], Single)

Computes the Standard Deviation of the given values.

Declaration
public static float StandardDeviation(this float[] values, float mean)
Parameters
Type Name Description
System.Single[] values

A float array containing the vector members.

System.Single mean

The mean of the vector, if already known.

Returns
Type Description
System.Single

The standard deviation of the given data.

View Source

StandardError(Double[])

Computes the Standard Error for a sample size, which estimates the standard deviation of the sample mean based on the population mean.

Declaration
public static double StandardError(double[] values)
Parameters
Type Name Description
System.Double[] values

A double array containing the samples.

Returns
Type Description
System.Double

The standard error for the sample.

View Source

StandardError(Double[,])

Computes the Standard Error vector for a given matrix.

Declaration
public static double[] StandardError(double[, ] matrix)
Parameters
Type Name Description
System.Double[,] matrix

A number multi-dimensional array containing the matrix values.

Returns
Type Description
System.Double[]

Returns the standard error vector for the matrix.

View Source

StandardError(Int32, Double)

Computes the Standard Error for a sample size, which estimates the standard deviation of the sample mean based on the population mean.

Declaration
public static double StandardError(int samples, double standardDeviation)
Parameters
Type Name Description
System.Int32 samples

The sample size.

System.Double standardDeviation

The sample standard deviation.

Returns
Type Description
System.Double

The standard error for the sample.

View Source

StandardError(Int32, Double[])

Computes the Standard Error vector for a given matrix.

Declaration
public static double[] StandardError(int samples, double[] standardDeviations)
Parameters
Type Name Description
System.Int32 samples

The number of samples in the matrix.

System.Double[] standardDeviations

The values' standard deviation vector, if already known.

Returns
Type Description
System.Double[]

Returns the standard error vector for the matrix.

View Source

TruncatedMean(Double[], Double, Boolean, Boolean)

Computes the truncated (trimmed) mean of the given values.

Declaration
public static double TruncatedMean(this double[] values, double percent, bool inPlace = false, bool alreadySorted = false)
Parameters
Type Name Description
System.Double[] values

A double array containing the vector members.

System.Double percent

The percentage of observations to drop from the sample.

System.Boolean inPlace

Whether to perform operations in place, overwriting the original vector.

System.Boolean alreadySorted

A boolean parameter informing if the given values have already been sorted.

Returns
Type Description
System.Double

The mean of the given data.

View Source

UpperQuartile(Double[], Boolean, QuantileMethod, Boolean)

Computes the upper quartile (Q3) for the given data.

Declaration
public static double UpperQuartile(this double[] values, bool alreadySorted = false, QuantileMethod type = default(QuantileMethod), bool inPlace = false)
Parameters
Type Name Description
System.Double[] values

An integer array containing the vector members.

System.Boolean alreadySorted

A boolean parameter informing if the given values have already been sorted.

QuantileMethod type

The quartile definition that should be used. See QuantileMethod for datails.

System.Boolean inPlace

Pass true if the method is allowed to sort values in place, overwriting the its original order.

Returns
Type Description
System.Double

The third quartile of the given data.

View Source

Variance(Double[])

Computes the Variance of the given values.

Declaration
public static double Variance(this double[] values)
Parameters
Type Name Description
System.Double[] values

A double precision number array containing the vector members.

Returns
Type Description
System.Double

The variance of the given data.

View Source

Variance(Double[], Boolean)

Computes the Variance of the given values.

Declaration
public static double Variance(this double[] values, bool unbiased)
Parameters
Type Name Description
System.Double[] values

A double precision number array containing the vector members.

System.Boolean unbiased

Pass true to compute the sample variance; or pass false to compute the population variance. See remarks for more details.

Returns
Type Description
System.Double

The variance of the given data.

Remarks

Setting unbiased to true will make this method compute the variance σ² using the sample variance, which is an unbiased estimator of the true population variance. Setting this parameter to true will thus compute σ² using the following formula:

                      N
   σ² = 1 / (N - 1)  ∑   (x_i − μ)²
                      i=1

Setting unbiased to false will assume the given values already represent the whole population, and will compute the population variance using the formula:

                      N
   σ² =   (1 / N)    ∑   (x_i − μ)²
                      i=1
View Source

Variance(Double[], Double)

Computes the Variance of the given values.

Declaration
public static double Variance(this double[] values, double mean)
Parameters
Type Name Description
System.Double[] values

A number array containing the vector members.

System.Double mean

The mean of the array, if already known.

Returns
Type Description
System.Double

The variance of the given data.

View Source

Variance(Double[], Double, Boolean)

Computes the Variance of the given values.

Declaration
public static double Variance(this double[] values, double mean, bool unbiased = true)
Parameters
Type Name Description
System.Double[] values

A number array containing the vector members.

System.Double mean

The mean of the array, if already known.

System.Boolean unbiased

Pass true to compute the sample variance; or pass false to compute the population variance. See remarks for more details.

Returns
Type Description
System.Double

The variance of the given data.

Remarks

Setting unbiased to true will make this method compute the variance σ² using the sample variance, which is an unbiased estimator of the true population variance. Setting this parameter to true will thus compute σ² using the following formula:

                      N
   σ² = 1 / (N - 1)  ∑   (x_i − μ)²
                      i=1

Setting unbiased to false will assume the given values already represent the whole population, and will compute the population variance using the formula:

                      N
   σ² =   (1 / N)    ∑   (x_i − μ)²
                      i=1
View Source

Variance(Double[][])

Calculates the matrix Variance vector.

Declaration
public static double[] Variance(this double[][] matrix)
Parameters
Type Name Description
System.Double[][] matrix

A matrix whose variances will be calculated.

Returns
Type Description
System.Double[]

Returns a vector containing the variances of the given matrix.

View Source

Variance(Double[][], Double[], Boolean)

Calculates the matrix Variance vector.

Declaration
public static double[] Variance(this double[][] matrix, double[] means, bool unbiased = true)
Parameters
Type Name Description
System.Double[][] matrix

A matrix whose variances will be calculated.

System.Double[] means

The mean vector containing already calculated means for each column of the matrix.

System.Boolean unbiased

Pass true to compute the sample variance; or pass false to compute the population variance. See remarks for more details.

Returns
Type Description
System.Double[]

Returns a vector containing the variances of the given matrix.

Remarks

Setting unbiased to true will make this method compute the variance σ² using the sample variance, which is an unbiased estimator of the true population variance. Setting this parameter to true will thus compute σ² using the following formula:

                      N
   σ² = 1 / (N - 1)  ∑   (x_i − μ)²
                      i=1

Setting unbiased to false will assume the given values already represent the whole population, and will compute the population variance using the formula:

                      N
   σ² =   (1 / N)    ∑   (x_i − μ)²
                      i=1
View Source

Variance(Double[,])

Calculates the matrix Variance vector.

Declaration
public static double[] Variance(this double[, ] matrix)
Parameters
Type Name Description
System.Double[,] matrix

A matrix whose variances will be calculated.

Returns
Type Description
System.Double[]

Returns a vector containing the variances of the given matrix.

View Source

Variance(Double[,], Double[])

Calculates the matrix Variance vector.

Declaration
public static double[] Variance(this double[, ] matrix, double[] means)
Parameters
Type Name Description
System.Double[,] matrix

A matrix whose variances will be calculated.

System.Double[] means

The mean vector containing already calculated means for each column of the matrix.

Returns
Type Description
System.Double[]

Returns a vector containing the variances of the given matrix.

View Source

Variance(Int32[])

Computes the Variance of the given values.

Declaration
public static double Variance(this int[] values)
Parameters
Type Name Description
System.Int32[] values

An integer number array containing the vector members.

Returns
Type Description
System.Double

The variance of the given data.

View Source

Variance(Int32[], Boolean)

Computes the Variance of the given values.

Declaration
public static double Variance(this int[] values, bool unbiased)
Parameters
Type Name Description
System.Int32[] values

An integer number array containing the vector members.

System.Boolean unbiased

Pass true to compute the sample variance; or pass false to compute the population variance. See remarks for more details.

Returns
Type Description
System.Double

The variance of the given data.

Remarks

Setting unbiased to true will make this method compute the variance σ² using the sample variance, which is an unbiased estimator of the true population variance. Setting this parameter to true will thus compute σ² using the following formula:

                      N
   σ² = 1 / (N - 1)  ∑   (x_i − μ)²
                      i=1

Setting unbiased to false will assume the given values already represent the whole population, and will compute the population variance using the formula:

                      N
   σ² =   (1 / N)    ∑   (x_i − μ)²
                      i=1
View Source

Variance(Int32[], Double, Boolean)

Computes the Variance of the given values.

Declaration
public static double Variance(this int[] values, double mean, bool unbiased = true)
Parameters
Type Name Description
System.Int32[] values

A number array containing the vector members.

System.Double mean

The mean of the array, if already known.

System.Boolean unbiased

Pass true to compute the sample variance; or pass false to compute the population variance. See remarks for more details.

Returns
Type Description
System.Double

The variance of the given data.

Remarks

Setting unbiased to true will make this method compute the variance σ² using the sample variance, which is an unbiased estimator of the true population variance. Setting this parameter to true will thus compute σ² using the following formula:

                      N
   σ² = 1 / (N - 1)  ∑   (x_i − μ)²
                      i=1

Setting unbiased to false will assume the given values already represent the whole population, and will compute the population variance using the formula:

                      N
   σ² =   (1 / N)    ∑   (x_i − μ)²
                      i=1
View Source

Variance(Single[])

Computes the Variance of the given values.

Declaration
public static double Variance(this float[] values)
Parameters
Type Name Description
System.Single[] values

A single precision number array containing the vector members.

Returns
Type Description
System.Double

The variance of the given data.

View Source

Variance(Single[], Single)

Computes the Variance of the given values.

Declaration
public static float Variance(this float[] values, float mean)
Parameters
Type Name Description
System.Single[] values

A number array containing the vector members.

System.Single mean

The mean of the array, if already known.

Returns
Type Description
System.Single

The variance of the given data.

View Source

WeightedCovariance(Double[][], Double[], Double[])

Calculates the covariance matrix of a sample matrix.

Declaration
public static double[, ] WeightedCovariance(this double[][] matrix, double[] weights, double[] means)
Parameters
Type Name Description
System.Double[][] matrix

A number multi-dimensional array containing the matrix values.

System.Double[] weights

An unit vector containing the importance of each sample in . The sum of this array elements should add up to 1.

System.Double[] means

The mean value of the given values, if already known.

Returns
Type Description
System.Double[,]

The covariance matrix.

View Source

WeightedCovariance(Double[][], Double[], Double[], Int32)

Calculates the covariance matrix of a sample matrix.

Declaration
public static double[, ] WeightedCovariance(this double[][] matrix, double[] weights, double[] means, int dimension)
Parameters
Type Name Description
System.Double[][] matrix

A number multi-dimensional array containing the matrix values.

System.Double[] weights

An unit vector containing the importance of each sample in . The sum of this array elements should add up to 1.

System.Double[] means

The mean value of the given values, if already known.

System.Int32 dimension

Pass 0 to if mean vector is a row vector, 1 otherwise. Default value is 0.

Returns
Type Description
System.Double[,]

The covariance matrix.

View Source

WeightedCovariance(Double[][], Double[], Int32)

Calculates the covariance matrix of a sample matrix.

Declaration
public static double[, ] WeightedCovariance(this double[][] matrix, double[] weights, int dimension = 0)
Parameters
Type Name Description
System.Double[][] matrix

A number multi-dimensional array containing the matrix values.

System.Double[] weights

An unit vector containing the importance of each sample in . The sum of this array elements should add up to 1.

System.Int32 dimension

Pass 0 to if mean vector is a row vector, 1 otherwise. Default value is 0.

Returns
Type Description
System.Double[,]

The covariance matrix.

View Source

WeightedCovariance(Double[][], Int32[], Double[], Int32)

Calculates the covariance matrix of a sample matrix.

Declaration
public static double[, ] WeightedCovariance(this double[][] matrix, int[] weights, double[] means, int dimension)
Parameters
Type Name Description
System.Double[][] matrix

A number multi-dimensional array containing the matrix values.

System.Int32[] weights

The number of times each sample should be repeated.

System.Double[] means

The mean value of the given values, if already known.

System.Int32 dimension

Pass 0 to if mean vector is a row vector, 1 otherwise. Default value is 0.

Returns
Type Description
System.Double[,]

The covariance matrix.

View Source

WeightedCovariance(Double[][], Int32[], Int32)

Calculates the covariance matrix of a sample matrix.

Declaration
public static double[, ] WeightedCovariance(this double[][] matrix, int[] weights, int dimension = 0)
Parameters
Type Name Description
System.Double[][] matrix

A number multi-dimensional array containing the matrix values.

System.Int32[] weights

The number of times each sample should be repeated.

System.Int32 dimension

Pass 0 to if mean vector is a row vector, 1 otherwise. Default value is 0.

Returns
Type Description
System.Double[,]

The covariance matrix.

View Source

WeightedEntropy(IList<Int32>, IList<Double>, Int32)

Computes the entropy for the given values.

Declaration
public static double WeightedEntropy(IList<int> values, IList<double> weights, int classes)
Parameters
Type Name Description
IList<System.Int32> values

An array of integer symbols.

IList<System.Double> weights

The importance for each sample.

System.Int32 classes

The number of distinct classes.

Returns
Type Description
System.Double

The evaluated entropy.

View Source

WeightedEntropy(IList<Int32>, IList<Double>, Int32, Int32)

Computes the entropy for the given values.

Declaration
public static double WeightedEntropy(IList<int> values, IList<double> weights, int startValue, int endValue)
Parameters
Type Name Description
IList<System.Int32> values

An array of integer symbols.

IList<System.Double> weights

The importance for each sample.

System.Int32 startValue

The starting symbol.

System.Int32 endValue

The ending symbol.

Returns
Type Description
System.Double

The evaluated entropy.

View Source

WeightedEntropy(Double[], Double[], Func<Double, Double>)

Computes the entropy function for a set of numerical values in a given Probability Density Function (pdf).

Declaration
public static double WeightedEntropy(this double[] values, double[] weights, Func<double, double> pdf)
Parameters
Type Name Description
System.Double[] values

A number array containing the vector values.

System.Double[] weights

The importance for each sample.

Func<System.Double, System.Double> pdf

A probability distribution function.

Returns
Type Description
System.Double

The distribution's entropy for the given values.

View Source

WeightedEntropy(Double[], Double[], Double, Double)

Computes the entropy for the given values.

Declaration
public static double WeightedEntropy(double[] values, double[] weights, double startValue, double endValue)
Parameters
Type Name Description
System.Double[] values

An array of integer symbols.

System.Double[] weights

The importance for each sample.

System.Double startValue

The starting symbol.

System.Double endValue

The ending symbol.

Returns
Type Description
System.Double

The evaluated entropy.

View Source

WeightedEntropy(Double[], Double[], Int32)

Computes the entropy for the given values.

Declaration
public static double WeightedEntropy(double[] values, double[] weights, int classes)
Parameters
Type Name Description
System.Double[] values

An array of integer symbols.

System.Double[] weights

The importance for each sample.

System.Int32 classes

The number of distinct classes.

Returns
Type Description
System.Double

The evaluated entropy.

View Source

WeightedEntropy(Double[], Double[], Int32, Int32)

Computes the entropy for the given values.

Declaration
public static double WeightedEntropy(double[] values, double[] weights, int startValue, int endValue)
Parameters
Type Name Description
System.Double[] values

An array of integer symbols.

System.Double[] weights

The importance for each sample.

System.Int32 startValue

The starting symbol.

System.Int32 endValue

The ending symbol.

Returns
Type Description
System.Double

The evaluated entropy.

View Source

WeightedEntropy(Double[], Int32[], Func<Double, Double>)

Computes the entropy function for a set of numerical values in a given Probability Density Function (pdf).

Declaration
public static double WeightedEntropy(this double[] values, int[] weights, Func<double, double> pdf)
Parameters
Type Name Description
System.Double[] values

A number array containing the vector values.

System.Int32[] weights

The repetition counts for each sample.

Func<System.Double, System.Double> pdf

A probability distribution function.

Returns
Type Description
System.Double

The distribution's entropy for the given values.

View Source

WeightedEntropy(Int32[], Double[], Int32)

Computes the entropy for the given values.

Declaration
public static double WeightedEntropy(int[] values, double[] weights, int classes)
Parameters
Type Name Description
System.Int32[] values

An array of integer symbols.

System.Double[] weights

The importance for each sample.

System.Int32 classes

The number of distinct classes.

Returns
Type Description
System.Double

The evaluated entropy.

View Source

WeightedMax(Double[], Double[], out Int32, Boolean)

Gets the maximum value in a vector of observations that has a weight higher than zero.

Declaration
public static double WeightedMax(this double[] values, double[] weights, out int imax, bool alreadySorted = false)
Parameters
Type Name Description
System.Double[] values

A number array containing the vector values.

System.Double[] weights

A vector containing the importance of each sample in .

System.Int32 imax

The index of the maximum element in the vector, or -1 if it could not be found.

System.Boolean alreadySorted

Pass true if the list of values is already sorted.

Returns
Type Description
System.Double

The maximum value in the given data.

View Source

WeightedMax(Double[], Int32[], out Int32, Boolean)

Gets the maximum value in a vector of observations that has a weight higher than zero.

Declaration
public static double WeightedMax(this double[] values, int[] weights, out int imax, bool alreadySorted = false)
Parameters
Type Name Description
System.Double[] values

A number array containing the vector values.

System.Int32[] weights

The number of times each sample should be repeated.

System.Int32 imax

The index of the maximum element in the vector, or -1 if it could not be found.

System.Boolean alreadySorted

Pass true if the list of values is already sorted.

Returns
Type Description
System.Double

The maximum value in the given data.

View Source

WeightedMean(Double[], Double[])

Computes the Weighted Mean of the given values.

Declaration
public static double WeightedMean(this double[] values, double[] weights)
Parameters
Type Name Description
System.Double[] values

A double array containing the vector members.

System.Double[] weights

An unit vector containing the importance of each sample in .

Returns
Type Description
System.Double

The mean of the given data.

View Source

WeightedMean(Double[], Int32[])

Computes the Weighted Mean of the given values.

Declaration
public static double WeightedMean(this double[] values, int[] weights)
Parameters
Type Name Description
System.Double[] values

A double array containing the vector members.

System.Int32[] weights

A vector containing how many times each element in repeats itself in the non-weighted data.

Returns
Type Description
System.Double

The mean of the given data.

View Source

WeightedMean(Double[][], Double[])

Calculates the weighted matrix Mean vector.

Declaration
public static double[] WeightedMean(this double[][] matrix, double[] weights)
Parameters
Type Name Description
System.Double[][] matrix

A matrix whose means will be calculated.

System.Double[] weights

A vector containing the importance of each sample in the matrix.

Returns
Type Description
System.Double[]

Returns a vector containing the means of the given matrix.

View Source

WeightedMean(Double[][], Double[], Int32)

Calculates the weighted matrix Mean vector.

Declaration
public static double[] WeightedMean(this double[][] matrix, double[] weights, int dimension = 0)
Parameters
Type Name Description
System.Double[][] matrix

A matrix whose means will be calculated.

System.Double[] weights

A vector containing the importance of each sample in the matrix.

System.Int32 dimension

The dimension along which the means will be calculated. Pass 0 to compute a row vector containing the mean of each column, or 1 to compute a column vector containing the mean of each row. Default value is 0.

Returns
Type Description
System.Double[]

Returns a vector containing the means of the given matrix.

View Source

WeightedMean(Double[][], Int32[])

Calculates the weighted matrix Mean vector.

Declaration
public static double[] WeightedMean(this double[][] matrix, int[] weights)
Parameters
Type Name Description
System.Double[][] matrix

A matrix whose means will be calculated.

System.Int32[] weights

A vector containing the importance of each sample in the matrix.

Returns
Type Description
System.Double[]

Returns a vector containing the means of the given matrix.

View Source

WeightedMean(Double[][], Int32[], Int32)

Calculates the weighted matrix Mean vector.

Declaration
public static double[] WeightedMean(this double[][] matrix, int[] weights, int dimension = 0)
Parameters
Type Name Description
System.Double[][] matrix

A matrix whose means will be calculated.

System.Int32[] weights

A vector containing the importance of each sample in the matrix.

System.Int32 dimension

The dimension along which the means will be calculated. Pass 0 to compute a row vector containing the mean of each column, or 1 to compute a column vector containing the mean of each row. Default value is 0.

Returns
Type Description
System.Double[]

Returns a vector containing the means of the given matrix.

View Source

WeightedMean(Double[,], Double[])

Calculates the weighted matrix Mean vector.

Declaration
public static double[] WeightedMean(this double[, ] matrix, double[] weights)
Parameters
Type Name Description
System.Double[,] matrix

A matrix whose means will be calculated.

System.Double[] weights

A vector containing the importance of each sample in the matrix.

Returns
Type Description
System.Double[]

Returns a vector containing the means of the given matrix.

View Source

WeightedMean(Double[,], Double[], Int32)

Calculates the weighted matrix Mean vector.

Declaration
public static double[] WeightedMean(this double[, ] matrix, double[] weights, int dimension = 0)
Parameters
Type Name Description
System.Double[,] matrix

A matrix whose means will be calculated.

System.Double[] weights

A vector containing the importance of each sample in the matrix.

System.Int32 dimension

The dimension along which the means will be calculated. Pass 0 to compute a row vector containing the mean of each column, or 1 to compute a column vector containing the mean of each row. Default value is 0.

Returns
Type Description
System.Double[]

Returns a vector containing the means of the given matrix.

View Source

WeightedMean(Double[,], Int32[])

Calculates the weighted matrix Mean vector.

Declaration
public static double[] WeightedMean(this double[, ] matrix, int[] weights)
Parameters
Type Name Description
System.Double[,] matrix

A matrix whose means will be calculated.

System.Int32[] weights

A vector containing the importance of each sample in the matrix.

Returns
Type Description
System.Double[]

Returns a vector containing the means of the given matrix.

View Source

WeightedMean(Double[,], Int32[], Int32)

Calculates the weighted matrix Mean vector.

Declaration
public static double[] WeightedMean(this double[, ] matrix, int[] weights, int dimension = 0)
Parameters
Type Name Description
System.Double[,] matrix

A matrix whose means will be calculated.

System.Int32[] weights

A vector containing the importance of each sample in the matrix.

System.Int32 dimension

The dimension along which the means will be calculated. Pass 0 to compute a row vector containing the mean of each column, or 1 to compute a column vector containing the mean of each row. Default value is 0.

Returns
Type Description
System.Double[]

Returns a vector containing the means of the given matrix.

View Source

WeightedMin(Double[], Double[], out Int32, Boolean)

Gets the minimum value in a vector of observations that has a weight higher than zero.

Declaration
public static double WeightedMin(this double[] values, double[] weights, out int imin, bool alreadySorted = false)
Parameters
Type Name Description
System.Double[] values

A number array containing the vector values.

System.Double[] weights

A vector containing the importance of each sample in .

System.Int32 imin

The index of the minimum element in the vector, or -1 if it could not be found.

System.Boolean alreadySorted

Pass true if the list of values is already sorted.

Returns
Type Description
System.Double

The minimum value in the given data.

View Source

WeightedMin(Double[], Int32[], out Int32, Boolean)

Gets the minimum value in a vector of observations that has a weight higher than zero.

Declaration
public static double WeightedMin(this double[] values, int[] weights, out int imin, bool alreadySorted = false)
Parameters
Type Name Description
System.Double[] values

A number array containing the vector values.

System.Int32[] weights

The number of times each sample should be repeated.

System.Int32 imin

The index of the minimum element in the vector, or -1 if it could not be found.

System.Boolean alreadySorted

Pass true if the list of values is already sorted.

Returns
Type Description
System.Double

The minimum value in the given data.

View Source

WeightedMode<T>(T[], Double[], Boolean, Boolean)

Computes the Mode of the given values.

Declaration
public static T WeightedMode<T>(this T[] values, double[] weights, bool inPlace = false, bool alreadySorted = false)
Parameters
Type Name Description
T[] values

A number array containing the vector values.

System.Double[] weights

The number of times each sample should be repeated.

System.Boolean inPlace

True to perform the operation in place, altering the original input vector.

System.Boolean alreadySorted

Pass true if the list of values is already sorted.

Returns
Type Description
T

The most common value in the given data.

Type Parameters
Name Description
T
View Source

WeightedMode<T>(T[], Int32[], Boolean, Boolean)

Computes the Mode of the given values.

Declaration
public static T WeightedMode<T>(this T[] values, int[] weights, bool inPlace = false, bool alreadySorted = false)
Parameters
Type Name Description
T[] values

A number array containing the vector values.

System.Int32[] weights

The number of times each sample should be repeated.

System.Boolean inPlace

True to perform the operation in place, altering the original input vector.

System.Boolean alreadySorted

Pass true if the list of values is already sorted.

Returns
Type Description
T

The most common value in the given data.

Type Parameters
Name Description
T
View Source

WeightedScatter(Double[][], Double[], Double[], Double, Int32)

Calculates the scatter matrix of a sample matrix.

Declaration
public static double[, ] WeightedScatter(this double[][] matrix, double[] weights, double[] means, double factor, int dimension)
Parameters
Type Name Description
System.Double[][] matrix

A number multi-dimensional array containing the matrix values.

System.Double[] weights

An unit vector containing the importance of each sample in . The sum of this array elements should add up to 1.

System.Double[] means

The mean value of the given values, if already known.

System.Double factor

A real number to multiply each member of the matrix.

System.Int32 dimension

Pass 0 to if mean vector is a row vector, 1 otherwise. Default value is 0.

Returns
Type Description
System.Double[,]

The covariance matrix.

Remarks

By dividing the Scatter matrix by the sample size, we get the population Covariance matrix. By dividing by the sample size minus one, we get the sample Covariance matrix.

View Source

WeightedScatter(Double[][], Int32[], Double[], Double, Int32)

Calculates the scatter matrix of a sample matrix.

Declaration
public static double[, ] WeightedScatter(this double[][] matrix, int[] weights, double[] means, double factor, int dimension)
Parameters
Type Name Description
System.Double[][] matrix

A number multi-dimensional array containing the matrix values.

System.Int32[] weights

The number of times each sample should be repeated.

System.Double[] means

The mean value of the given values, if already known.

System.Double factor

A real number to multiply each member of the matrix.

System.Int32 dimension

Pass 0 to if mean vector is a row vector, 1 otherwise. Default value is 0.

Returns
Type Description
System.Double[,]

The covariance matrix.

Remarks

By dividing the Scatter matrix by the sample size, we get the population Covariance matrix. By dividing by the sample size minus one, we get the sample Covariance matrix.

View Source

WeightedStandardDeviation(Double[], Double[])

Computes the Standard Deviation of the given values.

Declaration
public static double WeightedStandardDeviation(this double[] values, double[] weights)
Parameters
Type Name Description
System.Double[] values

A double array containing the vector members.

System.Double[] weights

An unit vector containing the importance of each sample in . The sum of this array elements should add up to 1.

Returns
Type Description
System.Double

The standard deviation of the given data.

View Source

WeightedStandardDeviation(Double[], Double[], WeightType)

Computes the Standard Deviation of the given values.

Declaration
public static double WeightedStandardDeviation(this double[] values, double[] weights, WeightType weightType)
Parameters
Type Name Description
System.Double[] values

A double array containing the vector members.

System.Double[] weights

An unit vector containing the importance of each sample in .

WeightType weightType

How the weights should be interpreted for the bias correction.

Returns
Type Description
System.Double

The standard deviation of the given data.

View Source

WeightedStandardDeviation(Double[], Double[], Boolean, WeightType)

Computes the Standard Deviation of the given values.

Declaration
public static double WeightedStandardDeviation(this double[] values, double[] weights, bool unbiased, WeightType weightType)
Parameters
Type Name Description
System.Double[] values

A double array containing the vector members.

System.Double[] weights

An unit vector containing the importance of each sample in .

System.Boolean unbiased

Pass true to compute the sample variance; or pass false to compute the population variance. For integers weights , the bias correction is equivalent to the non-weighted case. For fractional weights, the variance bias cannot be completely eliminated.

WeightType weightType

How the weights should be interpreted for the bias correction.

Returns
Type Description
System.Double

The standard deviation of the given data.

View Source

WeightedStandardDeviation(Double[], Double[], Double)

Computes the Standard Deviation of the given values.

Declaration
public static double WeightedStandardDeviation(this double[] values, double[] weights, double mean)
Parameters
Type Name Description
System.Double[] values

A double array containing the vector members.

System.Double[] weights

An unit vector containing the importance of each sample in . The sum of this array elements should add up to 1.

System.Double mean

The mean of the vector, if already known.

Returns
Type Description
System.Double

The standard deviation of the given data.

View Source

WeightedStandardDeviation(Double[], Double[], Double, Boolean, WeightType)

Computes the Standard Deviation of the given values.

Declaration
public static double WeightedStandardDeviation(this double[] values, double[] weights, double mean, bool unbiased, WeightType weightType = WeightType.Fraction)
Parameters
Type Name Description
System.Double[] values

A double array containing the vector members.

System.Double[] weights

An unit vector containing the importance of each sample in . The sum of this array elements should add up to 1.

System.Double mean

The mean of the vector, if already known.

System.Boolean unbiased

Pass true to compute the sample variance; or pass false to compute the population variance. For integers weights , the bias correction is equivalent to the non-weighted case. For fractional weights, the variance bias cannot be completely eliminated.

WeightType weightType

How the weights should be interpreted for the bias correction.

Returns
Type Description
System.Double

The standard deviation of the given data.

View Source

WeightedStandardDeviation(Double[], Int32[])

Computes the Standard Deviation of the given values.

Declaration
public static double WeightedStandardDeviation(this double[] values, int[] weights)
Parameters
Type Name Description
System.Double[] values

A double array containing the vector members.

System.Int32[] weights

A vector containing how many times each element in repeats itself in the non-weighted data.

Returns
Type Description
System.Double

The standard deviation of the given data.

View Source

WeightedStandardDeviation(Double[], Int32[], Double)

Computes the Standard Deviation of the given values.

Declaration
public static double WeightedStandardDeviation(this double[] values, int[] weights, double mean)
Parameters
Type Name Description
System.Double[] values

A double array containing the vector members.

System.Int32[] weights

A vector containing how many times each element in repeats itself in the non-weighted data.

System.Double mean

The mean of the vector, if already known.

Returns
Type Description
System.Double

The standard deviation of the given data.

View Source

WeightedStandardDeviation(Double[], Int32[], Double, Boolean)

Computes the Standard Deviation of the given values.

Declaration
public static double WeightedStandardDeviation(this double[] values, int[] weights, double mean, bool unbiased)
Parameters
Type Name Description
System.Double[] values

A double array containing the vector members.

System.Int32[] weights

A vector containing how many times each element in repeats itself in the non-weighted data.

System.Double mean

The mean of the vector, if already known.

System.Boolean unbiased

Pass true to compute the sample variance; or pass false to compute the population variance. For integers weights , the bias correction is equivalent to the non-weighted case. For fractional weights, the variance bias cannot be completely eliminated.

Returns
Type Description
System.Double

The standard deviation of the given data.

View Source

WeightedStandardDeviation(Double[][], Double[], Boolean)

Calculates the matrix Standard Deviations vector.

Declaration
public static double[] WeightedStandardDeviation(this double[][] matrix, double[] weights, bool unbiased = true)
Parameters
Type Name Description
System.Double[][] matrix

A matrix whose deviations will be calculated.

System.Double[] weights

The number of times each sample should be repeated.

System.Boolean unbiased

Pass true to compute the standard deviation using the sample variance. Pass false to compute it using the population variance. See remarks for more details.

Returns
Type Description
System.Double[]

Returns a vector containing the standard deviations of the given matrix.

Remarks

Setting unbiased to true will make this method compute the standard deviation σ using the sample variance, which is an unbiased estimator of the true population variance. Setting this parameter to true will thus compute σ using the following formula:

                      N
   σ² = 1 / (N - 1)  ∑   (x_i − μ)²
                      i=1

Setting unbiased to false will assume the given values already represent the whole population, and will compute the population variance using the formula:

                      N
   σ² =   (1 / N)    ∑   (x_i − μ)²
                      i=1
View Source

WeightedStandardDeviation(Double[][], Double[], Double[], Boolean)

Calculates the matrix Standard Deviations vector.

Declaration
public static double[] WeightedStandardDeviation(this double[][] matrix, double[] weights, double[] means, bool unbiased = true)
Parameters
Type Name Description
System.Double[][] matrix

A matrix whose deviations will be calculated.

System.Double[] weights

The number of times each sample should be repeated.

System.Double[] means

The mean vector containing already calculated means for each column of the matrix.

System.Boolean unbiased

Pass true to compute the standard deviation using the sample variance. Pass false to compute it using the population variance. See remarks for more details.

Returns
Type Description
System.Double[]

Returns a vector containing the standard deviations of the given matrix.

Remarks

Setting unbiased to true will make this method compute the standard deviation σ using the sample variance, which is an unbiased estimator of the true population variance. Setting this parameter to true will thus compute σ using the following formula:

                      N
   σ² = 1 / (N - 1)  ∑   (x_i − μ)²
                      i=1

Setting unbiased to false will assume the given values already represent the whole population, and will compute the population variance using the formula:

                      N
   σ² =   (1 / N)    ∑   (x_i − μ)²
                      i=1
View Source

WeightedStandardDeviation(Double[][], Int32[], Boolean)

Calculates the matrix Standard Deviations vector.

Declaration
public static double[] WeightedStandardDeviation(this double[][] matrix, int[] weights, bool unbiased = true)
Parameters
Type Name Description
System.Double[][] matrix

A matrix whose deviations will be calculated.

System.Int32[] weights

The number of times each sample should be repeated.

System.Boolean unbiased

Pass true to compute the standard deviation using the sample variance. Pass false to compute it using the population variance. See remarks for more details.

Returns
Type Description
System.Double[]

Returns a vector containing the standard deviations of the given matrix.

Remarks

Setting unbiased to true will make this method compute the standard deviation σ using the sample variance, which is an unbiased estimator of the true population variance. Setting this parameter to true will thus compute σ using the following formula:

                      N
   σ² = 1 / (N - 1)  ∑   (x_i − μ)²
                      i=1

Setting unbiased to false will assume the given values already represent the whole population, and will compute the population variance using the formula:

                      N
   σ² =   (1 / N)    ∑   (x_i − μ)²
                      i=1
View Source

WeightedStandardDeviation(Double[][], Int32[], Double[], Boolean)

Calculates the matrix Standard Deviations vector.

Declaration
public static double[] WeightedStandardDeviation(this double[][] matrix, int[] weights, double[] means, bool unbiased = true)
Parameters
Type Name Description
System.Double[][] matrix

A matrix whose deviations will be calculated.

System.Int32[] weights

The number of times each sample should be repeated.

System.Double[] means

The mean vector containing already calculated means for each column of the matrix.

System.Boolean unbiased

Pass true to compute the standard deviation using the sample variance. Pass false to compute it using the population variance. See remarks for more details.

Returns
Type Description
System.Double[]

Returns a vector containing the standard deviations of the given matrix.

Remarks

Setting unbiased to true will make this method compute the standard deviation σ using the sample variance, which is an unbiased estimator of the true population variance. Setting this parameter to true will thus compute σ using the following formula:

                      N
   σ² = 1 / (N - 1)  ∑   (x_i − μ)²
                      i=1

Setting unbiased to false will assume the given values already represent the whole population, and will compute the population variance using the formula:

                      N
   σ² =   (1 / N)    ∑   (x_i − μ)²
                      i=1
View Source

WeightedStandardDeviation(Double[,], Double[])

Calculates the matrix Standard Deviations vector.

Declaration
public static double[] WeightedStandardDeviation(this double[, ] matrix, double[] weights)
Parameters
Type Name Description
System.Double[,] matrix

A matrix whose deviations will be calculated.

System.Double[] weights

The number of times each sample should be repeated.

Returns
Type Description
System.Double[]

Returns a vector containing the standard deviations of the given matrix.

View Source

WeightedStandardDeviation(Double[,], Double[], Double[])

Calculates the matrix Standard Deviations vector.

Declaration
public static double[] WeightedStandardDeviation(this double[, ] matrix, double[] weights, double[] means)
Parameters
Type Name Description
System.Double[,] matrix

A matrix whose deviations will be calculated.

System.Double[] weights

The number of times each sample should be repeated.

System.Double[] means

The mean vector containing already calculated means for each column of the matrix.

Returns
Type Description
System.Double[]

Returns a vector containing the standard deviations of the given matrix.

View Source

WeightedStandardDeviation(Double[,], Int32[])

Calculates the matrix Standard Deviations vector.

Declaration
public static double[] WeightedStandardDeviation(this double[, ] matrix, int[] weights)
Parameters
Type Name Description
System.Double[,] matrix

A matrix whose deviations will be calculated.

System.Int32[] weights

The number of times each sample should be repeated.

Returns
Type Description
System.Double[]

Returns a vector containing the standard deviations of the given matrix.

View Source

WeightedStandardDeviation(Double[,], Int32[], Double[])

Calculates the matrix Standard Deviations vector.

Declaration
public static double[] WeightedStandardDeviation(this double[, ] matrix, int[] weights, double[] means)
Parameters
Type Name Description
System.Double[,] matrix

A matrix whose deviations will be calculated.

System.Int32[] weights

The number of times each sample should be repeated.

System.Double[] means

The mean vector containing already calculated means for each column of the matrix.

Returns
Type Description
System.Double[]

Returns a vector containing the standard deviations of the given matrix.

View Source

WeightedVariance(Double[], Double[])

Computes the weighted Variance of the given values.

Declaration
public static double WeightedVariance(this double[] values, double[] weights)
Parameters
Type Name Description
System.Double[] values

A number array containing the vector members.

System.Double[] weights

An unit vector containing the importance of each sample in . The sum of this array elements should add up to 1.

Returns
Type Description
System.Double

The variance of the given data.

View Source

WeightedVariance(Double[], Double[], WeightType)

Computes the weighted Variance of the given values.

Declaration
public static double WeightedVariance(this double[] values, double[] weights, WeightType weightType)
Parameters
Type Name Description
System.Double[] values

A number array containing the vector members.

System.Double[] weights

An unit vector containing the importance of each sample in .

WeightType weightType

How the weights should be interpreted for the bias correction.

Returns
Type Description
System.Double

The variance of the given data.

View Source

WeightedVariance(Double[], Double[], Boolean)

Computes the weighted Variance of the given values.

Declaration
public static double WeightedVariance(this double[] values, double[] weights, bool unbiased)
Parameters
Type Name Description
System.Double[] values

A number array containing the vector members.

System.Double[] weights

An unit vector containing the importance of each sample in . The sum of this array elements should add up to 1.

System.Boolean unbiased

Pass true to compute the sample variance; or pass false to compute the population variance. For integers weights , the bias correction is equivalent to the non-weighted case. For fractional weights, the variance bias cannot be completely eliminated.

Returns
Type Description
System.Double

The variance of the given data.

View Source

WeightedVariance(Double[], Double[], Boolean, WeightType)

Computes the weighted Variance of the given values.

Declaration
public static double WeightedVariance(this double[] values, double[] weights, bool unbiased, WeightType weightType)
Parameters
Type Name Description
System.Double[] values

A number array containing the vector members.

System.Double[] weights

An unit vector containing the importance of each sample in .

System.Boolean unbiased

Pass true to compute the sample variance; or pass false to compute the population variance. For integers weights , the bias correction is equivalent to the non-weighted case. For fractional weights, the variance bias cannot be completely eliminated.

WeightType weightType

How the weights should be interpreted for the bias correction.

Returns
Type Description
System.Double

The variance of the given data.

View Source

WeightedVariance(Double[], Double[], Double)

Computes the weighted Variance of the given values.

Declaration
public static double WeightedVariance(this double[] values, double[] weights, double mean)
Parameters
Type Name Description
System.Double[] values

A number array containing the vector members.

System.Double[] weights

An unit vector containing the importance of each sample in . The sum of this array elements should add up to 1.

System.Double mean

The mean of the array, if already known.

Returns
Type Description
System.Double

The variance of the given data.

View Source

WeightedVariance(Double[], Double[], Double, Boolean, WeightType)

Computes the weighted Variance of the given values.

Declaration
public static double WeightedVariance(this double[] values, double[] weights, double mean, bool unbiased, WeightType weightType = WeightType.Fraction)
Parameters
Type Name Description
System.Double[] values

A number array containing the vector members.

System.Double[] weights

An unit vector containing the importance of each sample in .

System.Double mean

The mean of the array, if already known.

System.Boolean unbiased

Pass true to compute the sample variance; or pass false to compute the population variance. For integers weights , the bias correction is equivalent to the non-weighted case. For fractional weights, the variance bias cannot be completely eliminated.

WeightType weightType

How the weights should be interpreted for the bias correction.

Returns
Type Description
System.Double

The variance of the given data.

View Source

WeightedVariance(Double[], Int32[])

Computes the weighted Variance of the given values.

Declaration
public static double WeightedVariance(this double[] values, int[] weights)
Parameters
Type Name Description
System.Double[] values

A number array containing the vector members.

System.Int32[] weights

A vector containing how many times each element in repeats itself in the non-weighted data.

Returns
Type Description
System.Double

The variance of the given data.

View Source

WeightedVariance(Double[], Int32[], Boolean)

Computes the weighted Variance of the given values.

Declaration
public static double WeightedVariance(this double[] values, int[] weights, bool unbiased)
Parameters
Type Name Description
System.Double[] values

A number array containing the vector members.

System.Int32[] weights

A vector containing how many times each element in repeats itself in the non-weighted data.

System.Boolean unbiased

Pass true to compute the sample variance; or pass false to compute the population variance. For integers weights , the bias correction is equivalent to the non-weighted case. For fractional weights, the variance bias cannot be completely eliminated.

Returns
Type Description
System.Double

The variance of the given data.

View Source

WeightedVariance(Double[], Int32[], Double)

Computes the weighted Variance of the given values.

Declaration
public static double WeightedVariance(this double[] values, int[] weights, double mean)
Parameters
Type Name Description
System.Double[] values

A number array containing the vector members.

System.Int32[] weights

A vector containing how many times each element in repeats itself in the non-weighted data.

System.Double mean

The mean of the array, if already known.

Returns
Type Description
System.Double

The variance of the given data.

View Source

WeightedVariance(Double[], Int32[], Double, Boolean)

Computes the weighted Variance of the given values.

Declaration
public static double WeightedVariance(this double[] values, int[] weights, double mean, bool unbiased)
Parameters
Type Name Description
System.Double[] values

A number array containing the vector members.

System.Int32[] weights

A vector containing how many times each element in repeats itself in the non-weighted data.

System.Double mean

The mean of the array, if already known.

System.Boolean unbiased

Pass true to compute the sample variance; or pass false to compute the population variance. For integers weights , the bias correction is equivalent to the non-weighted case. For fractional weights, the variance bias cannot be completely eliminated.

Returns
Type Description
System.Double

The variance of the given data.

View Source

WeightedVariance(Double[][], Double[])

Calculates the matrix Variance vector.

Declaration
public static double[] WeightedVariance(this double[][] matrix, double[] weights)
Parameters
Type Name Description
System.Double[][] matrix

A matrix whose variances will be calculated.

System.Double[] weights

An unit vector containing the importance of each sample in . The sum of this array elements should add up to 1.

Returns
Type Description
System.Double[]

Returns a vector containing the variances of the given matrix.

View Source

WeightedVariance(Double[][], Double[], Double[])

Calculates the matrix Variance vector.

Declaration
public static double[] WeightedVariance(this double[][] matrix, double[] weights, double[] means)
Parameters
Type Name Description
System.Double[][] matrix

A matrix whose variances will be calculated.

System.Double[] weights

An unit vector containing the importance of each sample in . The sum of this array elements should add up to 1.

System.Double[] means

The mean vector containing already calculated means for each column of the matrix.

Returns
Type Description
System.Double[]

Returns a vector containing the variances of the given matrix.

View Source

WeightedVariance(Double[][], Double[], Double[], Boolean, WeightType)

Calculates the matrix Variance vector.

Declaration
public static double[] WeightedVariance(this double[][] matrix, double[] weights, double[] means, bool unbiased, WeightType weightType = WeightType.Fraction)
Parameters
Type Name Description
System.Double[][] matrix

A matrix whose variances will be calculated.

System.Double[] weights

An unit vector containing the importance of each sample in . The sum of this array elements should add up to 1.

System.Double[] means

The mean vector containing already calculated means for each column of the matrix.

System.Boolean unbiased

Pass true to compute the sample variance; or pass false to compute the population variance. For integers weights , the bias correction is equivalent to the non-weighted case. For fractional weights, the variance bias cannot be completely eliminated.

WeightType weightType

How the weights should be interpreted for the bias correction.

Returns
Type Description
System.Double[]

Returns a vector containing the variances of the given matrix.

View Source

WeightedVariance(Double[][], Int32[])

Calculates the matrix Variance vector.

Declaration
public static double[] WeightedVariance(this double[][] matrix, int[] weights)
Parameters
Type Name Description
System.Double[][] matrix

A matrix whose variances will be calculated.

System.Int32[] weights

The number of times each sample should be repeated.

Returns
Type Description
System.Double[]

Returns a vector containing the variances of the given matrix.

View Source

WeightedVariance(Double[][], Int32[], Double[])

Calculates the matrix Variance vector.

Declaration
public static double[] WeightedVariance(this double[][] matrix, int[] weights, double[] means)
Parameters
Type Name Description
System.Double[][] matrix

A matrix whose variances will be calculated.

System.Int32[] weights

The number of times each sample should be repeated.

System.Double[] means

The mean vector containing already calculated means for each column of the matrix.

Returns
Type Description
System.Double[]

Returns a vector containing the variances of the given matrix.

View Source

WeightedVariance(Double[][], Int32[], Double[], Boolean)

Calculates the matrix Variance vector.

Declaration
public static double[] WeightedVariance(this double[][] matrix, int[] weights, double[] means, bool unbiased)
Parameters
Type Name Description
System.Double[][] matrix

A matrix whose variances will be calculated.

System.Int32[] weights

The number of times each sample should be repeated.

System.Double[] means

The mean vector containing already calculated means for each column of the matrix.

System.Boolean unbiased

Pass true to compute the sample variance; or pass false to compute the population variance. For integers weights , the bias correction is equivalent to the non-weighted case. For fractional weights, the variance bias cannot be completely eliminated.

Returns
Type Description
System.Double[]

Returns a vector containing the variances of the given matrix.

View Source

WeightedVariance(Double[,], Double[])

Calculates the matrix Variance vector.

Declaration
public static double[] WeightedVariance(this double[, ] matrix, double[] weights)
Parameters
Type Name Description
System.Double[,] matrix

A matrix whose variances will be calculated.

System.Double[] weights

An unit vector containing the importance of each sample in . The sum of this array elements should add up to 1.

Returns
Type Description
System.Double[]

Returns a vector containing the variances of the given matrix.

View Source

WeightedVariance(Double[,], Double[], WeightType)

Calculates the matrix Variance vector.

Declaration
public static double[] WeightedVariance(this double[, ] matrix, double[] weights, WeightType weightType)
Parameters
Type Name Description
System.Double[,] matrix

A matrix whose variances will be calculated.

System.Double[] weights

An unit vector containing the importance of each sample in .

WeightType weightType

How the weights should be interpreted for the bias correction.

Returns
Type Description
System.Double[]

Returns a vector containing the variances of the given matrix.

View Source

WeightedVariance(Double[,], Double[], Double[])

Calculates the matrix Variance vector.

Declaration
public static double[] WeightedVariance(this double[, ] matrix, double[] weights, double[] means)
Parameters
Type Name Description
System.Double[,] matrix

A matrix whose variances will be calculated.

System.Double[] weights

An unit vector containing the importance of each sample in . The sum of this array elements should add up to 1.

System.Double[] means

The mean vector containing already calculated means for each column of the matrix.

Returns
Type Description
System.Double[]

Returns a vector containing the variances of the given matrix.

View Source

WeightedVariance(Double[,], Double[], Double[], WeightType)

Calculates the matrix Variance vector.

Declaration
public static double[] WeightedVariance(this double[, ] matrix, double[] weights, double[] means, WeightType weightType)
Parameters
Type Name Description
System.Double[,] matrix

A matrix whose variances will be calculated.

System.Double[] weights

An unit vector containing the importance of each sample in . The sum of this array elements should add up to 1.

System.Double[] means

The mean vector containing already calculated means for each column of the matrix.

WeightType weightType

How the weights should be interpreted for the bias correction.

Returns
Type Description
System.Double[]

Returns a vector containing the variances of the given matrix.

View Source

WeightedVariance(Double[,], Double[], Double[], Boolean, WeightType)

Calculates the matrix Variance vector.

Declaration
public static double[] WeightedVariance(this double[, ] matrix, double[] weights, double[] means, bool unbiased, WeightType weightType = WeightType.Fraction)
Parameters
Type Name Description
System.Double[,] matrix

A matrix whose variances will be calculated.

System.Double[] weights

An unit vector containing the importance of each sample in . How those values are interpreted depend on the value for weightType.

System.Double[] means

The mean vector containing already calculated means for each column of the matrix.

System.Boolean unbiased

Pass true to compute the sample variance; or pass false to compute the population variance. For integers weights , the bias correction is equivalent to the non-weighted case. For fractional weights, the variance bias cannot be completely eliminated.

WeightType weightType

How the weights should be interpreted for the bias correction.

Returns
Type Description
System.Double[]

Returns a vector containing the variances of the given matrix.

View Source

WeightedVariance(Double[,], Int32[])

Calculates the matrix Variance vector.

Declaration
public static double[] WeightedVariance(this double[, ] matrix, int[] weights)
Parameters
Type Name Description
System.Double[,] matrix

A matrix whose variances will be calculated.

System.Int32[] weights

The number of times each sample should be repeated.

Returns
Type Description
System.Double[]

Returns a vector containing the variances of the given matrix.

View Source

WeightedVariance(Double[,], Int32[], Double[])

Calculates the matrix Variance vector.

Declaration
public static double[] WeightedVariance(this double[, ] matrix, int[] weights, double[] means)
Parameters
Type Name Description
System.Double[,] matrix

A matrix whose variances will be calculated.

System.Int32[] weights

The number of times each sample should be repeated.

System.Double[] means

The mean vector containing already calculated means for each column of the matrix.

Returns
Type Description
System.Double[]

Returns a vector containing the variances of the given matrix.

View Source

WeightedVariance(Double[,], Int32[], Double[], Boolean)

Calculates the matrix Variance vector.

Declaration
public static double[] WeightedVariance(this double[, ] matrix, int[] weights, double[] means, bool unbiased)
Parameters
Type Name Description
System.Double[,] matrix

A matrix whose variances will be calculated.

System.Int32[] weights

The number of times each sample should be repeated.

System.Double[] means

The mean vector containing already calculated means for each column of the matrix.

System.Boolean unbiased

Pass true to compute the sample variance; or pass false to compute the population variance. For integers weights , the bias correction is equivalent to the non-weighted case. For fractional weights, the variance bias cannot be completely eliminated.

Returns
Type Description
System.Double[]

Returns a vector containing the variances of the given matrix.