Skip to content
13

Variance Skew Kurtosis

PortfolioOptimisers.MaxRiskMeasureSettings Type
julia
struct MaxRiskMeasureSettings{__T_scale, __T_lb, __T_rke} <: JuMPRiskMeasureSettings

Settings type for configuring risk measures that expose a lower bound (maximisation direction).

Encapsulates scaling, lower bounds, and risk evaluation flags for risk measures such as Skewness that are maximised in optimisation routines. The lb field holds an optional lower bound on the risk expression; when set, the optimiser enforces the risk is at least that value.

Fields

  • scale: Scaling factor applied to the risk measure.

  • lb: Lower bound(s) for the risk measure. Can be a scalar, vector, or Frontier.

  • rke: Whether to include the risk measure value in the JuMP risk expression.

Constructors

julia
MaxRiskMeasureSettings(;
    scale::Number = 1.0,
    lb::Option{<:RkRtBounds} = nothing,
    rke::Bool = true,
) -> MaxRiskMeasureSettings

Keywords correspond to the struct's fields.

Validation

  • isfinite(scale).

Examples

julia
julia> MaxRiskMeasureSettings()
MaxRiskMeasureSettings
  scale ┼ Float64: 1.0
     lb ┼ nothing
    rke ┴ Bool: true

Related

source
PortfolioOptimisers.Skewness Type
julia
struct Skewness{__T_settings, __T_ve, __T_sk, __T_w, __T_mu} <: NonOptimisationRiskMeasure

Represents the standardised Skewness risk measure.

Skewness computes the third standardised central moment (skewness) of portfolio returns. Positive skewness is preferred (the distribution is skewed towards more positive values), so bigger_is_better returns true for this measure.

Mathematical definition

Let μ be the specified centre, δt=xtμ, and σ the standard deviation of returns. The skewness is:

Skew(x)=1Tσ3t=1Tδt3.

Where:

  • Skew(x): Standardised skewness of portfolio returns.

  • x: Portfolio returns vector T×1.

  • T: Number of observations.

  • μ: Specified centre of the distribution.

  • δt=xtμ: Centred deviation at period t.

  • σ: Standard deviation of returns.

Fields

  • settings: Risk measure settings.

  • ve: Variance estimator.

  • sk: Coskewness matrix features × features^2.

  • w: Optional portfolio weights.

  • mu: Optional mean for centering.

Constructors

julia
Skewness(;
    settings::MaxRiskMeasureSettings = MaxRiskMeasureSettings(),
    ve::AbstractVarianceEstimator = SimpleVariance(),
    sk::Option{<:MatNum} = nothing,
    w::Option{<:ObsWeights} = nothing,
    mu::Option{<:Num_VecNum_VecScalar} = nothing
) -> Skewness

Keywords correspond to the struct's fields.

Validation

  • If sk is not nothing: !isempty(sk) and size(sk, 1)^2 == size(sk, 2).

  • If mu is a VecNum: !isempty(mu).

  • If w is not nothing: !isempty(w).

Functor

julia
(r::Skewness)(w::VecNum, X::MatNum, fees = nothing)

Computes the skewness of the portfolio returns.

Arguments

  • w: Portfolio weights vector assets × 1.

  • X::MatNum: Asset returns matrix (T×N).

  • fees: Optional fee structure.

Examples

julia
julia> Skewness()
Skewness
  settings ┼ MaxRiskMeasureSettings
           │   scale ┼ Float64: 1.0
           │      lb ┼ nothing
           │     rke ┴ Bool: true
        ve ┼ SimpleVariance
           │          me ┼ SimpleExpectedReturns
           │             │   w ┴ nothing
           │           w ┼ nothing
           │   corrected ┴ Bool: true
        sk ┼ nothing
         w ┼ nothing
        mu ┴ nothing

Related

source
PortfolioOptimisers.bigger_is_better Method
julia
bigger_is_better(_::Skewness) -> Bool

Return true because higher skewness is preferred over lower skewness.

Related

source
PortfolioOptimisers.factory Method
julia
factory(
    r::Skewness,
    pr::HighOrderPrior,
    args...;
    kwargs...
) -> Skewness{MaxRiskMeasureSettings{Float64, Nothing, Bool}, <:AbstractVarianceEstimator}

Create an instance of Skewness by selecting observation weights and expected returns from the risk-measure instance or falling back to the prior result.

