Negative Skewness

PortfolioOptimisers.NegativeSkewness — Type
struct NegativeSkewness{__T_settings, __T_mp, __T_sk, __T_V, __T_alg, __T_window, __T_mtx_sqrt} <: RiskMeasure

Measures the negative quadratic skewness of a portfolio, a convex part of its third moment.

The measure is the quadratic form of the weights in $\mathbf{V}$, or its square root. $\mathbf{V}$ sums the negative spectral parts of the slices of the coskewness matrix, so the measure is never negative, and it is larger for a portfolio whose returns have a heavier left tail. Smaller is better, so bigger_is_better returns false. To minimise the measure is the way of [65] to raise the skewness of a portfolio with a convex programme. set_risk_constraints! states the model, which is the second-order cone of Equation 2 of [65].

Mathematical definition

\[\begin{align} \mathbf{M}_3 &= \begin{bmatrix} \mathbf{S}_1 & \mathbf{S}_2 & \cdots & \mathbf{S}_N \end{bmatrix}\,, \\ \mathbf{V} &= -\sum_{i=1}^{N} \mathbf{S}_i^{-}\,, \\ \mathrm{NSke}(\boldsymbol{w}) &= \begin{cases} \sqrt{\boldsymbol{w}^\intercal \mathbf{V} \boldsymbol{w}} & \text{under } \texttt{SOCRiskExpr}\,, \\ \boldsymbol{w}^\intercal \mathbf{V} \boldsymbol{w} & \text{under } \texttt{QuadRiskExpr}\,,\ \texttt{SquaredSOCRiskExpr}\,. \end{cases} \end{align}\]

Where:

  • $\mathbf{M}_3$: Coskewness matrix of the risk measure, $N \times N^2$. It is the measure's own sk when the measure states one, and the prior's otherwise.
  • $\mathbf{S}_i$: Slice $i$ of $\mathbf{M}_3$, a symmetric $N \times N$ matrix.
  • $\mathbf{S}_i^{-}$: Negative spectral part of $\mathbf{S}_i$, the sum of the terms of its eigendecomposition with a negative eigenvalue. It is negative semidefinite, so $\mathbf{V}$ is positive semidefinite.
  • $\mathbf{V}$: Negative spectral coskewness, $N \times N$. It is the measure's own V when the measure states one, and the prior's otherwise.
  • $\boldsymbol{w}$: Portfolio weights vector $N \times 1$.

negative_spectral_coskewness builds $\mathbf{V}$, and it then repairs the matrix with the matrix processing mp.

Fields

  • settings: Risk measure settings.
  • mp: Matrix processing estimator.
  • sk: Optional coskewness matrix assets × assets^2. Also admits a Deferred Quantity — a coskewness estimator or a prior estimator that computes the matrix against the optimisation's own prior, at factory time (see SkSlot and resolve_deferred_quantities). A coskewness estimator supplies mu as well, from its own me, so that the tensor and the centre it was taken about come out of one object. If nothing, the prior supplies it.
  • V: Optional sum of the negative spectral slices of the coskewness matrix assets × assets. Derived from sk, so it never defers: it arrives as one pair with whatever sk resolves to, and the matrix processing estimator that built it travels with it and replaces mp. Give it with a matrix sk and with neither otherwise. Stating it while sk holds a Deferred Quantity is refused at construction.
  • alg: Risk measure optimisation formulation algorithm.
  • window: Observation window. An integer selects the last window observations, and a vector of indices selects those observations.
  • mtx_sqrt: Square-root algorithm of $\mathbf{V}$ that the SOC formulation reads, or nothing for the plain Cholesky factor, which raises a LinearAlgebra.PosDefException on a matrix that is not positive definite. $\mathbf{V}$ keeps only the negative spectral parts of the coskewness slices, so it is often singular, and the default takes the square root of its eigendecomposition then. matrix_square_root states each algorithm. The quadratic formulation reads no square root.

Constructors

NegativeSkewness(;    settings::RiskMeasureSettings = RiskMeasureSettings(),    mp::AbstractMatrixProcessingEstimator = MatrixProcessing(),    sk::Option{<:SkSlot} = nothing,    V::Option{<:MatNum} = nothing,    alg::NSkeFormulations = SOCRiskExpr(),    window::Option{<:Int_VecInt} = nothing,    mtx_sqrt::Option{<:AbstractMatrixSquareRootAlgorithm} = EigenFallbackSquareRoot()) -> NegativeSkewness

