covariance-0.2.0.1: Well-conditioned estimation of large-dimensional covariance matrices
Copyright2021 Dominik Schrempf
LicenseGPL-3.0-or-later
Maintainerdominik.schrempf@gmail.com
Stabilityexperimental
Portabilityportable
Safe HaskellNone
LanguageHaskell2010

Statistics.Covariance

Description

Creation date: Tue Sep 14 13:02:15 2021.

Synopsis

Empirical estimator

empiricalCovariance Source #

Arguments

:: Matrix Double

Data matrix of dimension NxP, where N is the number of observations, and P is the number of parameters.

-> Herm Double 

Empirical or sample covariance.

Classical maximum-likelihood estimator; asymptotically unbiased but sensitive to outliers.

Re-export of the empirical covariance meanCov provided by hmatrix.

NOTE: This function may call error.

Shrinkage based estimators

See the overview on shrinkage estimators provided by scikit-learn.

ledoitWolf Source #

Arguments

:: DoCenter 
-> Matrix Double

Sample data matrix of dimension \(n \times p\), where \(n\) is the number of samples (rows), and \(p\) is the number of parameters (columns).

-> Either String (Herm Double) 

Shrinkage based covariance estimator by Ledoit and Wolf.

See Ledoit, O., & Wolf, M., A well-conditioned estimator for large-dimensional covariance matrices, Journal of Multivariate Analysis, 88(2), 365–411 (2004). http://dx.doi.org/10.1016/s0047-259x(03)00096-4.

Return Left if

  • only one sample is available.
  • no parameters are available.

NOTE: This function may call error due to partial library functions.

raoBlackwellLedoitWolf Source #

Arguments

:: Matrix Double

Sample data matrix of dimension \(n \times p\), where \(n\) is the number of samples (rows), and \(p\) is the number of parameters (columns).

-> Either String (Herm Double) 

Improved shrinkage based covariance estimator by Ledoit and Wolf using the Rao-Blackwell theorem.

See Chen, Y., Wiesel, A., Eldar, Y. C., & Hero, A. O., Shrinkage algorithms for mmse covariance estimation, IEEE Transactions on Signal Processing, 58(10), 5016–5029 (2010). http://dx.doi.org/10.1109/tsp.2010.2053029.

Return Left if

  • only one sample is available.
  • no parameters are available.

NOTE: This function may call error due to partial library functions.

oracleApproximatingShrinkage Source #

Arguments

:: Matrix Double

Sample data matrix of dimension \(n \times p\), where \(n\) is the number of samples (rows), and \(p\) is the number of parameters (columns).

-> Either String (Herm Double) 

Iterative shrinkage based covariance estimator.

See Chen, Y., Wiesel, A., Eldar, Y. C., & Hero, A. O., Shrinkage algorithms for mmse covariance estimation, IEEE Transactions on Signal Processing, 58(10), 5016–5029 (2010). http://dx.doi.org/10.1109/tsp.2010.2053029.

Return Left if

  • only one sample is available.
  • no parameters are available.

NOTE: This function may call error due to partial library functions.

Gaussian graphical model based estimators

graphicalLasso Source #

Arguments

:: Double

Regularization or lasso parameter; penalty for non-zero covariances. The higher the lasso parameter, the sparser the estimated inverse covariance matrix. Must be non-negative.

-> Matrix Double

Sample data matrix of dimension \(n \times p\), where \(n\) is the number of samples (rows), and \(p\) is the number of parameters (columns).

-> Either String (Herm Double, Herm Double)

Either ErrorString (Covariance matrix, Precision matrix).

Gaussian graphical model based estimator.

This function estimates both, the covariance and the precision matrices. It is best suited for sparse covariance matrices.

For now, this is just a wrapper around glasso.

See Friedman, J., Hastie, T., & Tibshirani, R., Sparse inverse covariance estimation with the graphical lasso, Biostatistics, 9(3), 432–441 (2007). http://dx.doi.org/10.1093/biostatistics/kxm045.

Return Left if

  • the regularization parameter is out of bounds \([0, \infty)\).
  • only one sample is available.
  • no parameters are available.

NOTE: This function may call error due to partial library functions.

Misc

data DoCenter Source #

For some methods, data matrices have to be centered before estimation of the covariance matrix. Sometimes, data matrices are already centered, and in this case, duplicate centering can be avoided.

Constructors

DoCenter

Perform centering.

AssumeCentered

Do not perform centering; assume the data matrix is already centered.

Helper functions

scale Source #

Arguments

:: Matrix Double

Sample data matrix of dimension \(n \times p\), where \(n\) is the number of samples (rows), and \(p\) is the number of parameters (columns).

-> (Vector Double, Vector Double, Matrix Double)

(Means, Standard deviations, Centered and scaled matrix)

Center and scales columns.

Normalize a data matrix to have means 0 and standard deviations/variances 1.0. The estimated covariance matrix of a scaled data matrix is a correlation matrix, which is easier to estimate.

rescaleSWith Source #

Arguments

:: Vector Double

Vector of standard deviations of length \(p\).

-> Matrix Double

Normalized correlation matrix of dimension \(p \times p\).

-> Matrix Double

Covariance matrix of original scale and of dimension \(p \times p\).

Convert a correlation matrix with given standard deviations to original scale.

rescalePWith :: Vector Double -> Matrix Double -> Matrix Double Source #

See rescaleSWith but for precision matrices.