Negative Skewness
PortfolioOptimisers.NegativeSkewness — Type
struct NegativeSkewness{__T_settings, __T_mp, __T_sk, __T_V, __T_alg, __T_window, __T_mtx_sqrt} <: RiskMeasureMeasures 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
skwhen 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
Vwhen 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 matrixassets × assets^2. Also admits a Deferred Quantity — a coskewness estimator or a prior estimator that computes the matrix against the optimisation's own prior, atfactorytime (seeSkSlotandresolve_deferred_quantities). A coskewness estimator suppliesmuas well, from its ownme, so that the tensor and the centre it was taken about come out of one object. Ifnothing, the prior supplies it.
V: Optional sum of the negative spectral slices of the coskewness matrixassets × assets. Derived fromsk, so it never defers: it arrives as one pair with whateverskresolves to, and the matrix processing estimator that built it travels with it and replacesmp. Give it with a matrixskand with neither otherwise. Stating it whileskholds a Deferred Quantity is refused at construction.
alg: Risk measure optimisation formulation algorithm.
window: Observation window. An integer selects the lastwindowobservations, and a vector of indices selects those observations.
mtx_sqrt: Square-root algorithm of $\mathbf{V}$ that the SOC formulation reads, ornothingfor the plain Cholesky factor, which raises aLinearAlgebra.PosDefExceptionon 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_rootstates 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()) -> NegativeSkewnessKeywords correspond to the struct's fields.
Validation
- If
skis a matrix,Vmust be given as well, and the reverse. Both must be non-empty, withsize(sk, 1)^2 == size(sk, 2)andVsquare. - If
skholds a Deferred Quantity,Vmust benothing. The fit supplies the pair. windowis validated withassert_nonempty_nonneg_finite_val.
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.
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
RiskMeasureRiskMeasureSettingsKurtosisHighOrderMomentNSkeQuadFormulationsSOCRiskExprexpected_risknegative_spectral_coskewnessset_risk_constraints!
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.
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
- Resolve a Deferred Quantity in
skwithresolve_deferred_quantities, givingr. - Select
skandVwithnothing_scalar_array_selector, fromror else frompr.skandpr.V. - Rebuild
rwithskandV, withrebuild_struct. Thesettings,mp,alg,windowandmtx_sqrtofrdo not change.
Related
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
References
- [65]
- D. Cajas. On the Spectral Decomposition of Portfolio Skewness and its Application to Portfolio Optimization. Available at SSRN 4540021 (2023).