Tyler shrinkage: private API

PortfolioOptimisers.observation_weight_vector — Function
observation_weight_vector(X::MatNum, w::Option{<:StatsBase.AbstractWeights}) -> Vector

Returns the weight of each observation of X as a vector, a vector of ones when w is nothing.

Arguments

  • X: The data, observations × assets.
  • w: The observation weights, or nothing.

Returns

  • wt::Vector: The weight of each observation.

Related

source
PortfolioOptimisers.ShapeShrinkage — Type
struct ShapeShrinkage{__T_alg, __T_rho}

Holds the form and the intensity of the shrinkage of one Tyler shape.

Fields

  • rho: Shrinkage intensity of the fit, the weight of the target.

Constructors

ShapeShrinkage(    alg::AbstractTylerShrinkageAlgorithm,    rho::Number) -> ShapeShrinkage

Related

source
PortfolioOptimisers.tyler_intensity_bound — Function
tyler_intensity_bound(W::MatNum, w::Option{<:StatsBase.AbstractWeights}) -> Number

Returns the intensity above which the shape of PenalisedShrinkage exists.

In general position a subspace of dimension $r$ holds at most $r$ observations. Theorem 3 of [116] then needs $(1 - \rho) p$ times the largest share of the weight of one observation below one. With equal weights the bound is $1 - n/p$. A negative bound means that the shape exists with no shrinkage. With n == p the bound is zero, and the shape does not exist with no shrinkage.

Arguments

  • W: The centred data.
  • w: The observation weights, or nothing.

Returns

  • lo::Number: The bound, below one.

Related

References

  • [116] E. Ollila and D. E. Tyler. Regularized M-estimators of scatter matrix. IEEE Transactions on Signal Processing 62, 6059–6070 (2014). Section V, Theorem 3.
source
PortfolioOptimisers.assert_tyler_intensity — Function
assert_tyler_intensity(alg::TraceNormalisedShrinkage, rho::Number, lo::Number)
assert_tyler_intensity(alg::PenalisedShrinkage, rho::Number, lo::Number)

Refuses a shrinkage intensity at which the shape does not exist.

Arguments

Validation

Otherwise, the function raises a DomainError.

Returns

  • nothing.

Related

source
PortfolioOptimisers.smallest_intensity — Function
smallest_intensity(reaches, lo::Number) -> Number

Returns the smallest intensity in (max(lo, 0), 1] at which reaches is true, up to the width $2^{-10}$ of the last interval.

The function bisects the interval ten times. reaches(1) must be true, and the function does not call it there. The returned intensity is an end of an interval at which reaches is true.

Arguments

  • reaches: A function of the intensity that returns a Bool.
  • lo: The lower end of the interval. A negative value stands for zero.

Returns

  • rho::Number: The intensity.

Related

source
PortfolioOptimisers.penalised_intensity — Function
penalised_intensity(weight::Number, W::MatNum, w::Option{<:StatsBase.AbstractWeights}) -> Number

Returns the intensity of PenalisedShrinkage at which the target has a given weight in the shape of trace p.

The shape has no fixed trace, so the weight of the target in it is the intensity over the mean of its diagonal.

Arguments

  • weight: The weight of the target.
  • W: The centred data.
  • w: The observation weights, or nothing.

Returns

  • rho::Number: The intensity, one when weight is one or more.

Related

References

  • [117] R. Couillet and M. McKay. Large dimensional analysis and optimization of robust shrinkage covariance matrix estimators. Journal of Multivariate Analysis 131, 99–120 (2014). Proposition 2.
source
PortfolioOptimisers.asymptotic_weight — Function
asymptotic_weight(W::MatNum, w::Option{<:StatsBase.AbstractWeights}) -> Number

Returns the weight of the target that AsymptoticIntensity gives to a Tyler shape.

Arguments

  • W: The centred data, in the coordinates that turn the target into the identity matrix.
  • w: The observation weights, or nothing.

Returns

  • weight::Number: The weight, positive. It can be above one.

Related

References

  • [117] R. Couillet and M. McKay. Large dimensional analysis and optimization of robust shrinkage covariance matrix estimators. Journal of Multivariate Analysis 131, 99–120 (2014). Proposition 2.
source
PortfolioOptimisers.tyler_fit — Function
tyler_fit(shr::Nothing, ve::Option{<:StatsBase.CovarianceEstimator}, X::MatNum,
          w::Option{<:StatsBase.AbstractWeights}, centre::Option{<:VecNum}; kwargs...)
tyler_fit(shr::TylerShrinkage, ve::Option{<:StatsBase.CovarianceEstimator}, X::MatNum,
          w::Option{<:StatsBase.AbstractWeights}, centre::Option{<:VecNum}; kwargs...)

Returns the location, the covariance and the shrinkage intensity of a TylerCovariance.

Algorithm

The nothing method refuses a sample with too few observations with assert_robust_rows, solves the shape and the location with tyler_fixed_point, and scales the shape with tyler_scale. It returns nothing in place of the intensity.

The TylerShrinkage method does these steps:

  1. Refuse fewer than two observations of positive weight. Take the pilot centre: the coordinatewise weighted median, or centre. Take the robust scale of each centred column with quantile_scale, and its square as the robust variance. An asset with no robust scale has the variance zero.
  2. Build the pilot covariance from these variances and from the correlations of the spatial_sign_scatter of the scaled data. Build the target with robust_target.
  3. Multiply the centred data by the inverse of the symmetric root of the target, so that the target is the identity matrix.
  4. Find the intensity with tyler_intensity, and refuse it with assert_tyler_intensity when the shape does not exist.
  5. Solve the shape and the location in these coordinates with tyler_fixed_point, and map both back.
  6. Scale the shape with tyler_scale and the robust variances.

Arguments

  • shr: The shrinkage, or nothing.
  • ve: The variance estimator of the scale, or nothing.
  • X: The data matrix, observations × assets.
  • w: The observation weights, or nothing.
  • centre: The fixed centre, or nothing.
  • kwargs...: More keyword arguments for ve.

Returns

  • (mu, sigma, rho): The location, the covariance, and the intensity.

Related

source

References

[116]
E. Ollila and D. E. Tyler. Regularized M-estimators of scatter matrix. IEEE Transactions on Signal Processing 62, 6059–6070 (2014).
[117]
R. Couillet and M. McKay. Large dimensional analysis and optimization of robust shrinkage covariance matrix estimators. Journal of Multivariate Analysis 131, 99–120 (2014).