OWA risk measures (a)

Several risk measures are ordered weighted averages. Such a measure sorts the portfolio returns, and weights each return by its rank [199, 207]. The higher L-moments are linear combinations of such averages [208].

The types and functions below build the weight vectors of these measures, and the formulations that optimise them.

PortfolioOptimisers.AbstractOrderedWeightsArrayFunction — Type
abstract type AbstractOrderedWeightsArrayFunction <: AbstractEstimator

Abstract supertype for the callable builders of an OWA weight vector.

A builder holds the parameters of one weight vector, such as a CVaR level, and computes the vector for a sample size when it is called. OrderedWeightsArray and OrderedWeightsArrayRange call it at the number of observations of the sample, so one builder serves a sample of any length.

Interfaces

To implement a new weight builder, subtype AbstractOrderedWeightsArrayFunction. Put every parameter of the weight vector in a field, and implement the following method:

Callable interface

  • (r::MyOWAFunction)(T::Integer) -> VecNum: Computes the OWA weight vector for T observations. A nondecreasing vector gives a convex risk measure, and SortingNetworkOrderedWeightsArray refuses any other vector.

Arguments

  • r: Callable OWA weight function instance.
  • T::Integer: Number of observations.

Returns

  • w::VecNum: OWA weight vector of length T.

Examples

julia> struct MyOWAFunction <: PortfolioOptimisers.AbstractOrderedWeightsArrayFunction endjulia> function (r::MyOWAFunction)(T::Integer)           return fill(inv(T), T)       endjulia> MyOWAFunction()(4)4-element Vector{Float64}: 0.25 0.25 0.25 0.25

Related

References

  • [209] W. Ogryczak and T. Śliwiński. On solving linear programs with the ordered weighted averaging objective. European Journal of Operational Research 148, 80–91 (2003).
  • [199] D. Cajas. OWA portfolio optimization: A disciplined convex programming framework. Available at SSRN 3988927 (2021).
  • [12] D. Cajas. Advanced Portfolio Optimization: A Cutting-edge Quantitative Approach (Springer Nature Switzerland, 2025). Section 7.1.5.
source
PortfolioOptimisers.MaximumEntropy — Type
struct MaximumEntropy{__T_alg} <: AbstractOrderedWeightsArrayAlgorithm

Selects the risk aversion coefficients of maximum entropy in the L-moment programme of OWAJuMP.

The objective is the Shannon entropy of the coefficients $\boldsymbol{\phi}$. The coefficients are a probability vector, so the objective spreads the weight over the L-moments as evenly as the rows let it. The objective is strictly concave, so the programme has one maximiser, and the OWA weights $\mathbf{W} \boldsymbol{\phi}$ are unique.

alg selects the conic encoding of the entropy, not the problem. RelativeEntropy writes one JuMP.MOI.RelativeEntropyCone of dimension 2K - 1, and ExponentialConeEntropy writes K - 1 JuMP.MOI.ExponentialCone rows.

Warning

Keep the objective scale so of OWAJuMP near 1e-3 for this objective. The default so = nothing gives 1e-3 through owa_objective_scale. A stated so = 1 makes the solver stop short of optimal, and owa_l_moment_crm then warns and returns the fallback weights. The steps of $\boldsymbol{\theta}$ are of order $1/T^{2}$, the entropy is of order one, and the maximiser touches the rows $\theta_{t+1} \geq \theta_{t}$ tangentially. With max_phi = 0.75, $T$ from 30 to 5000 and the highest order from 4 to 10, Clarabel solved 8 of 39 programmes at so = 1 and all 39 at so = 1e-3. On a grid of 20 of these programmes, so = 1e-2 solved 17 or 18, by encoding, and so = 1e-5 solved 19. The scale does not change the maximiser.

Equation 13 of [208] maximises $\sum_{t} \ln \psi_{t}$ over a vector $\boldsymbol{\psi}$ subject to $\psi_{t} \geq \lvert \theta_{t} \rvert$ alone, and that objective has no maximum. Its intent, the entropy of the absolute OWA weights, does not select one vector either, and it is not a convex programme in the normalised form. The L-moment weight vector of order $k$ has entries of absolute value at most $1/T$ once $T > k (k - 1) / 2$, measured for every order up to 10 and every $T$ up to 600. So every feasible $\boldsymbol{\theta}$ has $\lvert \theta_{t} \rvert \leq 1/T$, and the uniform $\psi_{t} = 1/T$ bounds it. A probability vector $\boldsymbol{\psi}$ that bounds $\lvert \boldsymbol{\theta} \rvert$ from above then has the largest entropy $\log T$ at every feasible point. The library puts the entropy on the coefficients for this reason.

Mathematical definition

\[\begin{align} \underset{\boldsymbol{\phi},\, \boldsymbol{\theta}}{\max} \quad & -\sum\limits_{k=2}^{K} \phi_{k} \log \phi_{k}\\ \text{s.t.} \quad & \boldsymbol{\theta} = \mathbf{W} \boldsymbol{\phi}\\ & \sum\limits_{k=2}^{K} \phi_{k} = 1\\ & 0 \leq \phi_{k} \leq \phi_{\max} \quad \forall k = 2,\, \ldots,\, K\\ & \phi_{k+1} \leq \phi_{k} \quad \forall k = 2,\, \ldots,\, K - 1\\ & \theta_{t+1} \geq \theta_{t} \quad \forall t = 1,\, \ldots,\, T - 1\,. \end{align}\]

Where:

  • $\boldsymbol{\theta}$: Solved OWA weight vector $T \times 1$, the model variable theta.
  • $\mathbf{W}$: Signed L-moment weight matrix $T \times (K - 1)$. Its column $k - 1$ is $(-1)^{k} \boldsymbol{\omega}^{k}$ for $k = 2, \ldots, K$.
  • $\omega_{i}^{k}$: L-moment weight of the $i$-th smallest observation in the $k$-th sample L-moment, the $i$-th entry of owa_l_moment(T, k).
  • $\phi_{k}$: Risk aversion coefficient of the $k$-th L-moment, for $k = 2, \ldots, K$.
  • $\phi_{\max}$: Ceiling on each risk aversion coefficient, the max_phi field of OWAJuMP.
  • $K$: Highest L-moment order, the k of owa_l_moment_crm.
  • $T$: Number of observations.

Fields

  • alg: Risk measure optimisation formulation algorithm.

Constructors

MaximumEntropy(;    alg::EntropyFormulation = RelativeEntropy(),) -> MaximumEntropy

Keywords correspond to the struct's fields.

Examples

julia> MaximumEntropy()MaximumEntropy  alg ┴ RelativeEntropy()

Related

References

  • [208] D. Cajas. Higher order moment portfolio optimization with L-moments. Available at SSRN 4393155 (2023). Section 3.2, Equation 13.
source
PortfolioOptimisers.MinimumSquaredDistance — Type
struct MinimumSquaredDistance{__T_alg} <: SquaredOrderedWeightsArrayAlgorithm{__T_alg}

Selects the smoothest OWA weights in the L-moment programme of OWAJuMP.

The objective is the sum of the squared differences of adjacent OWA weights, so the weights change little from one order statistic to the next. Use MinimumSumSquares to keep the weights small instead.

alg selects the conic encoding of the objective, not the problem. SOCRiskExpr minimises $\lVert \boldsymbol{\theta}_{2:T} - \boldsymbol{\theta}_{1:T-1} \rVert_{2}$, and SquaredSOCRiskExpr and RSOCRiskExpr minimise its square. The square root is strictly increasing, so the three encodings give one minimiser and return the same OWA weights to solver tolerance. In SecondMomentFormulation, alg changes the units of the reported risk instead.

Equation 15 of [208] prints a maximum of this sum. The library minimises it, which is the convex problem that the name of the type states.

