OWA risk measures (a): private API

PortfolioOptimisers.AbstractOrderedWeightsArrayEstimator — Type
abstract type AbstractOrderedWeightsArrayEstimator <: AbstractEstimator

Abstract supertype for the estimators of the risk aversion coefficients of an L-moment OWA weight vector.

owa_l_moment_crm dispatches on the subtype. NormalisedConstantRelativeRiskAversion states the coefficients in closed form, and OWAJuMP solves a programme for them.

Related

References

  • [208] D. Cajas. Higher order moment portfolio optimization with L-moments. Available at SSRN 4393155 (2023).
source
PortfolioOptimisers.AbstractOrderedWeightsArrayAlgorithm — Type
abstract type AbstractOrderedWeightsArrayAlgorithm <: AbstractAlgorithm

Abstract supertype for the objectives of the programme that OWAJuMP solves for an L-moment OWA weight vector.

Every subtype solves over the same feasible set, which owa_l_moment_crm states. The subtype selects the objective alone.

Related

References

  • [208] D. Cajas. Higher order moment portfolio optimization with L-moments. Available at SSRN 4393155 (2023).
source
PortfolioOptimisers.SquaredOrderedWeightsArrayAlgorithm — Type
abstract type SquaredOrderedWeightsArrayAlgorithm{T} <: AbstractOrderedWeightsArrayAlgorithm

Abstract supertype for the quadratic objectives of the L-moment programme of OWAJuMP.

Each subtype minimises a sum of squares of the OWA weights. The parameter T is the type of the conic encoding of that sum, a second-order cone risk expression. owa_l_moment_crm_sumsq_obj dispatches on it.

Related

References

  • [208] D. Cajas. Higher order moment portfolio optimization with L-moments. Available at SSRN 4393155 (2023).
source
PortfolioOptimisers.OWA_Func_VecNum — Type
const OWA_Func_VecNum = Union{Func_VecNum, AbstractOrderedWeightsArrayFunction}

The values that a weight slot of OrderedWeightsArray or OrderedWeightsArrayRange accepts.

A weight vector fixes the sample size. A function or an AbstractOrderedWeightsArrayFunction is called at the sample size, so one measure serves a sample of any length. Only a builder can hold a Calibration Rule.

Related

source
PortfolioOptimisers.OrderedWeightsArrayFormulation — Type
abstract type OrderedWeightsArrayFormulation <: AbstractAlgorithm

Abstract supertype for the JuMP encodings of an OWA risk measure.