Keywords correspond to the struct's fields.

Validation

  • If sk is a matrix, V must be given as well, and the reverse. Both must be non-empty, with size(sk, 1)^2 == size(sk, 2) and V square.
  • If sk holds a Deferred Quantity, V must be nothing. The fit supplies the pair.
  • window is validated with assert_nonempty_nonneg_finite_val.
Warning

sk and V are a pair, and a stated V factors the sk beside it. A caller who wants one consistent pair names sk alone. A Deferred Quantity there supplies both from one fit, together with the mp that built them. A caller who states both by hand must make sure that they agree. A stated matrix is also fixed. It crosses a Cross-Validation fold as the answer for the whole universe, while a Deferred Quantity crosses unresolved and refits on the fold. A subset view slices sk and rebuilds V from the slice, with mp and window.

Info

sk also admits a CoskewnessEstimator or an AbstractPriorEstimator, which resolve_deferred_quantities resolves against the prior of the optimisation. V never defers. It comes from sk, so it comes out of that same fit. The processor that built it travels with it and replaces mp, so a later rebuild uses the same one. The measure carries one deferrable slot, so it takes no pe.

Functor

(r::NegativeSkewness)(w::VecNum)

Computes the Negative Skewness risk of a portfolio weight vector w.

Arguments

  • w::VecNum: Portfolio weights vector.

Examples

julia> NegativeSkewness()NegativeSkewness  settings ┼ RiskMeasureSettings           │   scale ┼ Float64: 1.0           │      ub ┼ nothing           │     rke ┴ Bool: true        mp ┼ MatrixProcessing           │     pdm ┼ Posdef           │         │      alg ┼ UnionAll: NearestCorrelationMatrix.Newton           │         │   kwargs ┴ @NamedTuple{}: NamedTuple()           │      dn ┼ nothing           │      dt ┼ nothing           │     alg ┼ nothing           │   order ┴ NTuple{4, Symbol}: (:pdm, :dn, :dt, :alg)        sk ┼ nothing         V ┼ nothing       alg ┼ SOCRiskExpr()    window ┼ nothing  mtx_sqrt ┴ EigenFallbackSquareRoot()

Related

References

  • [65] D. Cajas. On the Spectral Decomposition of Portfolio Skewness and its Application to Portfolio Optimization. Available at SSRN 4540021 (2023). Section 2, and Section 3, Equations 1 and 2.
source
PortfolioOptimisers.factory — Method
factory(
    r::NegativeSkewness,
    pr::HighOrderPrior,
    args...;
    kwargs...
) -> NegativeSkewness{RiskMeasureSettings{__T_scale, __T_ub, __T_rke}, <:AbstractMatrixProcessingEstimator} where {__T_scale, __T_ub, __T_rke}

Create an instance of NegativeSkewness that holds its coskewness matrix and its negative spectral coskewness, from the measure or from the HighOrderPrior result pr.

The method selects the two field by field and not as a pair, because the constructor refuses every mixed state. A stated sk always carries its own V, and a deferred sk always resolves to both. So the method takes the pair of the prior only when the measure names neither.

Algorithm

  1. Resolve a Deferred Quantity in sk with resolve_deferred_quantities, giving r.
  2. Select sk and V with nothing_scalar_array_selector, from r or else from pr.sk and pr.V.
  3. Rebuild r with sk and V, with rebuild_struct. The settings, mp, alg, window and mtx_sqrt of r do not change.

Related

source
PortfolioOptimisers.factory — Method
factory(
    r::NegativeSkewness,
    pr::LowOrderPrior,
    args...;
    kwargs...
) -> NegativeSkewness

Resolve a Deferred Quantity in NegativeSkewness's sk slot against a LowOrderPrior result, and otherwise return r unchanged.

A LowOrderPrior holds no coskewness, so the method has no pair to take from pr. A coskewness estimator in sk needs only the returns matrix of the result, so it resolves here too. The model needs V, and set_risk_constraints! refuses a measure that has none.

Related

source

References

[65]
D. Cajas. On the Spectral Decomposition of Portfolio Skewness and its Application to Portfolio Optimization. Available at SSRN 4540021 (2023).