Mathematical definition

\[\begin{align} \underset{\boldsymbol{\phi},\, \boldsymbol{\theta}}{\min} \quad & \sum\limits_{t=1}^{T-1} \left(\theta_{t+1} - \theta_{t}\right)^{2}\\ \text{s.t.} \quad & \boldsymbol{\theta} = \mathbf{W} \boldsymbol{\phi}\\ & \sum\limits_{k=2}^{K} \phi_{k} = 1\\ & 0 \leq \phi_{k} \leq \phi_{\max} \quad \forall k = 2,\, \ldots,\, K\\ & \phi_{k+1} \leq \phi_{k} \quad \forall k = 2,\, \ldots,\, K - 1\\ & \theta_{t+1} \geq \theta_{t} \quad \forall t = 1,\, \ldots,\, T - 1\,. \end{align}\]

Where:

  • $\boldsymbol{\theta}$: Solved OWA weight vector $T \times 1$, the model variable theta.
  • $\mathbf{W}$: Signed L-moment weight matrix $T \times (K - 1)$. Its column $k - 1$ is $(-1)^{k} \boldsymbol{\omega}^{k}$ for $k = 2, \ldots, K$.
  • $\omega_{i}^{k}$: L-moment weight of the $i$-th smallest observation in the $k$-th sample L-moment, the $i$-th entry of owa_l_moment(T, k).
  • $\phi_{k}$: Risk aversion coefficient of the $k$-th L-moment, for $k = 2, \ldots, K$.
  • $\phi_{\max}$: Ceiling on each risk aversion coefficient, the max_phi field of OWAJuMP.
  • $K$: Highest L-moment order, the k of owa_l_moment_crm.
  • $T$: Number of observations.

Fields

  • alg: Risk measure optimisation formulation algorithm.

Constructors

MinimumSquaredDistance(;    alg::UnionAllSOCRiskExpr = SOCRiskExpr(),) -> MinimumSquaredDistance

Keywords correspond to the struct's fields.

Examples

julia> MinimumSquaredDistance()MinimumSquaredDistance  alg ┴ SOCRiskExpr()

Related

References

  • [208] D. Cajas. Higher order moment portfolio optimization with L-moments. Available at SSRN 4393155 (2023). Section 3.2, Equation 15.
source
PortfolioOptimisers.MinimumSumSquares — Type
struct MinimumSumSquares{__T_alg} <: SquaredOrderedWeightsArrayAlgorithm{__T_alg}

Selects the OWA weights of least sum of squares in the L-moment programme of OWAJuMP.

The objective is a ridge penalty on the OWA weights, so the solution spreads the weight mass over the order statistics and does not concentrate it. Use MinimumSquaredDistance to make the weights change smoothly instead.

alg selects the conic encoding of the objective, not the problem. SOCRiskExpr minimises $\lVert \boldsymbol{\theta} \rVert_{2}$, and SquaredSOCRiskExpr and RSOCRiskExpr minimise its square. The square root is strictly increasing, so the three encodings give one minimiser and return the same OWA weights to solver tolerance. In SecondMomentFormulation, alg changes the units of the reported risk instead.

Mathematical definition

\[\begin{align} \underset{\boldsymbol{\phi},\, \boldsymbol{\theta}}{\min} \quad & \sum\limits_{t=1}^{T} \theta_{t}^{2}\\ \text{s.t.} \quad & \boldsymbol{\theta} = \mathbf{W} \boldsymbol{\phi}\\ & \sum\limits_{k=2}^{K} \phi_{k} = 1\\ & 0 \leq \phi_{k} \leq \phi_{\max} \quad \forall k = 2,\, \ldots,\, K\\ & \phi_{k+1} \leq \phi_{k} \quad \forall k = 2,\, \ldots,\, K - 1\\ & \theta_{t+1} \geq \theta_{t} \quad \forall t = 1,\, \ldots,\, T - 1\,. \end{align}\]

Where:

  • $\boldsymbol{\theta}$: Solved OWA weight vector $T \times 1$, the model variable theta.
  • $\mathbf{W}$: Signed L-moment weight matrix $T \times (K - 1)$. Its column $k - 1$ is $(-1)^{k} \boldsymbol{\omega}^{k}$ for $k = 2, \ldots, K$.
  • $\omega_{i}^{k}$: L-moment weight of the $i$-th smallest observation in the $k$-th sample L-moment, the $i$-th entry of owa_l_moment(T, k).
  • $\phi_{k}$: Risk aversion coefficient of the $k$-th L-moment, for $k = 2, \ldots, K$.
  • $\phi_{\max}$: Ceiling on each risk aversion coefficient, the max_phi field of OWAJuMP.
  • $K$: Highest L-moment order, the k of owa_l_moment_crm.
  • $T$: Number of observations.

Fields

  • alg: Risk measure optimisation formulation algorithm.

Constructors

MinimumSumSquares(;    alg::UnionAllSOCRiskExpr = SOCRiskExpr(),) -> MinimumSumSquares

Keywords correspond to the struct's fields.

Examples

julia> MinimumSumSquares()MinimumSumSquares  alg ┴ SOCRiskExpr()

Related

References

  • [208] D. Cajas. Higher order moment portfolio optimization with L-moments. Available at SSRN 4393155 (2023). Section 3.2, Equation 14.
source
PortfolioOptimisers.NormalisedConstantRelativeRiskAversion — Type
struct NormalisedConstantRelativeRiskAversion{__T_g} <: AbstractOrderedWeightsArrayEstimator

Sets the risk aversion coefficients of an L-moment OWA weight vector to the normalised constant relative risk aversion coefficients of g.

Equation 12 of [208] states the coefficients. The library divides them by their sum, which that equation suggests. It also replaces each OWA weight by the largest weight up to its position, so the vector is nondecreasing and the risk measure is convex. ncrra_weights computes the vector, and OWAJuMP falls back to it with g = 0.5 when its programme fails.

Mathematical definition

\[\begin{align} \tilde{\phi}_{k} &= \dfrac{1}{k!} \prod\limits_{j=0}^{k-2} \left(\gamma + j\right) \quad \forall k = 2,\, \ldots,\, K\\ \phi_{k} &= \dfrac{\tilde{\phi}_{k}}{\sum_{j=2}^{K} \tilde{\phi}_{j}}\\ \boldsymbol{\vartheta} &= \mathbf{W} \boldsymbol{\phi}\\ \eta_{t} &= \max\limits_{s \leq t} \vartheta_{s} \quad \forall t = 1,\, \ldots,\, T\,. \end{align}\]

Where:

  • $\gamma$: Relative risk aversion g of the normalised constant relative risk aversion coefficients, $\gamma \in (0, 1)$.
  • $\tilde{\phi}_{k}$: Coefficient of the $k$-th L-moment before the normalisation.
  • $\phi_{k}$: Risk aversion coefficient of the $k$-th L-moment, for $k = 2, \ldots, K$.
  • $\mathbf{W}$: Signed L-moment weight matrix $T \times (K - 1)$. Its column $k - 1$ is $(-1)^{k} \boldsymbol{\omega}^{k}$ for $k = 2, \ldots, K$.
  • $\omega_{i}^{k}$: L-moment weight of the $i$-th smallest observation in the $k$-th sample L-moment, the $i$-th entry of owa_l_moment(T, k).
  • $\boldsymbol{\vartheta}$: Combination of the signed L-moment weights, $T \times 1$. It need not be nondecreasing.
  • $\boldsymbol{\eta}$: OWA weight vector $T \times 1$. Its $t$-th entry $\eta_{t}$ multiplies the $t$-th smallest return.
  • $K$: Highest L-moment order, the k of owa_l_moment_crm.
  • $T$: Number of observations.

