Stats.CovarianceMatrix Method

Definition

Namespace: Numerics.NET.Statistics
Assembly: Numerics.NET (in Numerics.NET.dll) Version: 9.0.3

Overload List

CovarianceMatrix(IList<Vector<Double>>) Returns the covariance matrix for a list of numerical variables.
CovarianceMatrix(ReadOnlySpan<Vector<Double>>) Returns the covariance matrix for an array of numerical variables.
CovarianceMatrix(Vector<Double>[]) Returns the covariance matrix for an array of numerical variables.
CovarianceMatrix<T>(Matrix<T>, MultipleMissingValueAction) Returns the covariance matrix for the columns in a matrix.

CovarianceMatrix(IList<Vector<Double>>)

Returns the covariance matrix for a list of numerical variables.
C#
public static SymmetricMatrix<double> CovarianceMatrix(
	this IList<Vector<double>> variables
)

Parameters

variables  IList<Vector<Double>>
A list of Vector<T>.

Return Value

SymmetricMatrix<Double>
A symmetric matrix containing the covariance between the elements of variables.

Usage Note

In Visual Basic and C#, you can call this method as an instance method on any object of type IList<Vector<Double>>. When you use instance method syntax to call this method, omit the first parameter. For more information, see Extension Methods (Visual Basic) or Extension Methods (C# Programming Guide).

Exceptions

ArgumentNullException

variables is null.

ArgumentException

One or more of the elements of variables is null.

-or-

Not all elements of variables have the same length.

CovarianceMatrix(ReadOnlySpan<Vector<Double>>)

Returns the covariance matrix for an array of numerical variables.
C#
public static SymmetricMatrix<double> CovarianceMatrix(
	ReadOnlySpan<Vector<double>> variables
)

Parameters

variables  ReadOnlySpan<Vector<Double>>
An array of Vector<T>.

Return Value

SymmetricMatrix<Double>
A symmetric matrix containing the covariance between the elements of variables.

Exceptions

ArgumentNullException

variables is null.

ArgumentException

One or more of the elements of variables is null.

-or-

Not all elements of variables have the same length.

CovarianceMatrix(Vector<Double>[])

Returns the covariance matrix for an array of numerical variables.
C#
public static SymmetricMatrix<double> CovarianceMatrix(
	this Vector<double>[] variables
)

Parameters

variables  Vector<Double>[]
An array of Vector<T>.

Return Value

SymmetricMatrix<Double>
A symmetric matrix containing the covariance between the elements of variables.

Usage Note

In Visual Basic and C#, you can call this method as an instance method on any object of type Vector<Double>[]. When you use instance method syntax to call this method, omit the first parameter. For more information, see Extension Methods (Visual Basic) or Extension Methods (C# Programming Guide).

Exceptions

ArgumentNullException

variables is null.

ArgumentException

One or more of the elements of variables is null.

-or-

Not all elements of variables have the same length.

CovarianceMatrix<T>(Matrix<T>, MultipleMissingValueAction)

Returns the covariance matrix for the columns in a matrix.
C#
public static SymmetricMatrix<T> CovarianceMatrix<T>(
	this Matrix<T> matrix,
	MultipleMissingValueAction missingValueAction = MultipleMissingValueAction.Default
)

Parameters

matrix  Matrix<T>
A matrix.
missingValueAction  MultipleMissingValueAction  (Optional)
The action to take when missing values are encountered. The default is list-wise deletion.

Type Parameters

T

Return Value

SymmetricMatrix<T>
A symmetric matrix containing the covariances between the columns of matrix.

Usage Note

In Visual Basic and C#, you can call this method as an instance method on any object of type Matrix<T>. When you use instance method syntax to call this method, omit the first parameter. For more information, see Extension Methods (Visual Basic) or Extension Methods (C# Programming Guide).

Exceptions

ArgumentNullException

matrix is null.

See Also