Copyright | 2021 Dominik Schrempf |
---|---|
License | GPL-3.0-or-later |
Maintainer | dominik.schrempf@gmail.com |
Stability | experimental |
Portability | portable |
Safe Haskell | None |
Language | Haskell2010 |
Creation date: Tue Sep 14 13:02:15 2021.
Synopsis
- empiricalCovariance :: Matrix Double -> Herm Double
- ledoitWolf :: DoCenter -> Matrix Double -> Either String (Herm Double)
- raoBlackwellLedoitWolf :: Matrix Double -> Either String (Herm Double)
- oracleApproximatingShrinkage :: Matrix Double -> Either String (Herm Double)
- graphicalLasso :: Double -> Matrix Double -> Either String (Herm Double, Herm Double)
- data DoCenter
- scale :: Matrix Double -> (Vector Double, Vector Double, Matrix Double)
- rescaleSWith :: Vector Double -> Matrix Double -> Matrix Double
- rescalePWith :: Vector Double -> Matrix Double -> Matrix Double
Empirical estimator
Shrinkage based estimators
See the overview on shrinkage estimators provided by scikit-learn.
:: 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 #
:: 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 #
:: 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
:: 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) |
|
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
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.
DoCenter | Perform centering. |
AssumeCentered | Do not perform centering; assume the data matrix is already centered. |
Helper functions
:: 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.
:: 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.