The coefficients sum to one, and the OWA weights do not. Each L-moment weight vector of order two or more sums to zero, so $\boldsymbol{\vartheta}$ sums to zero, and the running maximum can only raise that sum.

Fields

  • g: Risk aversion parameter.

Constructors

NormalisedConstantRelativeRiskAversion(;    g::Number = 0.5,) -> NormalisedConstantRelativeRiskAversion

Keywords correspond to the struct's fields.

Validation

  • 0 < g < 1.

Examples

julia> NormalisedConstantRelativeRiskAversion()NormalisedConstantRelativeRiskAversion  g ┴ Float64: 0.5

Related

References

  • [208] D. Cajas. Higher order moment portfolio optimization with L-moments. Available at SSRN 4393155 (2023). Section 3.2, Equation 12.
source
PortfolioOptimisers.LinearMoment — Type
struct LinearMoment{__T_method, __T_k} <: AbstractOrderedWeightsArrayFunction

Builds the OWA weight vector of the L-moment convex risk measure of the orders 2 to k.

Called as lm(T), it returns owa_l_moment_crm(T, method; k), whose docstring states the measure. method finds the risk aversion coefficients of the L-moments.

Fields

  • method: OWA weight estimation method.
  • k: L-moment order.

Constructors

LinearMoment(;    method::AbstractOrderedWeightsArrayEstimator = NormalisedConstantRelativeRiskAversion(),    k::Integer = 2) -> LinearMoment

Keywords correspond to the struct's fields.

Validation

  • k >= 2.

Examples

julia> LinearMoment()LinearMoment  method ┼ NormalisedConstantRelativeRiskAversion         │   g ┴ Float64: 0.5       k ┴ Int64: 2

Related

References

  • [208] D. Cajas. Higher order moment portfolio optimization with L-moments. Available at SSRN 4393155 (2023).
  • [12] D. Cajas. Advanced Portfolio Optimization: A Cutting-edge Quantitative Approach (Springer Nature Switzerland, 2025). Section 3.1.5.
source
PortfolioOptimisers.OrderedWeightsArrayConditionalValueatRisk — Type
struct OrderedWeightsArrayConditionalValueatRisk{__T_alpha} <: AbstractOrderedWeightsArrayFunction

Builds the OWA weight vector of the conditional value at risk at level alpha.

Called as r(T), it returns owa_cvar(T, alpha), whose docstring states the closed form. A Calibration Rule in alpha resolves against the prior before the call.

Fields

Constructors

OrderedWeightsArrayConditionalValueatRisk(;    alpha::Num_SigCal = 0.05) -> OrderedWeightsArrayConditionalValueatRisk

Keywords correspond to the struct's fields.

Validation

  • 0 < alpha < 1.

Examples

julia> OrderedWeightsArrayConditionalValueatRisk()OrderedWeightsArrayConditionalValueatRisk  alpha ┴ Float64: 0.05

Related

References

  • [202] R. T. Rockafellar and S. Uryasev. Optimization of conditional value-at-risk. Journal of Risk 2, 21–41 (2000).
  • [199] D. Cajas. OWA portfolio optimization: A disciplined convex programming framework. Available at SSRN 3988927 (2021).
  • [12] D. Cajas. Advanced Portfolio Optimization: A Cutting-edge Quantitative Approach (Springer Nature Switzerland, 2025). Section 7.2.2.4.
source
PortfolioOptimisers.OrderedWeightsArrayTailGini — Type
struct OrderedWeightsArrayTailGini{__T_alpha_i, __T_alpha, __T_a_sim} <: AbstractOrderedWeightsArrayFunction

Builds the OWA weight vector of the tail Gini at level alpha.

Called as r(T), it returns owa_tg(T; alpha_i, alpha, a_sim), whose docstring states the quadrature over the conditional values at risk. A Calibration Rule in alpha resolves against the prior before the call.

Fields

  • alpha_i: Lower integration bound for the tail Gini approximation.
  • a_sim: Number of integration points for the tail Gini approximation.

Constructors

OrderedWeightsArrayTailGini(;    alpha_i::Number = 1e-4,    alpha::Num_SigCal = 0.05,    a_sim::Integer = 100) -> OrderedWeightsArrayTailGini

Keywords correspond to the struct's fields.

Validation

  • 0 < alpha_i < alpha < 1, checked when alpha is a number. When alpha holds a Calibration Rule only 0 < alpha_i < 1 is checked here, and the joint bound is checked when the rebuild runs at fold time. A rule that returns a value at or below the stated alpha_i is refused there, and this joint bound is the whole of the ordering validation.
  • a_sim >= 2. The quadrature grid needs its two ends.

Examples

julia> OrderedWeightsArrayTailGini()OrderedWeightsArrayTailGini  alpha_i ┼ Float64: 0.0001    alpha ┼ Float64: 0.05    a_sim ┴ Int64: 100

Related

References

  • [210] W. Ogryczak and A. Ruszczyński. Dual stochastic dominance and quantile risk measures. International Transactions in Operational Research 9, 661–680 (2002).
  • [199] D. Cajas. OWA portfolio optimization: A disciplined convex programming framework. Available at SSRN 3988927 (2021).
  • [207] D. Cajas. Efficient Gini Mean Difference and Tail Gini Portfolio Optimization based on P-Norms. Available at SSRN 4711326 (2024).
  • [12] D. Cajas. Advanced Portfolio Optimization: A Cutting-edge Quantitative Approach (Springer Nature Switzerland, 2025). Section 7.2.2.5.
source
PortfolioOptimisers.ExactOrderedWeightsArray — Type
struct ExactOrderedWeightsArray <: OrderedWeightsArrayFormulation

Encodes the exact OWA risk with the linear programme that sorts the sample.

The programme is the dual of the assignment problem that pairs each weight with an order statistic. So it sorts the sample inside the model, and the sort costs T^2 rows. It adds two vector variables a and b of length T and the T × T block of rows $y_{i} w_{j} \leq a_{j} + b_{i}$, and the risk is $\sum_{t} (a_{t} + b_{t})$. The method of set_risk_constraints! for this formulation states the model. For a long sample, SortingNetworkOrderedWeightsArray gives the same exact risk at $O(T \log^{2} T)$ rows, and ApproxOrderedWeightsArray gives an upper bound at a lower cost.

The programme pairs the largest weight with the largest sorted return, so it attains $\mathrm{sort}(\boldsymbol{\omega})^{\intercal} \mathrm{sort}(\hat{\boldsymbol{r}})$. This is the OWA risk when, and only when, the weight vector is nondecreasing, which is also the condition for the risk measure to be convex. Every weight builder in this package returns such a vector. The programme sorts a weight vector that is out of order, so the model and the functor then disagree.

Related

References

  • [209] W. Ogryczak and T. Śliwiński. On solving linear programs with the ordered weighted averaging objective. European Journal of Operational Research 148, 80–91 (2003).
  • [199] D. Cajas. OWA portfolio optimization: A disciplined convex programming framework. Available at SSRN 3988927 (2021).
  • [12] D. Cajas. Advanced Portfolio Optimization: A Cutting-edge Quantitative Approach (Springer Nature Switzerland, 2025). Section 7.1.5.
source
PortfolioOptimisers.ApproxOrderedWeightsArray — Type
struct ApproxOrderedWeightsArray{__T_p} <: OrderedWeightsArrayFormulation

Encodes an upper bound on the OWA risk with one power cone block for each p-norm order in p.

It relaxes the dual representation of the OWA risk, and does not sort. It replaces the T × T block of ExactOrderedWeightsArray by one p-norm row for each entry of p. It keeps only the properties of the weight vector that a reordering leaves unchanged: the minimum, the maximum, the sum, and one p-norm for each entry of p. Every reordering of the weight vector meets those properties, so the model risk lies at or above the exact OWA risk of the same portfolio. The method of set_risk_constraints! for this formulation states the model and its ## Relaxation.