The OWA risk sorts the returns, and a convex programme cannot sort its variables. ExactOrderedWeightsArray and SortingNetworkOrderedWeightsArray encode the sort exactly, at two different costs. ApproxOrderedWeightsArray drops the sort and gives an upper bound. The functor of the measure sorts the returns itself and does not read the formulation.

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).
  • [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.1.5.
source
PortfolioOptimisers.assert_owa_formulation_weights — Method
assert_owa_formulation_weights(
    _::OrderedWeightsArrayFormulation,
    _::AbstractVector{<:Union{Number, AbstractJuMPScalar}}
)

Refuse an OWA weight vector w that the formulation alg cannot optimise.

The exact and the approximate formulations accept every weight vector, so this method returns nothing. A formulation that needs a property of the vector adds a method that checks it.

Arguments

  • alg: OWA formulation of the risk measure.
  • w: OWA weight vector, after the range measure reverses its second vector.

Returns

  • nothing.

Related

source
PortfolioOptimisers.OWA_RevFunc — Type
const OWA_RevFunc = ComposedFunction{typeof(reverse),
                                     <:AbstractOrderedWeightsArrayFunction}

The reversal of an ordered-weights builder, which is what OrderedWeightsArrayRange stores in w2 under the approximate formulation.

It is a Function and it computes no quantity, so it is the one occupant of a weight slot that a reader of the calibration channel must part from a Calibration Rule. The name is written once here, because the type is long and three sites read it.

Related

source
PortfolioOptimisers.OWA_CalOccupant — Type
const OWA_CalOccupant = Union{AbstractOrderedWeightsArrayFunction, OWA_RevFunc}

The occupants of an OrderedWeightsArray weight slot that carry a calibration slot of their own: a weight builder, and the reversal of one that the Range container builds.

The slot also takes a weight vector and a caller's own plain function, and neither carries a slot, so calibration_slots names neither. Everywhere else in the library, a plain function in a calibration slot is a Calibration Rule. The rule is what resolve_calibration_slot calls and what assert_calibrated_slots refuses, so a weight builder written as a plain function must not reach either.

Related

source
PortfolioOptimisers.owa_constraint_scale — Function
owa_constraint_scale(sc::Option{<:Number}, alg::AbstractOrderedWeightsArrayAlgorithm)

Return the constraint scale of the L-moment programme of OWAJuMP.

A stated sc wins. When sc is nothing, the objective alg gives the scale, so each objective can set the value that its programme solves at. Every objective gives 1.0 now.

Arguments

  • sc: The sc field of OWAJuMP.
  • alg: The objective of the programme.

Returns

  • sc::Number: The constraint scale.

Examples

julia> PortfolioOptimisers.owa_constraint_scale(nothing, MaximumEntropy())1.0julia> PortfolioOptimisers.owa_constraint_scale(2.0, MaximumEntropy())2.0

Related

source
PortfolioOptimisers.owa_objective_scale — Function
owa_objective_scale(so::Option{<:Number}, alg::AbstractOrderedWeightsArrayAlgorithm)

Return the objective scale of the L-moment programme of OWAJuMP.

A stated so wins. When so is nothing, the objective alg gives the scale, so each objective can set the value that its programme solves at. MaximumEntropy gives 1e-3, and its docstring states why. The other objectives give 1.0.

Arguments

  • so: The so field of OWAJuMP.
  • alg: The objective of the programme.

Returns

  • so::Number: The objective scale.

Examples

julia> PortfolioOptimisers.owa_objective_scale(nothing, MaximumEntropy())0.001julia> PortfolioOptimisers.owa_objective_scale(nothing, MinimumSumSquares())1.0julia> PortfolioOptimisers.owa_objective_scale(2.0, MaximumEntropy())2.0

Related

source
PortfolioOptimisers.owa_l_moment_crm_sumsq_obj — Function
owa_l_moment_crm_sumsq_obj(method::OWAJuMP{<:Any, <:Any, <:Any, <:Any,
                                           <:SquaredOrderedWeightsArrayAlgorithm},
                           model::JuMP.Model)

Set the objective of a SquaredOrderedWeightsArrayAlgorithm programme on model.

owa_l_moment_crm adds the cone row that bounds the variable t. This method sets the objective alone, and it dispatches on the SecondMomentFormulation that parameterises method.alg. It does not solve the model. The three encodings give one minimiser, so they return the same OWA weights to solver tolerance.

JuMP formulation

Variables

  • t: Read, the scalar that the cone row of the caller bounds.

Objective

Where:

  • $s_o$: Objective scale. It multiplies the objective, so a positive value leaves the argument of the optimum unchanged. owa_objective_scale gives it from the so field of method.

Arguments

Returns

  • The objective function that the method sets on model. The function changes model in place.

Related

References

  • [208] D. Cajas. Higher order moment portfolio optimization with L-moments. Available at SSRN 4393155 (2023).
source
PortfolioOptimisers.ncrra_weights — Function
ncrra_weights(weights::MatNum, g::Number = 0.5)

Compute the OWA weight vector of the normalised constant relative risk aversion coefficients of g.

Column j of weights takes the coefficient of the L-moment of order j + 1, so the columns of the signed L-moment weight matrix give the vector that NormalisedConstantRelativeRiskAversion states. The coefficients sum to one, and the returned weights do not. The returned vector is the running maximum of a combination of the columns, so its sum is at least the same combination of the column sums.

Mathematical definition

\[\begin{align} \tilde{\phi}_{j} &= \dfrac{1}{(j + 1)!} \prod\limits_{i=0}^{j-1} \left(\gamma + i\right) \quad \forall j = 1,\, \ldots,\, M\\ \phi_{j} &= \dfrac{\tilde{\phi}_{j}}{\sum_{i=1}^{M} \tilde{\phi}_{i}}\\ \boldsymbol{\vartheta} &= \mathbf{V} \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)$.
  • $\mathbf{V}$: The matrix weights, $T \times M$.
  • $\tilde{\phi}_{j}$, $\phi_{j}$: Coefficient of column $j$ before and after the normalisation.
  • $\boldsymbol{\vartheta}$: Combination of the columns of $\mathbf{V}$, $T \times 1$.
  • $\boldsymbol{\eta}$: OWA weight vector $T \times 1$. Its $t$-th entry $\eta_{t}$ multiplies the $t$-th smallest return.

Algorithm

  1. Set the running product e = 1. For each column i of weights, multiply e by g + i - 1, and set phis[i] = e / factorial(i + 1).
  2. Divide phis by its sum.
  3. Compute the combination a = weights * phis.
  4. Set w[i] to the largest entry of a[1:i], for each i.

Arguments

  • weights: Matrix $T \times M$ of signed L-moment weights, one column for each order from two up.
  • g: Relative risk aversion.

Returns

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

Examples

julia> w = [1.0 0.5; 0.5 1.0]2×2 Matrix{Float64}: 1.0  0.5 0.5  1.0julia> PortfolioOptimisers.ncrra_weights(w, 0.5)2-element Vector{Float64}: 0.8333333333333333 0.8333333333333333

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.owa_model_setup — Function
owa_model_setup(method::OWAJuMP, weights::MatNum)

Build the feasible set of the L-moment programme of OWAJuMP in a new JuMP model.

The model holds the risk aversion coefficients phi and the OWA weights theta, and the rows that every objective of AbstractOrderedWeightsArrayAlgorithm shares. It has no objective and no optimiser. owa_l_moment_crm adds the objective, and owa_model_solve solves the model.

JuMP formulation

Variables

  • theta: Created, the OWA weights $\boldsymbol{\theta}$, $T \times 1$.
  • phi: Created, the risk aversion coefficients $\boldsymbol{\phi}$, $(K - 1) \times 1$.

Constraints

Every row is registered under no name.

  • $s_c \boldsymbol{\phi} \geq 0$.
  • $s_c (\boldsymbol{\phi} - \phi_{\max}) \leq 0$.
  • $s_c \left(\sum_{k=2}^{K} \phi_{k} - 1\right) = 0$.
  • $s_c (\boldsymbol{\theta} - \mathbf{W} \boldsymbol{\phi}) = 0$.
  • $s_c (\phi_{k+1} - \phi_{k}) \leq 0$ for $k = 2, \ldots, K - 1$.
  • $s_c (\theta_{t+1} - \theta_{t}) \geq 0$ for $t = 1, \ldots, T - 1$.

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.
  • $\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.
  • $\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$. It is the matrix weights.
  • $\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).
  • $K$: Highest L-moment order, the k of owa_l_moment_crm.
  • $T$: Number of observations.

