Compact Radius Rules

PortfolioOptimisers.ResidualInflationType
struct ResidualInflation{__T_q, __T_dof} <: AbstractCompactRadiusAlgorithm

Sizes the compact radius as the upper confidence bound on the idiosyncratic variance, so the penalty is a quantile rather than a stated magnitude.

The set's penalty lives exactly where the idiosyncratic variance lives. The directions the factors span pay nothing, and the complement carries $\mathbf{D}$, the idiosyncratic covariance the loadings block measured. So the question the radius answers is how far the estimate of that covariance can sit from the truth, and the answer is a chi-squared bound on a variance.

The radius collapses to the relative inflation under the default metric. $\rho$ is dimensionless, and the operator norm below is 1 under InverseIdiosyncraticVarianceMetric, because $\mathbf{W} = \mathbf{D}^{-1}$ leaves a projector inside the norm. Under IdentityMetric the same norm carries the variance units that $\kappa$ needs there. One formula therefore serves every AbstractOrthogonalityMetric, and the metric is read rather than dispatched on.

Mathematical definition

\[\begin{align} \rho &= \dfrac{\nu}{\chi^{2,\,-1}_{\nu}(q)} - 1\,, \\ \kappa &= \rho \left\lVert \mathbf{D}^{1/2}\mathbf{W}^{1/2}\left(\mathbf{I} - \mathbf{Q}\mathbf{Q}^{\intercal}\right) \right\rVert_{2}^{2}\,. \end{align}\]

Where:

  • $\nu$: Degrees of freedom, compact_radius_dof when dof is nothing.
  • $\chi^{2,\,-1}_{\nu}(q)$: Lower $q$ quantile of the chi-squared distribution, so a smaller q raises $\rho$.
  • $\mathbf{D}$: Idiosyncratic covariance the block carries, read as its diagonal.
  • $\mathbf{W}$: Cross-sectional metric, the identity on IdentityMetric.
  • $\mathbf{Q}$: Orthonormal basis of the weighted factor span.

$\rho$ is the exact upper bound at level $1 - q$: $\nu \hat{d}_{i} / d_{i}$ is $\chi^{2}_{\nu}$, so $d_{i} \leq \hat{d}_{i}\nu / \chi^{2,\,-1}_{\nu}(q)$ with that confidence, and $\rho$ is the excess over the estimate. The operator norm is then the tightest $\kappa$ satisfying the set's own bound, because conjugating $\mathbf{W}^{-1/2}$ out of $\kappa \mathbf{C}^{\intercal}(\mathbf{I} - \mathbf{Q}\mathbf{Q}^{\intercal})\mathbf{C} \succeq \rho \, \mathbf{\Pi}\mathbf{D}\mathbf{\Pi}^{\intercal}$ leaves $\kappa \mathbf{P} \succeq \rho \mathbf{P}\mathbf{W}^{1/2}\mathbf{D}\mathbf{W}^{1/2}\mathbf{P}$, whose solution on the range of the projector is that norm.

A factor model that spans the whole cross-section leaves $\mathbf{P} = \mathbf{0}$ and a radius of zero, which is the same answer the mean axis gives for the same span.

The two qs are the same kind of number over two different errors. ue.q sizes the mean set, inverting a chi-squared at the dimension of the Orthogonal Subspace and reading no sample length at all. This one inverts a chi-squared at the residual degrees of freedom and shrinks like $\sqrt{2/T}$. Both tighten as q falls, so q = nothing reads ue.q and one stated level governs both axes.

Fields

  • q: Confidence level of the variance bound (0 < q < 1), or nothing to read the q of the owning estimator. A smaller q gives a larger radius.
  • dof: Degrees of freedom the fit left in each idiosyncratic variance, or nothing to derive them with compact_radius_dof.

Constructors

ResidualInflation(;    q::Option{<:Number} = nothing,    dof::Option{<:Number} = nothing) -> ResidualInflation

Keywords correspond to the struct's fields. Both default to nothing, so a bare call constructs and reads the confidence level of its owner and the degrees of freedom of the fit behind the block.

Validation

  • If q is not nothing: 0 < q < 1.
  • If dof is not nothing: isfinite(dof) and dof > 0.

Examples

julia> ResidualInflation()ResidualInflation    q ┼ nothing  dof ┴ nothing
julia> ResidualInflation(; q = 0.01, dof = 240)ResidualInflation    q ┼ Float64: 0.01  dof ┴ Int64: 240

Related

source
PortfolioOptimisers.VarianceFractionType
struct VarianceFraction{__T_f, __T_w0} <: AbstractCompactRadiusAlgorithm

Sizes the compact radius so the penalty is a stated fraction of the nominal variance at a reference portfolio, giving the caller a unit instead of a bare number.

The radius of a penalty is hard to state because it is a magnitude and not a probability. This rule converts it into one a caller can reason about: f = 0.1 says robustify by ten percent of nominal variance, measured where the reference portfolio sits. It assumes no sampling distribution, so it serves a block whose idiosyncratic variances were measured under an estimator whose degrees of freedom nobody can state.

Mathematical definition

