Ordered Weights Array (b)
PortfolioOptimisers.OrderedWeightsArrayRange — Type
struct OrderedWeightsArrayRange{__T_settings, __T_w1, __T_w2, __T_alg, __T_rev} <: RiskMeasureOrdered Weights Array Range (OWA Range) risk measure.
Computes portfolio risk as the difference between two OWA linear combinations of sorted portfolio returns, providing a range-based risk measure.
The constructor reverses w2 unless the caller declares that it is already reversed (see rev). That reversal is what makes the difference of the two weight vectors a range: w1 addresses the lower tail of the sorted returns, and the reversed w2 addresses the upper tail, so w1 - w2 sums the two tails rather than cancelling them. It is the weight-space form of the convention ValueatRiskRange states on the returns themselves.
Mathematical definition
\[\begin{align} \mathrm{OWARange}_{\boldsymbol{w}_{1},\boldsymbol{w}_{2}}(\boldsymbol{x}) &= \sum_{t=1}^{T} \left(w_{1,t} - w_{2,t}\right) x_{(t)}\,. \end{align}\]
Where:
- $\mathrm{OWARange}_{\boldsymbol{w}_{1},\boldsymbol{w}_{2}}(\boldsymbol{x})$: Ordered weights array range.
- $\boldsymbol{x}$: Portfolio returns vector $T \times 1$.
- $T$: Number of observations.
- $\boldsymbol{w}_{1}$: Lower-tail OWA weight vector $T \times 1$.
- $\boldsymbol{w}_{2}$: Upper-tail OWA weight vector $T \times 1$, held reversed by the constructor.
- $x_{(t)}$: $t$-th smallest entry of $\boldsymbol{x}$, so $x_{(1)} \leq \dots \leq x_{(T)}$.
Fields
settings: Risk measure settings.
w1: Optional first OWA weight vector.
w2: Optional second OWA weight vector.
alg: Risk measure optimisation formulation algorithm.
rev: Whetherw2is already reversed. It is a done-flag, not an instruction: the constructor reversesw2whenrev == false, and leaves it as-is whenrev == true. The field is stored astruewhatever the caller passes, becausew2is reversed by the time the object exists, so rebuilding an instance from its own fields does not reverse twice. A default-constructed instance therefore printsrevastrue.
Constructors
OrderedWeightsArrayRange(; settings::RiskMeasureSettings = RiskMeasureSettings(), w1::OWA_Func_VecNum = owa_tg, w2::OWA_Func_VecNum = owa_tg, alg::OrderedWeightsArrayFormulation = ApproxOrderedWeightsArray(), rev::Bool = false) -> OrderedWeightsArrayRangeKeywords correspond to the struct's fields.
Validation
- If
w1is aVecNum:!isempty(w1). - If
w2is aVecNum:!isempty(w2). - If both
w1andw2areVecNum:length(w1) == length(w2).
Functor
(r::OrderedWeightsArrayRange)(x::VecNum)Computes the OWA range of a portfolio returns vector x, as the sorted returns weighted by w1 - w2. A w1 or w2 that is a callable is evaluated at length(x) first, so the weight vectors always match the sample.
Arguments
x::VecNum: Portfolio returns vector.
Examples
julia> OrderedWeightsArrayRange()OrderedWeightsArrayRange settings ┼ RiskMeasureSettings │ scale ┼ Float64: 1.0 │ ub ┼ nothing │ rke ┴ Bool: true w1 ┼ typeof(owa_tg): PortfolioOptimisers.owa_tg w2 ┼ ComposedFunction{typeof(reverse), typeof(owa_tg)}: reverse ∘ PortfolioOptimisers.owa_tg alg ┼ ApproxOrderedWeightsArray │ p ┴ Vector{Float64}: [2.0, 3.0, 4.0, 10.0, 50.0] rev ┴ Bool: trueRelated
OrderedWeightsArrayOrderedWeightsArrayFormulationExactOrderedWeightsArrayApproxOrderedWeightsArrayRiskMeasureSettings
References
- [136] 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).
- [133] D. Cajas. OWA portfolio optimization: A disciplined convex programming framework. Available at SSRN 3988927 (2021).
- [5] D. Cajas. Advanced Portfolio Optimization: A Cutting-edge Quantitative Approach (Springer Nature Switzerland, 2025). Section 7.2.3.
PortfolioOptimisers.factory — Method
factory(
x::OrderedWeightsArrayRange,
pr::AbstractPriorResult,
args...;
kwargs...
) -> OrderedWeightsArrayRange
Resolve the two weight builders of an OrderedWeightsArrayRange against prior result pr.
It carries the reading of factory on OrderedWeightsArray unchanged, over two builders instead of one.
Related
References
- [5]
- D. Cajas. Advanced Portfolio Optimization: A Cutting-edge Quantitative Approach (Springer Nature Switzerland, 2025).
- [133]
- D. Cajas. OWA portfolio optimization: A disciplined convex programming framework. Available at SSRN 3988927 (2021).
- [136]
- 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).