Arguments

  • method: Programme of the coefficients. The function reads max_phi, sc and alg.
  • weights: Signed L-moment weight matrix $T \times (K - 1)$.

Returns

  • model::JuMP.Model: The model of the feasible set.

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_model_solve — Function
owa_model_solve(model::JuMP.Model, method::OWAJuMP, weights::MatNum)

Solve the L-moment programme in model, and return its OWA weights.

The returned weights are the value of the variable theta, which owa_model_setup holds equal to weights * phi. The model holds the coefficients phi to a sum of one, not theta.

The programme is infeasible for some combinations of the sample size, the highest order and max_phi, and the function then returns the fallback. These are the cases with the default max_phi = 0.5, measured with a linear programme that maximises the smallest step of the OWA weights:

  • At the highest order 2 it is always infeasible, because the one coefficient must equal one, and max_phi < 1.
  • At the highest order 3 the rows leave the one choice $\boldsymbol{\phi} = (0.5, 0.5)$, and its OWA weights decrease near the largest return. It is infeasible at every sample size measured: 3 to 300, 1000 and 5000 observations.
  • At the highest order 4 it is infeasible up to 21 observations, and feasible at every sample size measured from 22 to 80, 100 and 1000 observations.
  • At each highest order k from 5 to 8 it is feasible at every sample size measured, from k to 80 observations.