The bound is exact when at most one entry of the weight vector lies strictly between its minimum and its maximum, as the vectors of owa_wr and of owa_cvar at every $\alpha$ do. The box and the sum then describe the convex hull of the reorderings, so the model omits the p-norm cones and is a linear programme. There the cones are redundant, and they put the optimum at the apex of every cone, where an interior point solver can stall. For other vectors the gap closes as the weight vector approaches a line. Cajas [207] studies the linear case. For the Gini mean difference and the tail Gini over samples of 500 to 10,000 observations, [207] reports the same objective value as the exact formulation, to the printed precision. Measured against the functor at T = 100, N = 8 with the default p, the Gini mean difference is 0.06 % high, the tail Gini is 1.7e-5 % high, and the tail Gini range is 0.37 % high. A fourth-order L-moment weight vector, which is not linear, is 4.5 % high. This formulation is the fastest of the three. For a weight vector that is far from a line, prefer an exact formulation: SortingNetworkOrderedWeightsArray for a long sample, and ExactOrderedWeightsArray for a short one.

Fields

  • p: Vector of p-norm orders used to approximate the ordered weights array risk.

Constructors

ApproxOrderedWeightsArray(;    p::VecNum = Float64[2, 3, 4, 10, 50]) -> ApproxOrderedWeightsArray

Keywords correspond to the struct's fields.

Validation

  • !isempty(p) and all(x -> x > 1, p).

Examples

julia> ApproxOrderedWeightsArray()ApproxOrderedWeightsArray  p ┴ Vector{Float64}: [2.0, 3.0, 4.0, 10.0, 50.0]

Related

References

  • [207] D. Cajas. Efficient Gini Mean Difference and Tail Gini Portfolio Optimization based on P-Norms. Available at SSRN 4711326 (2024). Sections 2.3 and 2.4, Equations 4 and 5.
  • [199] D. Cajas. OWA portfolio optimization: A disciplined convex programming framework. Available at SSRN 3988927 (2021).
  • [12] D. Cajas. Advanced Portfolio Optimization: A Cutting-edge Quantitative Approach (Springer Nature Switzerland, 2025). Section 7.1.5.
source
PortfolioOptimisers.OrderedWeightsArray — Type
struct OrderedWeightsArray{__T_settings, __T_w, __T_alg} <: RiskMeasure

Measures risk as a weighted sum of the sorted portfolio returns, the ordered weights array (OWA) risk.

w holds the OWA weights, as a vector, a function of the sample size or a weight builder. The weight builders of this library give the Gini mean difference, the conditional value at risk, the tail Gini, the worst realisation and the L-moment convex risk measure. A nondecreasing weight vector gives a convex risk measure. alg selects the JuMP encoding, and the functor does not read it.

Mathematical definition

\[\begin{align} \mathrm{OWA}_{\boldsymbol{w}}(\boldsymbol{x}) &= \sum_{t=1}^{T} w_{t} x_{(t)}\,. \end{align}\]

Where:

  • $\mathrm{OWA}_{\boldsymbol{w}}(\boldsymbol{x})$: Ordered weights array risk.
  • $\boldsymbol{x}$: Portfolio returns vector $T \times 1$.
  • $T$: Number of observations.
  • $\boldsymbol{w}$: OWA weight vector $T \times 1$, the field w or its value at $T$.
  • $x_{(t)}$: $t$-th smallest entry of $\boldsymbol{x}$, so $x_{(1)} \leq \dots \leq x_{(T)}$.

Fields

  • settings: Risk measure settings.
  • w: Optional OWA weight vector.
  • alg: Risk measure optimisation formulation algorithm.

Constructors

OrderedWeightsArray(;    settings::RiskMeasureSettings = RiskMeasureSettings(),    w::OWA_Func_VecNum = owa_gmd,    alg::OrderedWeightsArrayFormulation = ApproxOrderedWeightsArray()) -> OrderedWeightsArray

Keywords correspond to the struct's fields.

Validation

  • If w is a VecNum: !isempty(w). Raises an IsEmptyError.
  • If w is a VecNum and alg is a SortingNetworkOrderedWeightsArray: issorted(w). Raises a DomainError. A callable w is checked when the model is built.

Functor

(r::OrderedWeightsArray)(x::VecNum)

Computes the OWA risk of a portfolio returns vector x. A w that is a callable is evaluated at length(x) first, so the weight vector always matches the sample.

Arguments

  • x::VecNum: Portfolio returns vector.

Examples

julia> OrderedWeightsArray()OrderedWeightsArray  settings ┼ RiskMeasureSettings           │   scale ┼ Float64: 1.0           │      ub ┼ nothing           │     rke ┴ Bool: true         w ┼ typeof(owa_gmd): PortfolioOptimisers.owa_gmd       alg ┼ ApproxOrderedWeightsArray           │   p ┴ Vector{Float64}: [2.0, 3.0, 4.0, 10.0, 50.0]

Related

References

  • [209] W. Ogryczak and T. Śliwiński. On solving linear programs with the ordered weighted averaging objective. European Journal of Operational Research 148, 80–91 (2003).
  • [199] D. Cajas. OWA portfolio optimization: A disciplined convex programming framework. Available at SSRN 3988927 (2021).
  • [12] D. Cajas. Advanced Portfolio Optimization: A Cutting-edge Quantitative Approach (Springer Nature Switzerland, 2025). Section 7.1.5.
source
PortfolioOptimisers.OWAJuMP — Type
struct OWAJuMP{__T_slv, __T_max_phi, __T_sc, __T_so, __T_alg} <: AbstractOrderedWeightsArrayEstimator

Solves a programme for the risk aversion coefficients of an L-moment OWA weight vector.

alg selects the objective, and every objective solves over the same feasible set. owa_l_moment_crm states the programme. sc scales the rows and so scales the objective, and neither changes the solution. A stated scale wins. When a scale is nothing, the objective gives it through owa_constraint_scale and owa_objective_scale. So the default so is 1e-3 under MaximumEntropy, which needs a small so to solve, as its docstring states, and 1.0 under the other objectives.

When the solver fails, owa_model_solve warns and returns the weights of NormalisedConstantRelativeRiskAversion(; g = 0.5). The programme is infeasible for some max_phi and some orders: the coefficients sum to one and each is at most max_phi, and the OWA weights must be nondecreasing. At k = 2 it is always infeasible, because its one coefficient must equal one. The fallback then returns the weights of the second L-moment, which is the only answer whose coefficients sum to one. At k = 3 with the default max_phi = 0.5, the rows leave the one choice $\boldsymbol{\phi} = (0.5, 0.5)$, and its OWA weights decrease near the largest return, so the programme is infeasible too.

Fields

  • slv: Solver or vector of solvers.
  • max_phi: Maximum allowed value for any OWA weight.
  • sc: Constraint scale factor.
  • so: Objective scale factor.
  • alg: Risk measure optimisation formulation algorithm.

Constructors

OWAJuMP(;    slv::Slv_VecSlv,    max_phi::Number = 0.5,    sc::Option{<:Number} = nothing,    so::Option{<:Number} = nothing,    alg::AbstractOrderedWeightsArrayAlgorithm = MaximumEntropy(),) -> OWAJuMP

Keyword arguments correspond to the struct's fields.

Validation

  • !isempty(slv).
  • 0 < max_phi < 1.
  • If sc is not nothing, isfinite(sc) and sc > 0.
  • If so is not nothing, isfinite(so) and so > 0.

Examples

