Internal Documentation

Documentation for CovarianceEstimation.jl's internal methods.

See Public Documentation for public package docs.

Contents

Index

Internals

CovarianceEstimation.rescaleFunction
rescale(M, d)

Internal function to scale the rows and the columns of a square matrix M according to the elements in d. This is useful when dealing with the standardised data matrix which can be written Xs=Xc*D where Xc is the centered data matrix and D=Diagonal(d) so that its simple covariance is D*S*D where S is the simple covariance of Xc. Such D*M*D terms appear often in the computations of optimal shrinkage λ.

  • Space complexity: $O(p^2)$
  • Time complexity: $O(p^2)$
source
CovarianceEstimation.uccovFunction
uccov(X)

Internal function to compute X*X'/n where n is the number of rows of X. This corresponds to the uncorrected covariance of X if X is centered. This operation appears often in the computations of optimal shrinkage λ.

  • Space complexity: $O(p^2)$
  • Time complexity: $O(2np^2)$
source
CovarianceEstimation.sumijFunction
sumij(S)

Internal function to compute the sum of elements of a square matrix S. A keyword with_diag can be passed to indicate whether to include or not the diagonal of S in the sum. Both cases happen often in the computations of optimal shrinkage λ.

  • Space complexity: $O(1)$
  • Time complexity: $O(p^2)$
source
CovarianceEstimation.sumij2Function
sumij2(S)

Internal function identical to sumij except that it passes the function abs2 to the sum so that it is the sum of the elements of S squared which is computed. This is significantly more efficient than using sumij(S.^2) for large matrices as it allocates very little.

  • Space complexity: $O(1)$
  • Time complexity: $O(2p^2)$
source
CovarianceEstimation.sum_fijFunction
sum_fij(Xc, S, n, κ)

Internal function corresponding to $∑_{i≂̸j}f_{ij}$ that appears in https://strimmerlab.github.io/publications/journals/shrinkcov2005.pdf p.11.

  • Space complexity: $O(np + 2p^2)$
  • Time complexity: $O(2np^2)$
source
CovarianceEstimation.linear_shrinkageFunction
linear_shrinkage(target, Xc, S, λ, n, p, pvar, corrected, [weights])

Performs linear shrinkage with target of type target for data matrix Xc of size n by p with covariance matrix S and shrinkage parameter λ. Calculates corrected covariance if corrected is true.

pvar == p or pvar = p - sum(iszero, diag(S)), the number of non-zero diagonal variances in S. The choice is controlled by LinearShrinkage(...; drop_var0=true/false).

source
CovarianceEstimation.analytical_nonlinear_shrinkageFunction
analytical_nonlinear_shrinkage(S, n, p; decomp)

Internal implementation of the analytical nonlinear shrinkage. The implementation is inspired from the Matlab code given in section C of Olivier Ledoit and Michael Wolf's paper "Analytical Nonlinear Shrinkage of Large-Dimensional Covariance Matrices". (Nov 2018) http://www.econ.uzh.ch/static/wp/econwp264.pdf

source