\[\begin{align} \kappa &= f \, \dfrac{\boldsymbol{w}_{0}^{\intercal}\hat{\mathbf{\Sigma}}\boldsymbol{w}_{0}}{\left\lVert \left(\mathbf{I} - \mathbf{Q}\mathbf{Q}^{\intercal}\right)\mathbf{C}\boldsymbol{w}_{0} \right\rVert_{2}^{2}}\,. \end{align}\]

Where:

  • $f$: Fraction of the nominal variance the penalty is to equal at $\boldsymbol{w}_{0}$.
  • $\boldsymbol{w}_{0}$: Reference portfolio, the equal-weight one when w0 is nothing.
  • $\hat{\mathbf{\Sigma}}$: Nominal covariance the prior result carries.
  • $\mathbf{C}$: Diagonal metric square root of the covariance set.

The denominator is the penalty the set charges $\boldsymbol{w}_{0}$ at a unit radius, so the quotient is exactly the radius at which that penalty reaches $f$ of the nominal variance.

A span that covers the cross-section returns zero. The rank test is exact — the basis has as many columns as rows — and it is a statement about the rank rather than a tolerance. The penalty is then identically zero on every portfolio, the set is inert, and zero is the radius the mean axis already returns for the same span.

A reference portfolio inside the factor span sends the radius to infinity. $\mathbf{C}\boldsymbol{w}_{0} \in \operatorname{col}(\mathbf{Q})$ leaves a zero denominator with a non-zero projector, which means the penalty vanishes at $\boldsymbol{w}_{0}$ while other portfolios still pay it. No finite radius makes a vanishing penalty a fraction of anything, so the quotient diverges. There is no guard against it, and the reason is that the two ways it can arrive are not one case: an exactly vanishing penalty gives a value that is not finite, which CompactCovarianceUncertaintySet's own constructor refuses, while a projector that leaves a rounding residue gives a finite and enormous radius that no threshold separates from a legitimately large one. State a w0 outside the span, or size the radius with ResidualInflation, which reads no portfolio.

Fields

  • f: Fraction of the nominal variance the penalty is to equal at the reference portfolio, > 0.
  • w0: Reference portfolio the fraction is measured at. nothing reads the equal-weight portfolio, a vector is the portfolio itself, and an optimiser is run on the returns data the set was fitted beside.

Constructors

VarianceFraction(;    f::Number = 0.1,    w0::Union{Nothing, <:VecNum, <:NonFiniteAllocationOptimisationEstimator} = nothing) -> VarianceFraction

Keywords correspond to the struct's fields. Both default, so a bare call constructs and sizes the penalty at a tenth of the nominal variance of the equal-weight portfolio.

Validation

  • isfinite(f) and f > 0.
  • If w0 is a vector: !isempty(w0).

Examples

julia> VarianceFraction()VarianceFraction   f ┼ Float64: 0.1  w0 ┴ nothing
julia> VarianceFraction(; f = 0.25, w0 = [0.5, 0.3, 0.2])VarianceFraction   f ┼ Float64: 0.25  w0 ┴ Vector{Float64}: [0.5, 0.3, 0.2]

Related

source
PortfolioOptimisers.k_compactFunction
k_compact(alg::ResidualInflation, q::Number, metric::AbstractOrthogonalityMetric,
          pr::AbstractPriorResult, rr::AbstractLoadingsRegressionResult, C::VecNum,
          Q::MatNum, rd)
k_compact(alg::VarianceFraction, q::Number, metric::AbstractOrthogonalityMetric,
          pr::AbstractPriorResult, rr::AbstractLoadingsRegressionResult, C::VecNum,
          Q::MatNum, rd)
k_compact(kappa::Number, args...)

Radius of a CompactCovarianceUncertaintySet, computed from the prior result and the geometry the set was built on.

Algorithm

  1. On a Number, return it unchanged. A stated radius is the radius, and this is the method every caller who states one reaches.
  2. On a ResidualInflation, settle the confidence level as alg.q or q, settle the degrees of freedom as alg.dof or compact_radius_dof, form the relative inflation dof / cquantile-complement, and scale it by the squared operator norm of $\mathbf{D}^{1/2}\mathbf{W}^{1/2}$ against the orthogonal projector. $\mathbf{W}^{1/2}$ is the element-wise inverse of C, which the set already carries.
  3. On a VarianceFraction, return zero when the span covers the cross-section, and otherwise divide f times the nominal variance at the reference portfolio by the penalty that portfolio pays at a unit radius.

Arguments

  • alg: Rule, or the radius itself.
  • q: Confidence level of the owning estimator, read when the rule states none.
  • metric: Cross-sectional weighting the span was taken under. It reaches the rules through C, which is its inverse square root, so no method dispatches on it.
  • pr: Prior result the set is being fitted on.
  • rr: Loadings block the span came from.
  • C: Diagonal metric square root of the covariance set, $\mathbf{W}^{-1/2}$.
  • Q: Orthonormal basis of the weighted factor span.
  • rd: Returns data the set was fitted beside, or nothing.

Validation

  • On ResidualInflation: the settled degrees of freedom are finite and > 0, else a DomainError naming the sample length and the factor count that produced them.
  • idiosyncratic_variances refuses a block that carries no esigma.

Returns

  • kappa::Number: Radius, which the set's own constructor then refuses if it is not finite and >= 0.

Related

source