julia> OWAJuMP(; slv = Solver(; solver = nothing))OWAJuMP      slv ┼ Solver          │          name ┼ String: ""          │        solver ┼ nothing          │      settings ┼ nothing          │     check_sol ┼ @NamedTuple{}: NamedTuple()          │   add_bridges ┴ Bool: true  max_phi ┼ Float64: 0.5       sc ┼ nothing       so ┼ nothing      alg ┼ MaximumEntropy          │   alg ┴ RelativeEntropy()

Related

References

  • [208] D. Cajas. Higher order moment portfolio optimization with L-moments. Available at SSRN 4393155 (2023). Section 3.2, Equations 13 to 15.
source
PortfolioOptimisers.owa_l_moment_crm — Function
owa_l_moment_crm(method::AbstractOrderedWeightsArrayEstimator, weights::MatNum)

Combine the columns of a signed L-moment weight matrix into one OWA weight vector, with the risk aversion coefficients that method finds.

NormalisedConstantRelativeRiskAversion states the coefficients in closed form, through ncrra_weights. OWAJuMP builds the feasible set with owa_model_setup, adds the rows and the objective of its alg, and solves the model with owa_model_solve. The docstrings of MaximumEntropy, MinimumSquaredDistance and MinimumSumSquares state the three programmes.

Algorithm

For an OWAJuMP method:

  1. Build model, the feasible set, with owa_model_setup.
  2. Add the variables and the rows of the objective of method.alg, as # JuMP formulation states. Under MaximumEntropy, owa_l_moment_crm_entropy adds them.
  3. Set the objective, with owa_l_moment_crm_entropy for MaximumEntropy and with owa_l_moment_crm_sumsq_obj otherwise.
  4. Solve model and return its OWA weights, with owa_model_solve.

JuMP formulation

Variables

Constraints

Every row is registered under no name. Under MaximumEntropy the method adds no row, and owa_l_moment_crm_entropy adds the cone rows of the entropy.

Where:

  • $s_c$: Constraint scale. It multiplies both sides of a row, so a positive value leaves the feasible set unchanged. owa_constraint_scale gives it from the sc field of method.
  • $\boldsymbol{\theta}$: Solved OWA weight vector $T \times 1$, the model variable theta.
  • $\boldsymbol{d}$: Differences of adjacent OWA weights, $d_{t} = \theta_{t+1} - \theta_{t}$ for $t = 1, \ldots, T - 1$.
  • $\mathcal{K}_{q} = \{(t, \boldsymbol{x}) : t \geq \lVert \boldsymbol{x} \rVert_{q}\}$: Norm cone of order $q$. $\mathcal{K}_{2}$ is the second-order cone.
  • $\mathcal{Q}_{r} = \{(u, v, \boldsymbol{z}) : 2 u v \geq \lVert \boldsymbol{z} \rVert_{2}^{2},\, u, v \geq 0\}$: Rotated second-order cone.
  • $T$: Number of observations.

Arguments

  • method: Estimator of the risk aversion coefficients.
  • weights: Signed L-moment weight matrix $T \times (K - 1)$. Column k - 1 holds the weights of the L-moment of order k, times $(-1)^{k}$.

Returns

  • w::VecNum: Vector of OWA weights of length size(weights, 1).

Related

References

  • [208] D. Cajas. Higher order moment portfolio optimization with L-moments. Available at SSRN 4393155 (2023). Section 3.2, Equations 11 to 15.
source
owa_l_moment_crm(T::Integer,
                 method::AbstractOrderedWeightsArrayEstimator = NormalisedConstantRelativeRiskAversion();
                 k::Integer = 2)

Compute the OWA weight vector of the L-moment convex risk measure of the orders 2 to k.

The risk measure is a signed combination of the L-moments of the portfolio returns, with the risk aversion coefficients that method finds. The coefficients sum to one, and the OWA weights do not, because each L-moment weight vector of order two or more sums to zero.

Each signed L-moment weight vector starts at $-1/T$, so the first OWA weight is $-1/T$ at every order and for every method. A higher k moves the other entries. Under the default method on 60 observations, the largest move is $0.61/T$ from k = 2 to k = 3, and $0.053/T$ from k = 7 to k = 8.

Mathematical definition

\[\begin{align} \rho(\boldsymbol{w}) &= \sum\limits_{k=2}^{K} \left(-1\right)^{k} \phi_{k} \lambda_{k}\left(\hat{\boldsymbol{r}}\right)\\ &= \sum\limits_{i=1}^{T} \eta_{i} \hat{r}_{[i]}\\ \eta_{i} &= \sum\limits_{k=2}^{K} \left(-1\right)^{k} \phi_{k} \omega_{i}^{k}\,. \end{align}\]

Where:

  • $\rho(\boldsymbol{w})$: L-moment convex risk measure of the portfolio.
  • $\lambda_{k}(\hat{\boldsymbol{r}})$: The $k$-th sample L-moment of the net portfolio returns.
  • $\hat{\boldsymbol{r}}$: The net portfolio returns, $T \times 1$, with entries $\hat{r}_t$. $\hat{r}_{[i]}$ is its $i$-th smallest entry.
  • $\phi_{k}$: Risk aversion coefficient of the $k$-th L-moment, for $k = 2, \ldots, K$.
  • $\omega_{i}^{k}$: L-moment weight of the $i$-th smallest observation in the $k$-th sample L-moment, the $i$-th entry of owa_l_moment(T, k).
  • $\boldsymbol{\eta}$: OWA weight vector $T \times 1$. Its $t$-th entry $\eta_{t}$ multiplies the $t$-th smallest return.
  • $K$: Highest L-moment order, the k of owa_l_moment_crm.
  • $T$: Number of observations.

Algorithm

  1. Check that k >= 2.
  2. Build weights, the signed L-moment weight matrix $T \times (k - 1)$. Its column i - 1 is $(-1)^{i}$ times owa_l_moment(T, i), for i from 2 to k.
  3. Return owa_l_moment_crm(method, weights), which finds the coefficients and combines the columns.

Arguments

  • T: Number of observations.
  • method: Estimator of the risk aversion coefficients.
  • k: Highest L-moment order.

Validation

  • k >= 2. Raises a DomainError.
  • k <= T, through owa_l_moment. Raises a DomainError.

Returns

  • w::VecNum: Vector of OWA weights of length T.

Related

References

  • [208] D. Cajas. Higher order moment portfolio optimization with L-moments. Available at SSRN 4393155 (2023). Equation 11, Section 3.2.
  • [12] D. Cajas. Advanced Portfolio Optimization: A Cutting-edge Quantitative Approach (Springer Nature Switzerland, 2025). Section 3.1.5.
source
PortfolioOptimisers.owa_l_moment — Function
owa_l_moment(T::Integer, k::Integer = 2)

Compute the OWA weight vector of the sample L-moment of order k.

The k-th sample L-moment is a weighted sum of the order statistics of the sample, so it is an OWA operator, and this function returns its weights. For k >= 2 the weights sum to zero, and for k = 1 they are $1/T$, the weights of the mean.

The binomial coefficients that hold $T$ are computed in the element type of the weights, because $\binom{T}{k}$ exceeds the largest Int at T = 1000 and k = 8. On a Float64 vector the weights agree with exact rational arithmetic to a relative error below 1e-14 up to k = 10.

Mathematical definition

\[\begin{align} \omega_{i}^{k} &= \dfrac{1}{k} \binom{T}{k}^{-1} \sum\limits_{j=0}^{k-1} \left(-1\right)^{j} \binom{k-1}{j} \binom{i-1}{k-1-j} \binom{T-i}{j}\\ \lambda_{k} &= \sum\limits_{i=1}^{T} \omega_{i}^{k} y_{[i]}\,. \end{align}\]