Algorithm

  1. Optimise model with the solvers of method.slv, through optimise_JuMP_model!.
  2. If the solve succeeds, return w, the value of model[:theta].
  3. Otherwise, warn, and return w = ncrra_weights(weights, 0.5).

Arguments

  • model: Model of the programme, with its objective set.
  • method: Programme of the coefficients. The function reads slv.
  • weights: Signed L-moment weight matrix $T \times (K - 1)$, for the fallback.

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).
source
PortfolioOptimisers.owa_l_moment_crm_entropy — Function
owa_l_moment_crm_entropy(method::OWAJuMP{<:Any, <:Any, <:Any, <:Any, <:MaximumEntropy},
                         model::JuMP.Model)

Add the entropy objective of the MaximumEntropy programme to model.

The method dispatches on the EntropyFormulation in method.alg.alg. It reads the risk aversion coefficients phi, adds the variable and the cone rows that bound their entropy, and sets the objective. It does not solve the model.

The two encodings state one problem. Under ExponentialConeEntropy the objective is the entropy less $\log s_c$, because the cones hold $s_c \phi_{k}$ and the coefficients sum to one. So the objective values differ when $s_c \neq 1$, and the maximiser does not. MaximumEntropy states why the programme needs a small $s_o$.

JuMP formulation

Variables

Constraints

Every row is registered under no name.

  • Under RelativeEntropy: $(s_c t,\, s_c \boldsymbol{1},\, s_c \boldsymbol{\phi}) \in \mathcal{K}_{\mathrm{rel}}$, which states $t \geq \sum_{k=2}^{K} \phi_{k} \log \phi_{k}$.
  • Under ExponentialConeEntropy: $(s_c t_{k},\, s_c \phi_{k},\, 1) \in \mathcal{K}_{\exp}$ for each $k$, which states $t_{k} \leq -\phi_{k} \log(s_c \phi_{k})$.

Objective

Where:

  • $\phi_{k}$: Risk aversion coefficient of the $k$-th L-moment, for $k = 2, \ldots, K$.
  • $\boldsymbol{\theta}$: Solved OWA weight vector $T \times 1$, the model variable theta.
  • $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.
  • $s_o$: Objective scale. It multiplies the objective, so a positive value leaves the argument of the optimum unchanged. owa_objective_scale gives it from the so field of method.
  • $\mathcal{K}_{\mathrm{rel}} = \{(u, \boldsymbol{v}, \boldsymbol{z}) : u \geq \sum_{i} z_{i} \log(z_{i} / v_{i}),\, \boldsymbol{v}, \boldsymbol{z} \geq 0\}$: Relative entropy cone.
  • $\mathcal{K}_{\exp} = \mathrm{cl}\,\{(a,b,c) : b\, e^{a/b} \leq c,\, b > 0\}$: Exponential cone.
  • $K$: Highest L-moment order, the k of owa_l_moment_crm.
  • $T$: Number of observations.

Arguments

Returns

  • nothing. The function changes model in place.

Related

References

  • [208] D. Cajas. Higher order moment portfolio optimization with L-moments. Available at SSRN 4393155 (2023).
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).
[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).