Related

source
PortfolioOptimisers.factory Method
julia
factory(r::Skewness, pr::LowOrderPrior, args...; kwargs...)

Create an instance of Skewness from a LowOrderPrior result, selecting observation weights and expected returns while preserving the coskewness matrix from the risk measure.

Related

source
PortfolioOptimisers.port_opt_view Method
julia
port_opt_view(
    r::Skewness{<:Any, <:Any, <:Nothing},
    i,
    args...
) -> Skewness{MaxRiskMeasureSettings{Float64, Nothing, Bool}, <:AbstractVarianceEstimator, Nothing}

Return a view of Skewness r sliced to asset indices i.

Slices the expected returns mu for cluster-based optimisation.

Related

source
PortfolioOptimisers.port_opt_view Method
julia
port_opt_view(
    r::Skewness{<:Any, <:Any, <:AbstractMatrix{<:Union{var"#s20", var"#s19"} where {var"#s20"<:Number, var"#s19"<:AbstractJuMPScalar}}},
    i,
    args...
) -> Skewness{MaxRiskMeasureSettings{Float64, Nothing, Bool}, <:AbstractVarianceEstimator}

Return a view of Skewness r sliced to asset indices i, also slicing the coskewness matrix sk.

Related

source
PortfolioOptimisers.no_risk_expr_risk_measure Method
julia
no_risk_expr_risk_measure(
    r::Skewness
) -> Skewness{MaxRiskMeasureSettings{__T_scale, __T_lb, Bool}, <:AbstractVarianceEstimator} where {__T_scale, __T_lb}

Return a copy of Skewness r with rke = false, disabling its contribution to the JuMP objective expression.

Related

source
PortfolioOptimisers.no_bounds_no_risk_expr_risk_measure Method
julia
no_bounds_no_risk_expr_risk_measure(
    r::Skewness
) -> Skewness{MaxRiskMeasureSettings{Int64, Nothing, Bool}, <:AbstractVarianceEstimator}
no_bounds_no_risk_expr_risk_measure(
    r::Skewness,
    
) -> Skewness{MaxRiskMeasureSettings{Int64, Nothing, Bool}, <:AbstractVarianceEstimator}

Return a copy of Skewness r with rke = false and lb = nothing, removing bounds and disabling its contribution to the JuMP objective expression.

Related

source
PortfolioOptimisers.bounds_risk_measure Method
julia
bounds_risk_measure(
    r::Skewness,
    ub::Number
) -> Skewness{MaxRiskMeasureSettings{var"#s179", var"#s1791", Bool}, <:AbstractVarianceEstimator} where {var"#s179"<:Number, var"#s1791"<:Number}

Return a copy of Skewness r with the lower bound set to ub.

Related

source
PortfolioOptimisers.VarianceSkewKurtosis Type
julia
struct VarianceSkewKurtosis{__T_settings, __T_vr, __T_sk, __T_kt} <: RiskMeasure

Composite risk measure combining variance, skewness, and kurtosis into a single expression.

VarianceSkewKurtosis encodes the joint SDP formulation σ2Skew+κ where each component has its own scale weight. The skewness term is subtracted because higher skewness is preferable.

Mathematical definition

R(w)=sσ2σ2(w)sskSkew(w)+sκκ(w),

Where:

  • σ2(w): Portfolio variance (via Variance).

  • Skew(w): Standardised portfolio skewness (via Skewness).

  • κ(w): Portfolio kurtosis (via Kurtosis).

  • sσ2,ssk,sκ: Respective scale factors from each sub-measure's settings.

Fields

  • settings: Risk measure settings.

  • vr: Variance risk measure component.

  • sk: Skewness risk measure component.

  • kt: Kurtosis risk measure component.

Constructors

julia
VarianceSkewKurtosis(;
    settings::RiskMeasureSettings = RiskMeasureSettings(),
    vr::Variance = Variance(),
    sk::Skewness = Skewness(),
    kt::Kurtosis = Kurtosis()
) -> VarianceSkewKurtosis

Keywords correspond to the struct's fields.

Examples