Where:

  • $\omega_{i}^{k}$: L-moment weight of the $i$-th smallest observation in the $k$-th sample L-moment, the $i$-th entry of owa_l_moment(T, k).
  • $\lambda_{k}$: The $k$-th sample L-moment.
  • $y_{[i]}$: The $i$-th order statistic of the sample, in ascending order.
  • $T$: Number of observations.
  • $k$: The order of the L-moment.

Arguments

  • T: Number of observations.
  • k: Order of the L-moment.

Validation

  • 1 <= k <= T. Raises a DomainError.

Returns

  • w::VecNum: Vector of OWA weights of length T. For k >= 2 it sums to zero. Its first entry is $(-1)^{k-1}/T$ and its last entry is $1/T$.

Related

References

  • [208] D. Cajas. Higher order moment portfolio optimization with L-moments. Available at SSRN 4393155 (2023). Equation 3.
  • [12] D. Cajas. Advanced Portfolio Optimization: A Cutting-edge Quantitative Approach (Springer Nature Switzerland, 2025). Section 3.1.5.
source
PortfolioOptimisers.owa_gmd — Function
owa_gmd(T::Integer)

Compute the OWA weight vector of the Gini mean difference.

The weights rise linearly with the rank and sum to zero, so the risk is a dispersion and does not depend on the mean of the returns. Yitzhaki [211] states the Gini mean difference, and Section 2.1 of [207] states its OWA weights.

Mathematical definition

\[\begin{align} \eta_{t} &= \dfrac{2 \left(2 t - 1 - T\right)}{T \left(T - 1\right)} \quad \forall t = 1,\, \ldots,\, T\\ \sum\limits_{t=1}^{T} \eta_{t} x_{(t)} &= \dfrac{1}{T \left(T - 1\right)} \sum\limits_{i=1}^{T} \sum\limits_{j=1}^{T} \left\lvert x_{i} - x_{j} \right\rvert\,. \end{align}\]

Where:

  • $\boldsymbol{\eta}$: OWA weight vector $T \times 1$. Its $t$-th entry $\eta_{t}$ multiplies the $t$-th smallest return.
  • $x_{(t)}$: $t$-th smallest entry of $\boldsymbol{x}$, so $x_{(1)} \leq \dots \leq x_{(T)}$.
  • $\boldsymbol{x}$: Portfolio returns vector $T \times 1$.
  • $T$: Number of observations.

Arguments

  • T: Number of observations, T >= 2.

Validation

  • T >= 2. Raises a DomainError. The mean difference averages over the pairs of distinct observations, and one observation has none.

Returns

  • w::VecNum: Vector of OWA weights of length T. It is a lazy range, and its entries sum to zero.

Related

References

  • [211] S. Yitzhaki. Stochastic dominance, mean variance, and Gini's mean difference. The American Economic Review 72, 178–185 (1982).
  • [199] D. Cajas. OWA portfolio optimization: A disciplined convex programming framework. Available at SSRN 3988927 (2021).
  • [207] D. Cajas. Efficient Gini Mean Difference and Tail Gini Portfolio Optimization based on P-Norms. Available at SSRN 4711326 (2024).
  • [12] D. Cajas. Advanced Portfolio Optimization: A Cutting-edge Quantitative Approach (Springer Nature Switzerland, 2025). Section 7.2.1.2.
source
PortfolioOptimisers.owa_cvar — Function
owa_cvar(T::Integer, alpha::Number = 0.05)

Compute the OWA weight vector of the conditional value at risk.

The weights put the mass $-1$ on the $\alpha T$ smallest returns, so the risk is the mean loss of the worst $\alpha$ share of the sample. When $\alpha T$ is not an integer, the order statistic at the boundary takes the remaining fraction. The vector is nondecreasing and sums to $-1$, and it gives the value of ConditionalValueatRisk with no observation weights.

Mathematical definition

\[\begin{align} k &= \lfloor \alpha T \rfloor\\ \eta_{t} &= \begin{cases} -\dfrac{1}{\alpha T} & t \leq k\\ -1 + \dfrac{k}{\alpha T} & t = k + 1\\ 0 & t > k + 1 \end{cases}\\ \sum\limits_{t=1}^{T} \eta_{t} x_{(t)} &= -\dfrac{1}{\alpha T} \left(\sum\limits_{t=1}^{k} x_{(t)} + \left(\alpha T - k\right) x_{(k+1)}\right)\,. \end{align}\]

Where:

  • $\alpha$: Significance level (left tail probability), $\alpha \in (0, 1)$.
  • $k$: Number of order statistics that the tail holds in full.
  • $\boldsymbol{\eta}$: OWA weight vector $T \times 1$. Its $t$-th entry $\eta_{t}$ multiplies the $t$-th smallest return.
  • $x_{(t)}$: $t$-th smallest entry of $\boldsymbol{x}$, so $x_{(1)} \leq \dots \leq x_{(T)}$.
  • $\boldsymbol{x}$: Portfolio returns vector $T \times 1$.
  • $T$: Number of observations.

Arguments

  • T: Number of observations.
  • alpha: Significance level, the share of the sample in the tail.

Validation

  • 0 < alpha < 1.

Returns

  • w::VecNum: Vector of OWA weights of length T.

Related

References

  • [202] R. T. Rockafellar and S. Uryasev. Optimization of conditional value-at-risk. Journal of Risk 2, 21–41 (2000).
  • [199] D. Cajas. OWA portfolio optimization: A disciplined convex programming framework. Available at SSRN 3988927 (2021).
  • [12] D. Cajas. Advanced Portfolio Optimization: A Cutting-edge Quantitative Approach (Springer Nature Switzerland, 2025). Section 7.2.2.4.
source
PortfolioOptimisers.owa_wcvar — Function
owa_wcvar(T::Integer, alphas::VecNum, weights::VecNum)

Compute the OWA weight vector of a weighted sum of conditional values at risk.

The vector sums to minus the sum of weights. Section 2.1 of [207] states it with weights that sum to one, and the function does not check that sum. A negative weight can make the vector decrease, and the risk measure is then not convex.

Mathematical definition

\[\begin{align} \boldsymbol{\eta} &= \sum\limits_{j=1}^{J} p_{j} \boldsymbol{\eta}^{\mathrm{CVaR}}(\alpha_{j})\,. \end{align}\]

Where:

  • $\boldsymbol{\eta}$: OWA weight vector $T \times 1$. Its $t$-th entry $\eta_{t}$ multiplies the $t$-th smallest return.
  • $\boldsymbol{\eta}^{\mathrm{CVaR}}(\alpha)$: CVaR OWA weight vector at level $\alpha$, the value of owa_cvar(T, α).
  • $\alpha_{j}$, $p_{j}$: The $j$-th entries of alphas and weights.
  • $J$: Number of levels, length(alphas).

Arguments

  • T: Number of observations.
  • alphas: Vector of significance levels, each in $(0, 1)$.
  • weights: Vector of the weight of each level.

Validation

  • length(alphas) == length(weights). Raises a DimensionMismatch.
  • Each entry of alphas satisfies 0 < alpha < 1, through owa_cvar.

Returns

  • w::VecNum: Vector of OWA weights of length T.

Related

References

  • [207] D. Cajas. Efficient Gini Mean Difference and Tail Gini Portfolio Optimization based on P-Norms. Available at SSRN 4711326 (2024). Section 2.1.
source
PortfolioOptimisers.owa_tg — Function
owa_tg(T::Integer; alpha_i::Number = 1e-4, alpha::Number = 0.05, a_sim::Integer = 100)

Compute the OWA weight vector of the tail Gini, as a weighted sum of conditional values at risk.

Section 2.1 of [207] states the tail Gini weights as this weighted sum, over a grid of levels from zero to alpha. The library starts the grid at alpha_i > 0, because the conditional value at risk has no level zero. The quadrature weights sum to one, so the vector sums to $-1$.

