MM covariance: private API
PortfolioOptimisers.mm_constant — Function
mm_constant(rw::BisquareReweighting, p::Integer) -> NumberReturns the tuning constant $c^2$ of the bisquare function at which the part rw.target of the M-step has the efficiency rw.eff at the normal model.
The efficiency of bisquare_efficiency rises with $c^2$, so a bisection finds the constant. The interval starts at $[p/2, p]$. Its lower bound halves and its upper bound doubles until it holds the constant.
Arguments
rw: The reweighting step.p: The number of assets.
Returns
c2::Number: The tuning constant.
Related
PortfolioOptimisers.bisquare_mstep — Function
bisquare_mstep(rw::BisquareReweighting, X::MatNum, mu::VecNum, sigma::MatNum,
fixed::Bool, q::Number, maxsteps::Integer) -> RobustCovarianceResultDoes the M-step of BisquareReweighting from the location mu and the covariance sigma of a raw fit.
Algorithm
- Take the constant $c^2$ of
mm_constant, the shape $\mathbf{\Sigma}_0 / s$ of determinant one withunit_determinant!, and the scale $s = \lvert \mathbf{\Sigma}_0 \rvert^{1/p}$ as the ratio of a diagonal entry of the covariance and of the shape. - Repeat at most
maxstepstimes:- Take the weight of each observation,
srho_weightofBisquareRhoat its squared distance in the metric of the shape, divided bys. - Take the weighted mean and the weighted scatter of determinant one with
weighted_shape. - Stop when the relative change of the shape and the change of the location in the metric of the scatter are both below
sqrt(eps), seeshape_converged.
- Take the weight of each observation,
- Warn when the steps do not converge, and keep the last iterate.
- Build the fit of the covariance
stimes the shape withsrho_fit, with the weights at $c^2$.
Arguments
rw: The reweighting step.X: The data matrix,observations × assets.mu: The location of the raw fit.sigma: The covariance of the raw fit.fixed: Whether the centre is fixed atmu.q: The probability of the cut-off of the outliers.maxsteps: The largest number of steps,S_MAX_ITERin a fit.
Validation
sigmais positive definite, and so is the weighted scatter of each step. Otherwise, the method raises theDomainErrorofunit_determinant!.
Returns
res::RobustCovarianceResult: The fit.
Related
References
- [130] K. S. Tatsuoka and D. E. Tyler. On the uniqueness of S-functionals and M-functionals under nonelliptical distributions. The Annals of Statistics 28, 1219–1243 (2000). Not read. The fixed point agrees with the R package
rrcov, version 1.7-7.
PortfolioOptimisers.show_fields — Method
show_fields(
_::MMCovariance
) -> Tuple{Symbol, Symbol, Symbol}
Renders every field of an MMCovariance except cache.
A cache holds the state of an incremental fit, not a part of the configuration. Set set_show_nothing_fields!(:MMCovariance, true) to render it.
Arguments
::MMCovariance: The estimator, read for its type alone.
Returns
fields::Tuple: The names of the fields to render,(:s, :rw, :q).
Related
References
- [130]
- K. S. Tatsuoka and D. E. Tyler. On the uniqueness of S-functionals and M-functionals under nonelliptical distributions. The Annals of Statistics 28, 1219–1243 (2000).