julia
julia> r = VarianceSkewKurtosis()
VarianceSkewKurtosis
  settings ┼ RiskMeasureSettings
           │   scale ┼ Float64: 1.0
           │      ub ┼ nothing
           │     rke ┴ Bool: true
        vr ┼ Variance
           │   settings ┼ RiskMeasureSettings
           │            │   scale ┼ Float64: 1.0
           │            │      ub ┼ nothing
           │            │     rke ┴ Bool: false
           │      sigma ┼ nothing
           │       chol ┼ nothing
           │         rc ┼ nothing
           │        alg ┴ SquaredSOCRiskExpr()
        sk ┼ Skewness
           │   settings ┼ MaxRiskMeasureSettings
           │            │   scale ┼ Float64: 1.0
           │            │      lb ┼ nothing
           │            │     rke ┴ Bool: false
           │         ve ┼ SimpleVariance
           │            │          me ┼ SimpleExpectedReturns
           │            │             │   w ┴ nothing
           │            │           w ┼ nothing
           │            │   corrected ┴ Bool: true
           │         sk ┼ nothing
           │          w ┼ nothing
           │         mu ┴ nothing
        kt ┼ Kurtosis
           │   settings ┼ RiskMeasureSettings
           │            │   scale ┼ Float64: 1.0
           │            │      ub ┼ nothing
           │            │     rke ┴ Bool: false
           │          w ┼ nothing
           │         mu ┼ nothing
           │         kt ┼ nothing
           │          N ┼ nothing
           │       alg1 ┼ Full()
           │       alg2 ┴ SOCRiskExpr()

Functor

julia
(r::VarianceSkewKurtosis)(w::VecNum, X::MatNum, fees = nothing)

Computes the variance skewness kurtosis composite risk measure of the portfolio returns.

Arguments

  • w: Portfolio weights vector assets × 1.

  • X::MatNum: Asset returns matrix (T×N).

  • fees: Optional fee structure.

Related

source
PortfolioOptimisers.factory Method
julia
factory(
    r::VarianceSkewKurtosis,
    pr::AbstractPriorResult,
    args...;
    kwargs...
) -> VarianceSkewKurtosis{RiskMeasureSettings{__T_scale, __T_ub, __T_rke}, Variance{__T_settings, __T_sigma, __T_chol, __T_rc, __T_alg}, Skewness{__T_settings1, __T_ve, __T_sk, __T_w, __T_mu}, Kurtosis{__T_settings2, __T_w1, __T_mu1, __T_kt, __T_N, __T_alg1, __T_alg2}} where {__T_scale, __T_ub, __T_rke, __T_settings, __T_sigma, __T_chol, __T_rc, __T_alg, __T_settings1, __T_ve, __T_sk, __T_w, __T_mu, __T_settings2, __T_w1, __T_mu1, __T_kt, __T_N, __T_alg1, __T_alg2}

Create an instance of VarianceSkewKurtosis by delegating factory to each sub-measure component.

Related

source
PortfolioOptimisers.port_opt_view Method
julia
port_opt_view(
    r::VarianceSkewKurtosis,
    i,
    args...
) -> VarianceSkewKurtosis{RiskMeasureSettings{__T_scale, __T_ub, __T_rke}, Variance{__T_settings, __T_sigma, __T_chol, __T_rc, __T_alg}, Skewness{__T_settings1, __T_ve, __T_sk, __T_w, __T_mu}, Kurtosis{__T_settings2, __T_w1, __T_mu1, __T_kt, __T_N, __T_alg1, __T_alg2}} where {__T_scale, __T_ub, __T_rke, __T_settings, __T_sigma, __T_chol, __T_rc, __T_alg, __T_settings1, __T_ve, __T_sk, __T_w, __T_mu, __T_settings2, __T_w1, __T_mu1, __T_kt, __T_N, __T_alg1, __T_alg2}

Return a view of VarianceSkewKurtosis r sliced to asset indices i by delegating port_opt_view to each sub-measure component.

Related

source
PortfolioOptimisers.supports_precomputed_returns Method
julia
supports_precomputed_returns(r::Skewness) -> Any

Return whether Skewness r supports precomputed-return evaluation.

Delegates to weight_independent_target on r.mu: true iff the target is Nothing, a Number, or a MedianCenteringFunction; false for per-asset targets.

Related

source
PortfolioOptimisers.supports_precomputed_returns Method
julia
supports_precomputed_returns(
    _::VarianceSkewKurtosis
) -> Bool

Return false: VarianceSkewKurtosis carries a weights-only variance term r.vr(w) with no bare-series form.

Related

source