Mathematical definition

\[\begin{align} \alpha_{j} &= \alpha_{i} + \dfrac{j - 1}{m - 1} \left(\alpha - \alpha_{i}\right) \quad \forall j = 1,\, \ldots,\, m\\ p_{1} &= \dfrac{\alpha_{1} \alpha_{2}}{\alpha_{m}^{2}}\\ p_{j} &= \dfrac{\left(\alpha_{j+1} - \alpha_{j-1}\right) \alpha_{j}}{\alpha_{m}^{2}} \quad \forall j = 2,\, \ldots,\, m - 1\\ p_{m} &= \dfrac{\alpha_{m} - \alpha_{m-1}}{\alpha_{m}}\\ \boldsymbol{\eta} &= \sum\limits_{j=1}^{m} p_{j} \boldsymbol{\eta}^{\mathrm{CVaR}}(\alpha_{j})\,. \end{align}\]

Where:

  • $\alpha_{i}$, $\alpha$: The levels alpha_i and alpha, the two ends of the grid.
  • $m$: Number of grid points, a_sim.
  • $\alpha_{j}$, $p_{j}$: The $j$-th level of the grid and its quadrature weight.
  • $\boldsymbol{\eta}$: OWA weight vector $T \times 1$. Its $t$-th entry $\eta_{t}$ multiplies the $t$-th smallest return.
  • $\boldsymbol{\eta}^{\mathrm{CVaR}}(\alpha)$: CVaR OWA weight vector at level $\alpha$, the value of owa_cvar(T, α).

Arguments

  • T: Number of observations.
  • alpha_i: Inner level, the first point of the grid.
  • alpha: Outer level, the last point of the grid.
  • a_sim: Number of grid points.

Validation

  • 0 < alpha_i < alpha < 1. Raises a DomainError.
  • a_sim >= 2. Raises a DomainError.

Returns

  • w::VecNum: Vector of OWA weights of length T.

Related

References

  • [210] W. Ogryczak and A. Ruszczyński. Dual stochastic dominance and quantile risk measures. International Transactions in Operational Research 9, 661–680 (2002).
  • [199] D. Cajas. OWA portfolio optimization: A disciplined convex programming framework. Available at SSRN 3988927 (2021).
  • [207] D. Cajas. Efficient Gini Mean Difference and Tail Gini Portfolio Optimization based on P-Norms. Available at SSRN 4711326 (2024). Section 2.1.
  • [12] D. Cajas. Advanced Portfolio Optimization: A Cutting-edge Quantitative Approach (Springer Nature Switzerland, 2025). Section 7.2.2.5.
source
PortfolioOptimisers.owa_wr — Function
owa_wr(T::Integer)

Compute the OWA weight vector of the worst realisation.

The vector selects the smallest return with the weight $-1$, so the risk is the largest loss of the sample. It gives the value of WorstRealisation.

Mathematical definition

\[\begin{align} \eta_{t} &= \begin{cases} -1 & t = 1\\ 0 & t > 1 \end{cases}\\ \sum\limits_{t=1}^{T} \eta_{t} x_{(t)} &= -x_{(1)}\,. \end{align}\]

Where:

  • $\boldsymbol{\eta}$: OWA weight vector $T \times 1$. Its $t$-th entry $\eta_{t}$ multiplies the $t$-th smallest return.
  • $x_{(t)}$: $t$-th smallest entry of $\boldsymbol{x}$, so $x_{(1)} \leq \dots \leq x_{(T)}$.
  • $\boldsymbol{x}$: Portfolio returns vector $T \times 1$.
  • $T$: Number of observations.

Arguments

  • T: Number of observations.

Returns

  • w::VecNum: Vector of OWA weights of length T.

Related

References

  • [207] D. Cajas. Efficient Gini Mean Difference and Tail Gini Portfolio Optimization based on P-Norms. Available at SSRN 4711326 (2024). Section 2.1.
source
PortfolioOptimisers.owa_rg — Function
owa_rg(T::Integer)

Compute the OWA weight vector of the range of the returns.

The vector weights the largest return by $1$ and the smallest by $-1$, so the risk is the largest return less the smallest. It gives the value of Range. A sample of one observation has a range of zero, and its vector is $(0)$.

Note

Under ApproxOrderedWeightsArray, an OrderedWeightsArray over this fused vector is a looser relaxation than the two tails of OrderedWeightsArrayRange(; w1 = owa_wr), which OWA_RG builds. In a minimum-risk MeanRisk on seeded returns with $T = 100$ and $N = 8$, the fused optimum has an exact risk 9.6 % above the exact optimum, and the two tails reach the exact optimum. Under ExactOrderedWeightsArray and SortingNetworkOrderedWeightsArray, the two spellings give the same model.

Mathematical definition

\[\begin{align} \eta_{t} &= \begin{cases} -1 & t = 1\\ 1 & t = T\\ 0 & 1 < t < T \end{cases}\\ \sum\limits_{t=1}^{T} \eta_{t} x_{(t)} &= x_{(T)} - x_{(1)}\,. \end{align}\]

Where:

  • $\boldsymbol{\eta}$: OWA weight vector $T \times 1$. Its $t$-th entry $\eta_{t}$ multiplies the $t$-th smallest return.
  • $x_{(t)}$: $t$-th smallest entry of $\boldsymbol{x}$, so $x_{(1)} \leq \dots \leq x_{(T)}$.
  • $\boldsymbol{x}$: Portfolio returns vector $T \times 1$.
  • $T$: Number of observations.

Arguments

  • T: Number of observations.

Returns

  • w::VecNum: Vector of OWA weights of length T.

Related

References

  • [207] D. Cajas. Efficient Gini Mean Difference and Tail Gini Portfolio Optimization based on P-Norms. Available at SSRN 4711326 (2024). Section 2.1.
source
PortfolioOptimisers.owa_cvarrg — Function
owa_cvarrg(T::Integer; alpha::Number = 0.05, beta::Number = alpha)

Compute the OWA weight vector of the conditional value at risk range.

The vector is the loss-tail vector at level alpha less the reversed loss-tail vector at level beta. The reversal moves the second tail to the largest returns, and the subtraction makes its weights positive. So the risk is the conditional value at risk of the losses plus the mean of the beta share of the largest returns, a sum of the two tails. The vector sums to zero.

Note

Under ApproxOrderedWeightsArray, an OrderedWeightsArray over this fused vector is a looser relaxation than the two tails of an OrderedWeightsArrayRange, which OWA_CVaR_RG builds. In a minimum-risk MeanRisk on seeded returns with $T = 100$, $N = 8$ and $\alpha = \beta = 0.05$, the fused optimum has an exact risk 4.6 % above the exact optimum, and the two tails reach the exact optimum. Under ExactOrderedWeightsArray and SortingNetworkOrderedWeightsArray, the two spellings give the same model.

Mathematical definition

\[\begin{align} \boldsymbol{\eta} &= \boldsymbol{\eta}^{\mathrm{CVaR}}(\alpha) - \mathbf{A} \boldsymbol{\eta}^{\mathrm{CVaR}}(\beta)\,. \end{align}\]

Where:

  • $\boldsymbol{\eta}$: OWA weight vector $T \times 1$. Its $t$-th entry $\eta_{t}$ multiplies the $t$-th smallest return.
  • $\boldsymbol{\eta}^{\mathrm{CVaR}}(\alpha)$: CVaR OWA weight vector at level $\alpha$, the value of owa_cvar(T, α).
  • $\mathbf{A}$: Reversal matrix $T \times T$, with ones on the anti-diagonal and zeros elsewhere, so $(\mathbf{A} \boldsymbol{v})_{t} = v_{T + 1 - t}$.
  • $\alpha$, $\beta$: Significance levels of the loss tail and of the gain tail.

