MCD factors: private API
PortfolioOptimisers.mcd_subset_size — Function
mcd_subset_size(shr::Nothing, alpha::Number, n::Integer, p::Integer) -> Int
mcd_subset_size(shr::MCDShrinkage, alpha::Number, n::Integer, p::Integer) -> IntReturns the size h of the MCD subset for the subset fraction alpha.
At alpha = 1/2, $h = \lfloor (n + p + 1)/2 \rfloor$, the size of the largest breakdown point. At alpha = 1, $h = n$. The function interpolates between the two, as the function h.alpha.n of the R package robustbase, version 0.99-7, does. That function takes the floor of a floating-point product, which can be one too small. This function takes the exact floor, with fraction_floor.
With a shrinkage, the scatter of a subset exists for every size, so the size does not depend on the number of assets. It is $\lceil \alpha n \rceil$, as [112] has it, with the exact ceiling of fraction_ceil, and at least the smallest number above $n/2$, which Theorem 1 of that work needs.
Mathematical definition
\[\begin{align} h_2 &= \lfloor (n + p + 1)/2 \rfloor\,, \\ h &= \lfloor 2 h_2 - n + 2 (n - h_2) \alpha \rfloor\,. \end{align}\]
Arguments
shr: The shrinkage, ornothing.alpha: The subset fraction,1/2 <= alpha <= 1.n: The number of observations.p: The number of assets.
Validation
- With no shrinkage,
n > p, which is the same condition ash > p, seeassert_robust_rows. With a shrinkage,h > 1. Otherwise, the function raises aDomainError.
Returns
h::Int: The size of the subset.
Related
References
- [120] P. J. Rousseeuw and K. Van Driessen. A fast algorithm for the minimum covariance determinant estimator. Technometrics 41, 212–223 (1999). Section 4, step 1.
- [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 2.1 and Section 3, Theorem 1.
PortfolioOptimisers.mcd_consistency — Function
mcd_consistency(p::Integer, a::Number) -> NumberReturns the factor that makes the covariance of the a fraction of the observations nearest to the centre consistent at the normal model.
The covariance of the observations inside the ellipsoid of probability $a$ of a normal distribution is smaller than the covariance of the distribution, by the factor $F_{\chi^2_{p+2}}(\chi^2_{p,a})/a$. [121] gives the factor that corrects it. No copy of that work was found, so the formula follows from the moments of the truncated normal distribution, and it agrees with the code of the R package robustbase, version 0.99-7. MCDCovariance applies it to the raw MCD with $a = h/n$, and to the reweighted MCD with the probability of the cut-off of the reweighting.
Mathematical definition
\[\begin{align} c_{p,a} &= \frac{a}{F_{\chi^2_{p+2}}\left(\chi^2_{p,a}\right)}\,. \end{align}\]
Where:
- $\chi^2_{p,a}$: The quantile $a$ of the $\chi^2_p$ distribution.
- $F_{\chi^2_{p+2}}$: The distribution function of the $\chi^2_{p+2}$ distribution.
Arguments
p: The number of assets.a: The probability,0 < a <= 1.
Returns
c::Number: The factor, one ata = 1.
Related
References
- [121] C. Croux and G. Haesbroeck. Influence function and efficiency of the minimum covariance determinant scatter matrix estimator. Journal of Multivariate Analysis 71, 161–190 (1999).
PortfolioOptimisers.PISON_COEFFICIENTS — Constant
PISON_COEFFICIENTSThe coefficients of the small-sample factors of the MCD covariance of MCDSmallSampleCorrection.
The keys are (:raw, alpha) and (:rew, alpha) for the subset fractions alpha of 1/2 and 7/8. Each value holds the pairs (alfaq, betaq) at the multipliers q = 2 and q = 3 of $p^2$ for $p > 2$, and the pairs (log γ, β) of the factor $1 - γ / n^β$ for $p = 2$ and $p = 1$. The values are those of the R package robustbase, version 0.99-7.
Related
PortfolioOptimisers.pison_fraction_factor — Function
pison_fraction_factor(kind::Symbol, alpha::Number, p::Integer, n::Integer) -> NumberReturns the fitted ratio $f$ of the expected MCD covariance to the true covariance, at one of the two simulated subset fractions.
For $p > 2$, the function solves the two equations $\log(-a_q / p^{b_q}) = c_0 - c_1 \log(q p^2)$, q = 2, 3, for $(c_0, c_1)$. The ratio is then $1 - e^{c_0} / n^{c_1}$. For $p \leq 2$ the coefficients of the ratio are stated directly.
Arguments
kind::rawfor the raw MCD, or:rewfor the reweighted MCD.alpha: The simulated subset fraction,0.5or0.875.p: The number of assets.n: The number of observations.
Returns
f::Number: The ratio, below one.
Related
References
- [1] G. Pison, S. Van Aelst and G. Willems. Small sample corrections for LTS and MCD. Metrika 55, 111–123 (2002). Section 3.3, Equations 4 to 7.
PortfolioOptimisers.mcd_correction — Function
mcd_correction(ssc::Option{<:MCDSmallSampleCorrection}, p::Integer, n::Integer,
alpha::Number, kind::Symbol) -> NumberReturns the small-sample factor of the MCD covariance, or one when ssc is nothing.
The factor is the reciprocal of the ratio of pison_fraction_factor, interpolated in the subset fraction alpha. Between 1/2 and 7/8 the interpolation is linear. Above 7/8 it is linear between the ratio at 7/8 and one at alpha = 1.
Arguments
ssc: The correction, ornothingfor no correction.p: The number of assets.n: The number of observations.alpha: The subset fraction.kind::rawfor the raw MCD, or:rewfor the reweighted MCD.
Validation
- The interpolated ratio is positive. Otherwise, the sample is too small for the fitted factor, and the method raises a
DomainError.
Returns
f::Number: The factor.
Related
References
- [1] G. Pison, S. Van Aelst and G. Willems. Small sample corrections for LTS and MCD. Metrika 55, 111–123 (2002). Section 3.2.
References
- [1]
- G. Pison, S. Van Aelst and G. Willems. Small sample corrections for LTS and MCD. Metrika 55, 111–123 (2002).
- [112]
- K. Boudt, P. J. Rousseeuw, S. Vanduffel and T. Verdonck. The minimum regularized covariance determinant estimator. Statistics and Computing 30, 113–128 (2020).
- [120]
- P. J. Rousseeuw and K. Van Driessen. A fast algorithm for the minimum covariance determinant estimator. Technometrics 41, 212–223 (1999).
- [121]
- C. Croux and G. Haesbroeck. Influence function and efficiency of the minimum covariance determinant scatter matrix estimator. Journal of Multivariate Analysis 71, 161–190 (1999).