Robust shrinkage: private API
PortfolioOptimisers.robust_target — Function
robust_target(tgt::CovarianceShrinkageTarget, pilot::MatNum) -> MatNumBuilds the target of a shrunk robust scatter from the robust pilot, and refuses a target that is not positive definite.
Arguments
tgt: The target rule, or a fixed matrix.pilot: The robust pilot covariance, in the units of the data.
Validation
- The target is positive definite. Otherwise, the function raises a
DomainError.
Returns
target::MatNum: The target.
Related
PortfolioOptimisers.symmetric_root — Function
symmetric_root(T::LinearAlgebra.Diagonal) -> LinearAlgebra.Diagonal
symmetric_root(T::MatNum) -> AbstractMatrixReturns the symmetric square root of a positive definite matrix.
The data times the inverse of the root have the identity matrix as their target. The symmetric root does not depend on the order of the assets.
Arguments
T: The target.
Returns
root::AbstractMatrix: The symmetric square root.
Related
PortfolioOptimisers.spatial_sign_scatter — Function
spatial_sign_scatter(W::MatNum, wt::VecNum) -> MatrixReturns the number of assets times the weighted spatial sign covariance of the centred data W.
The unit vector of each observation has the weight of the observation. An observation at the centre has no direction and leaves the sum. The trace of the result is the number of assets.
Arguments
W: The centred data,observations × assets.wt: The weight of each observation.
Returns
R::Matrix: The scatter, exactly symmetric.
Related
PortfolioOptimisers.sphericity — Function
sphericity(R::MatNum, n::Number) -> NumberReturns the estimate of the sphericity of a scatter from its spatial_sign_scatter, clamped into $[1, p]$.
Arguments
R: The spatial sign scatter, of trace $p$.n: The number of observations, or the effective count of the weights.
Returns
gamma::Number: The sphericity.
Related
References
- [113] E. Ollila and E. Raninen. Optimal shrinkage covariance matrix estimation under random sampling from elliptical distributions. IEEE Transactions on Signal Processing 67, 2707–2719 (2019). Section IV-A.
PortfolioOptimisers.robust_outliers — Function
robust_outliers(intensity::Nothing, d2::VecNum, p::Integer, q::Number) -> BitVector
robust_outliers(intensity::Number, d2::VecNum, p::Integer, q::Number) -> BitVectorFlags the observations of a robust fit whose squared distance is above the cut-off of the probability q.
The method of a fit with no shrinkage compares each squared distance with the quantile q of the $\chi^2_p$ distribution. The distances of a shrunk scatter do not have that distribution, because the shrinkage changes the metric. Section 6 of [112] states that the approximation fails when $p$ is large in relation to $n$. A squared distance in another metric is a weighted sum of $\chi^2_1$ variables, and its cube root is almost normal. So the method of a shrunk fit compares each cube root with the quantile q of the normal distribution that has the median and the robust scale of the cube roots. This cut-off is a rule of this library.
Arguments
intensity: The shrinkage intensity of the fit, ornothing.d2: The squared distance of each observation.p: The number of assets.q: The probability of the cut-off.
Returns
outlier::BitVector: The flags.
Related
References
- [112] K. Boudt, P. J. Rousseeuw, S. Vanduffel and T. Verdonck. The minimum regularized covariance determinant estimator. Statistics and Computing 30, 113–128 (2020). Section 6.
References
- [112]
- K. Boudt, P. J. Rousseeuw, S. Vanduffel and T. Verdonck. The minimum regularized covariance determinant estimator. Statistics and Computing 30, 113–128 (2020).
- [113]
- E. Ollila and E. Raninen. Optimal shrinkage covariance matrix estimation under random sampling from elliptical distributions. IEEE Transactions on Signal Processing 67, 2707–2719 (2019).