Arguments

  • T: Number of observations.
  • alpha: Significance level of the loss tail.
  • beta: Significance level of the gain tail.

Validation

  • 0 < alpha < 1 and 0 < beta < 1, through owa_cvar.

Returns

  • w::VecNum: Vector of OWA weights of length T.

Related

References

  • [207] D. Cajas. Efficient Gini Mean Difference and Tail Gini Portfolio Optimization based on P-Norms. Available at SSRN 4711326 (2024). Section 2.1.
source
PortfolioOptimisers.owa_wcvarrg — Function
owa_wcvarrg(T::Integer, alphas::VecNum, weights_a::VecNum,
            betas::VecNum = alphas,
            weights_b::VecNum = weights_a)

Compute the OWA weight vector of the range of two weighted sums of conditional values at risk.

The vector is the loss-tail vector of owa_wcvar at alphas and weights_a, less the reversed vector at betas and weights_b. As in owa_cvarrg, the reversal and the subtraction make the risk a sum of the two tails.

Note

Under ApproxOrderedWeightsArray, an OrderedWeightsArray over this fused vector is a looser relaxation than an OrderedWeightsArrayRange with w1 = T -> owa_wcvar(T, alphas, weights_a) and w2 = reverse ∘ (T -> owa_wcvar(T, betas, weights_b)). The note of owa_cvarrg gives the measured gap of the same mechanism. Under ExactOrderedWeightsArray and SortingNetworkOrderedWeightsArray, the two spellings give the same model.

Mathematical definition

\[\begin{align} \boldsymbol{\eta} &= \sum\limits_{j=1}^{J} p_{j} \boldsymbol{\eta}^{\mathrm{CVaR}}(\alpha_{j}) - \mathbf{A} \sum\limits_{l=1}^{L} q_{l} \boldsymbol{\eta}^{\mathrm{CVaR}}(\beta_{l})\,. \end{align}\]

Where:

  • $\boldsymbol{\eta}$: OWA weight vector $T \times 1$. Its $t$-th entry $\eta_{t}$ multiplies the $t$-th smallest return.
  • $\boldsymbol{\eta}^{\mathrm{CVaR}}(\alpha)$: CVaR OWA weight vector at level $\alpha$, the value of owa_cvar(T, α).
  • $\mathbf{A}$: Reversal matrix $T \times T$, with ones on the anti-diagonal and zeros elsewhere, so $(\mathbf{A} \boldsymbol{v})_{t} = v_{T + 1 - t}$.
  • $\alpha_{j}$, $p_{j}$: The $j$-th entries of alphas and weights_a, and $J$ their length.
  • $\beta_{l}$, $q_{l}$: The $l$-th entries of betas and weights_b, and $L$ their length.

Arguments

  • T: Number of observations.
  • alphas: Vector of significance levels of the loss tail.
  • weights_a: Vector of the weight of each level of the loss tail.
  • betas: Vector of significance levels of the gain tail.
  • weights_b: Vector of the weight of each level of the gain tail.

Validation

  • length(alphas) == length(weights_a) and length(betas) == length(weights_b), through owa_wcvar. Raises a DimensionMismatch.
  • Each level is in $(0, 1)$, through owa_cvar.

Returns

  • w::VecNum: Vector of OWA weights of length T.

Related

References

  • [207] D. Cajas. Efficient Gini Mean Difference and Tail Gini Portfolio Optimization based on P-Norms. Available at SSRN 4711326 (2024). Section 2.1.
source
PortfolioOptimisers.owa_tgrg — Function
owa_tgrg(T::Integer; alpha_i::Number = 0.0001, alpha::Number = 0.05, a_sim::Integer = 100,
         beta_i::Number = alpha_i, beta::Number = alpha, b_sim::Integer = a_sim)

Compute the OWA weight vector of the tail Gini range.

The vector is the tail Gini vector of owa_tg at alpha_i, alpha and a_sim, less the reversed tail Gini vector at beta_i, beta and b_sim. As in owa_cvarrg, the reversal and the subtraction make the risk a sum of the two tails. The vector sums to zero.

Note

Under ApproxOrderedWeightsArray, an OrderedWeightsArray over this fused vector is a looser relaxation than the two tails of an OrderedWeightsArrayRange, which OWA_TG_RG builds. In a minimum-risk MeanRisk on seeded returns with $T = 100$, $N = 8$ and the default levels, the fused optimum has an exact risk 2.1 % above the exact optimum, and the two tails come to 0.2 % above it. Under ExactOrderedWeightsArray and SortingNetworkOrderedWeightsArray, the two spellings give the same model.

Mathematical definition

\[\begin{align} \boldsymbol{\eta} &= \boldsymbol{\eta}^{\mathrm{TG}}(\alpha_{i}, \alpha, m_{a}) - \mathbf{A} \boldsymbol{\eta}^{\mathrm{TG}}(\beta_{i}, \beta, m_{b})\,. \end{align}\]

Where:

  • $\boldsymbol{\eta}$: OWA weight vector $T \times 1$. Its $t$-th entry $\eta_{t}$ multiplies the $t$-th smallest return.
  • $\boldsymbol{\eta}^{\mathrm{TG}}(\alpha_{i}, \alpha, m)$: Tail Gini OWA weight vector, the value of owa_tg(T; alpha_i, alpha, a_sim = m).
  • $\mathbf{A}$: Reversal matrix $T \times T$, with ones on the anti-diagonal and zeros elsewhere, so $(\mathbf{A} \boldsymbol{v})_{t} = v_{T + 1 - t}$.
  • $\alpha_{i}$, $\alpha$, $m_{a}$: Inner level, outer level and grid size of the loss tail.
  • $\beta_{i}$, $\beta$, $m_{b}$: Inner level, outer level and grid size of the gain tail.

Arguments

  • T: Number of observations.
  • alpha_i: Inner level of the loss tail.
  • alpha: Outer level of the loss tail.
  • a_sim: Number of grid points of the loss tail.
  • beta_i: Inner level of the gain tail.
  • beta: Outer level of the gain tail.
  • b_sim: Number of grid points of the gain tail.

Validation

  • 0 < alpha_i < alpha < 1 and 0 < beta_i < beta < 1, through owa_tg. Raises a DomainError.
  • a_sim >= 2 and b_sim >= 2, through owa_tg. Raises a DomainError.

Returns

  • w::VecNum: Vector of OWA weights of length T.

Related

References

  • [207] D. Cajas. Efficient Gini Mean Difference and Tail Gini Portfolio Optimization based on P-Norms. Available at SSRN 4711326 (2024). Section 2.1.
source

References

[12]
D. Cajas. Advanced Portfolio Optimization: A Cutting-edge Quantitative Approach (Springer Nature Switzerland, 2025).
[199]
D. Cajas. OWA portfolio optimization: A disciplined convex programming framework. Available at SSRN 3988927 (2021).
[202]
R. T. Rockafellar and S. Uryasev. Optimization of conditional value-at-risk. Journal of Risk 2, 21–41 (2000).
[207]
D. Cajas. Efficient Gini Mean Difference and Tail Gini Portfolio Optimization based on P-Norms. Available at SSRN 4711326 (2024).
[208]
D. Cajas. Higher order moment portfolio optimization with L-moments. Available at SSRN 4393155 (2023).
[209]
W. Ogryczak and T. Śliwiński. On solving linear programs with the ordered weighted averaging objective. European Journal of Operational Research 148, 80–91 (2003).
[210]
W. Ogryczak and A. Ruszczyński. Dual stochastic dominance and quantile risk measures. International Transactions in Operational Research 9, 661–680 (2002).
[211]
S. Yitzhaki. Stochastic dominance, mean variance, and Gini's mean difference. The American Economic Review 72, 178–185 (1982).