L1 uncertainty sets

PortfolioOptimisers.L1UncertaintySet — Type
struct L1UncertaintySet{__T_eps, __T_sd, __T_mu} <: AbstractUncertaintySetResult

$\ell_1$ uncertainty set on the characteristic vector, a cross-polytope around the estimate.

The set is $\mathcal{S} = \{\hat{\boldsymbol{\mu}} + \boldsymbol{\sigma} \odot \boldsymbol{u} : \lVert \boldsymbol{u} \rVert_1 \leq \epsilon\}$. One error budget covers every asset and both signs. CharacteristicUncertaintySet fits the set, and ArithmeticReturn reads it. The set bounds a characteristic vector, such as the mean, and it has no covariance analogue.

When every $\sigma_i > 0$, the set is $\{\hat{\boldsymbol{\mu}} + \boldsymbol{e} : \lVert \boldsymbol{e} \oslash \boldsymbol{\sigma} \rVert_1 \leq \epsilon\}$, the form of [8]. The form above also admits $\sigma_i = 0$, which fixes the entry $i$ at its estimate. It is the NormBallUncertaintySet with the map $\mathrm{diag}(\boldsymbol{\sigma})$, the order $p = 1$ and the radius $\epsilon$. A zero scale is the zero row of that map, and expand_investable_ucs writes it outside the Investable Mask.

Mathematical definition

The worst case of a linear characteristic over the set is the estimate less a scaled infinity norm. Lemmas 1 and 8 of [8] state it:

\[\underset{\boldsymbol{\mu} \in \mathcal{S}}{\min}\, \boldsymbol{\mu}^{\intercal} \boldsymbol{w} = \hat{\boldsymbol{\mu}}^{\intercal} \boldsymbol{w} - \epsilon \lVert \boldsymbol{\sigma} \odot \boldsymbol{w} \rVert_{\infty}\,.\]

Where:

  • $\hat{\boldsymbol{\mu}}$: Estimated characteristic vector.
  • $\epsilon$: Radius of the set.
  • $\boldsymbol{\sigma}$: Scaling of each asset, the sd field. It is $\boldsymbol{1}$ when sd is nothing.
  • $\boldsymbol{u}$: Scaled estimation error.
  • $\odot$, $\oslash$: Element-wise product and division.

The right-hand side is concave in $\boldsymbol{w}$. With an epigraph variable for the infinity norm, the worst case is a set of linear constraints, and the problem needs no conic solver. The equality holds for every $\boldsymbol{\sigma} \geq \boldsymbol{0}$, because the minimum of $\boldsymbol{u}^{\intercal} (\boldsymbol{\sigma} \odot \boldsymbol{w})$ over the $\ell_1$ ball of radius $\epsilon$ is $-\epsilon \lVert \boldsymbol{\sigma} \odot \boldsymbol{w} \rVert_{\infty}$.

Fields

  • eps: Radius of the $\ell_1$ uncertainty set on the characteristic vector. A larger radius admits more estimation error, and it activates more assets.
  • sd: Scaling of each asset in the $\ell_1$ uncertainty set, the estimated standard deviations. With nothing, the set has no scaling, and it gives the same estimation error to every entry of the characteristic vector.
  • mu: Characteristic vector at the centre of the $\ell_1$ set. With nothing, the consumer uses its own characteristic vector. A vector here replaces the characteristic of the returns estimator and the mean of the prior.

Constructors

L1UncertaintySet(;    eps::Number,    sd::Option{<:VecNum} = nothing,    mu::Option{<:VecNum} = nothing) -> L1UncertaintySet

Keywords correspond to the struct's fields.

Validation

  • isfinite(eps) and eps >= 0.
  • If sd is not nothing: !isempty(sd), all(isfinite, sd) and all(sd .>= 0). A zero scale fixes its entry at the estimate.
  • If mu is not nothing: !isempty(mu) and !any(isinf, mu). A NaN marks an asset outside the Investable Mask, as in the centre val of the other sets.
  • If sd and mu are not nothing: length(mu) == length(sd).

Examples

julia> L1UncertaintySet(; eps = 0.1)L1UncertaintySet  eps ┼ Float64: 0.1   sd ┼ nothing   mu ┴ nothing

Related

References

  • [8] R. Zhou and D. P. Palomar. Understanding the Quintile Portfolio. IEEE Transactions on Signal Processing 68, 4030–4040 (2020).
source
PortfolioOptimisers.SignedL1UncertaintySet — Type
struct SignedL1UncertaintySet{__T_ep, __T_en, __T_sd, __T_mu} <: AbstractUncertaintySetResult

Signed $\ell_1$ uncertainty set on the characteristic vector, with a separate error budget per sign.

The set is $\mathcal{A}_2 = \{\hat{\boldsymbol{\mu}} + \boldsymbol{\sigma} \odot \boldsymbol{u} : \boldsymbol{1}^{\intercal} [\boldsymbol{u}]_{+} \leq \epsilon_{+},\, -\boldsymbol{1}^{\intercal} [\boldsymbol{u}]_{-} \leq \epsilon_{-}\}$. When every $\sigma_i > 0$, $\boldsymbol{u} = \boldsymbol{e} \oslash \boldsymbol{\sigma}$, and the set is the set of [8]. A zero scale fixes its entry at the estimate, as in L1UncertaintySet, and the worst case below holds for every $\boldsymbol{\sigma} \geq \boldsymbol{0}$. It bounds a characteristic vector, such as the mean, and it has no covariance analogue. [8] uses the set to split the long-short problem into two independent problems, its Equations 27 and 28. Its Remark 12 joins the two solutions only when the two legs have disjoint supports. The worst case below keeps the long-short problem as one problem, so it needs no condition on the supports.

Mathematical definition

\[\underset{\boldsymbol{\mu} \in \mathcal{A}_2}{\min}\, \boldsymbol{\mu}^{\intercal} \boldsymbol{w} = \hat{\boldsymbol{\mu}}^{\intercal} \boldsymbol{w} - \epsilon_{+} \left[\underset{i}{\max}\, (-\sigma_i w_i)\right]_{+} - \epsilon_{-} \left[\underset{i}{\max}\, (\sigma_i w_i)\right]_{+}\,.\]

Where:

  • $\epsilon_{+}$, $\epsilon_{-}$: Radii of the positive-error and the negative-error sides, the ep and en fields.
  • $[\cdot]_{+}$, $[\cdot]_{-}$: Element-wise positive and negative parts.

The worst case is concave. With one epigraph variable for each sign, it is a set of linear constraints.

With $\epsilon_{+} = \epsilon_{-} = \epsilon$, this set is not $\mathcal{S}$. Let $t_{+}$ and $t_{-}$ be the two positive parts above. The joint set has one budget for both signs, and its penalty is $\epsilon \max(t_{+}, t_{-})$. This set has one budget for each sign, and its penalty is $\epsilon_{+} t_{+} + \epsilon_{-} t_{-}$. The two worst cases agree only when all the entries of $\boldsymbol{w}$ have the same sign.

Fields

  • ep: Radius of the positive-error side of the signed $\ell_1$ uncertainty set.
  • en: Radius of the negative-error side of the signed $\ell_1$ uncertainty set.
  • sd: Scaling of each asset in the $\ell_1$ uncertainty set, the estimated standard deviations. With nothing, the set has no scaling, and it gives the same estimation error to every entry of the characteristic vector.
  • mu: Characteristic vector at the centre of the $\ell_1$ set. With nothing, the consumer uses its own characteristic vector. A vector here replaces the characteristic of the returns estimator and the mean of the prior.

Constructors

SignedL1UncertaintySet(;    ep::Number,    en::Number,    sd::Option{<:VecNum} = nothing,    mu::Option{<:VecNum} = nothing) -> SignedL1UncertaintySet

Keywords correspond to the struct's fields.

Validation

  • isfinite(ep) and ep >= 0.
  • isfinite(en) and en >= 0.
  • If sd is not nothing: !isempty(sd), all(isfinite, sd) and all(sd .>= 0). A zero scale fixes its entry at the estimate.
  • If mu is not nothing: !isempty(mu) and !any(isinf, mu). A NaN marks an asset outside the Investable Mask, as in the centre val of the other sets.
  • If sd and mu are not nothing: length(mu) == length(sd).

Examples

julia> SignedL1UncertaintySet(; ep = 0.1, en = 0.2)SignedL1UncertaintySet  ep ┼ Float64: 0.1  en ┼ Float64: 0.2  sd ┼ nothing  mu ┴ nothing

Related

References

  • [8] R. Zhou and D. P. Palomar. Understanding the Quintile Portfolio. IEEE Transactions on Signal Processing 68, 4030–4040 (2020).
source
PortfolioOptimisers.L1UncertaintySetAlgorithm — Type
struct L1UncertaintySetAlgorithm{__T_method, __T_scaled, __T_paired} <: AbstractUncertaintySetAlgorithm

Shape algorithm that selects the joint $\ell_1$ uncertainty set.

scaled selects one of two sets of [8]. false gives $\mathcal{S}$, Equation 5 of [8], and true gives $\mathcal{A}_1$, its Equation 18. The default is false, because $\mathcal{S}$ is the base set of [8]. Its closed forms give the $1/N$ portfolio and the quintile portfolio. The default of SignedL1UncertaintySetAlgorithm is true, because [8] defines the signed set only in the scaled form.

Fields

  • scaled: If true, the estimated standard deviations scale the uncertainty set. false gives the same estimation error to every entry of the characteristic vector. true gives a larger estimation error to an asset with a larger variance, and the active weights are then inverse-volatility weights.
  • paired: paired: Selects the closed form that calibrates the radius when method is an AbstractUncertaintyEpsAlgorithm. The number of assets that a radius activates depends on the signs that the problem lets the weights take. An uncertainty set cannot read the problem, so the caller must state it. false selects the long-only ladder, for a problem with w >= 0 and bgt = 1, as in Corollaries 4 and 11 of [8]. true selects the paired ladder, for a dollar-neutral problem with bgt = 0 and sbgt = 1/2. In that problem the assets become active in pairs of one long asset and one short asset, as in Corollary 7. The wrong value gives a wrong radius, but the optimisation stays correct. paired has no effect when method is a number.

Constructors

L1UncertaintySetAlgorithm(;    method::Num_UcSEps = ActiveAssetsUncertaintyAlgorithm(),    scaled::Bool = false,    paired::Bool = false) -> L1UncertaintySetAlgorithm

Keywords correspond to the struct's fields.

Validation

  • If method is a Number: isfinite(method) and method >= 0.

Examples

julia> L1UncertaintySetAlgorithm()L1UncertaintySetAlgorithm  method ┼ ActiveAssetsUncertaintyAlgorithm         │   active ┼ FractionOf         │          │   val ┴ Float64: 0.2  scaled ┼ Bool: false  paired ┴ Bool: false

Related

References

  • [8] R. Zhou and D. P. Palomar. Understanding the Quintile Portfolio. IEEE Transactions on Signal Processing 68, 4030–4040 (2020).
source
PortfolioOptimisers.SignedL1UncertaintySetAlgorithm — Type
struct SignedL1UncertaintySetAlgorithm{__T_mp, __T_mm, __T_scaled} <: AbstractUncertaintySetAlgorithm

Shape algorithm that selects the signed $\ell_1$ uncertainty set.

The construction of [8] sets the two ladders, so this algorithm has no paired field. $\epsilon_{-}$ is the radius for the long leg, and its calibration reads the top of the ranking. $\epsilon_{+}$ is the radius for the short leg, and its calibration reads the bottom of the ranking. Corollary 13 of [8] states this. The default of scaled is true, because [8] defines $\mathcal{A}_2$ and states Corollary 13 only in the form scaled by volatility. The default of L1UncertaintySetAlgorithm is false, because its base set has no scaling.

Fields

  • mp: Radius of the positive-error side of the signed $\ell_1$ uncertainty set. A number is the radius. An AbstractUncertaintyEpsAlgorithm computes the radius from the data.
  • mm: Radius of the negative-error side of the signed $\ell_1$ uncertainty set. A number is the radius. An AbstractUncertaintyEpsAlgorithm computes the radius from the data.
  • scaled: If true, the estimated standard deviations scale the uncertainty set. false gives the same estimation error to every entry of the characteristic vector. true gives a larger estimation error to an asset with a larger variance, and the active weights are then inverse-volatility weights.

Constructors

SignedL1UncertaintySetAlgorithm(;    mp::Num_UcSEps = ActiveAssetsUncertaintyAlgorithm(),    mm::Num_UcSEps = ActiveAssetsUncertaintyAlgorithm(),    scaled::Bool = true) -> SignedL1UncertaintySetAlgorithm

Keywords correspond to the struct's fields.

Validation

  • If mp is a Number: isfinite(mp) and mp >= 0.
  • If mm is a Number: isfinite(mm) and mm >= 0.

Examples

julia> SignedL1UncertaintySetAlgorithm()SignedL1UncertaintySetAlgorithm      mp ┼ ActiveAssetsUncertaintyAlgorithm         │   active ┼ FractionOf         │          │   val ┴ Float64: 0.2      mm ┼ ActiveAssetsUncertaintyAlgorithm         │   active ┼ FractionOf         │          │   val ┴ Float64: 0.2  scaled ┴ Bool: true

Related

References

  • [8] R. Zhou and D. P. Palomar. Understanding the Quintile Portfolio. IEEE Transactions on Signal Processing 68, 4030–4040 (2020).
source
PortfolioOptimisers.CharacteristicUncertaintySet — Type
struct CharacteristicUncertaintySet{__T_pe, __T_alg} <: AbstractUncertaintySetEstimator

Fits an $\ell_1$ uncertainty set with a calibrated radius on the characteristic vector, for the mean only.

pe gives the characteristic vector $\hat{\boldsymbol{\mu}}$. When the shape algorithm is scaled, it also gives the scaling of each asset, $\hat{\boldsymbol{\sigma}} = \sqrt{\mathrm{diag}(\hat{\mathbf{\Sigma}})}$. The sets are the robust sets of [8] for the best characteristic. The maximum of the worst-case characteristic over one of these sets is a robust optimisation problem. Its exact solutions are the $1/N$ portfolio, the quintile portfolio and the inverse-volatility portfolio, and the radius sets the number of assets held. For this reason the library has no separate quintile optimiser. Use the set in MeanRisk:

MeanRisk(; r = NoRisk(), obj = MaximumReturn(),         opt = JuMPOptimiser(; slv = slv, bgt = 1.0,                             ret = ArithmeticReturn(; ucs = CharacteristicUncertaintySet())))

Fields

  • pe: Prior estimator that the set fits on the returns data, or nothing. With nothing, the set holds no prior of its own, and it fits on the Prior Result that the caller gives, through the prior-result method of the ucs Triple. Inside an optimiser, that result is the prior that the optimiser solves on, so the set and the objective have the same centre. With nothing, the returns-data method raises an ArgumentError. The default, EmpiricalPrior(), fits an empirical prior on the returns.

Constructors

CharacteristicUncertaintySet(;    pe::Option{<:AbstractLowOrderPriorEstimator} = EmpiricalPrior(),    alg::AbstractUncertaintySetAlgorithm = L1UncertaintySetAlgorithm()) -> CharacteristicUncertaintySet

Keywords correspond to the struct's fields.

Validation

Examples

The estimator calibrates the radius. Three assets with the sample means $0.125$, $0.0625$ and $0.03125$ give the Activation Ladder $[0, 0.0625, 0.125]$. The default active of 0.2 gives a target of one active asset, so the radius is the midpoint of the first and second rungs:

julia> X = [0.1875 0.09375 0.0625            0.0625 0.03125 0.0];julia> mu_ucs(CharacteristicUncertaintySet(), X)L1UncertaintySet  eps ┼ Float64: 0.03125   sd ┼ nothing   mu ┴ Vector{Float64}: [0.125, 0.0625, 0.03125]

Related

References

  • [8] R. Zhou and D. P. Palomar. Understanding the Quintile Portfolio. IEEE Transactions on Signal Processing 68, 4030–4040 (2020).
source
PortfolioOptimisers.ActiveAssetsUncertaintyAlgorithm — Type
struct ActiveAssetsUncertaintyAlgorithm{__T_active} <: AbstractUncertaintyEpsAlgorithm

Calibrates the radius of an $\ell_1$ uncertainty set to a target number of active assets.

The radius $\epsilon$ of an $\ell_1$ uncertainty set has no natural scale. It is a sum of differences of the characteristic. On daily returns it is of order $10^{-3}$, and on annualised returns it is about $250$ times larger. A caller can state a number of assets to hold more easily than a radius. This algorithm finds the radius that activates that number of assets, from the inverse of the closed forms of [8]. The inverse is exact only for the problem of those closed forms, which has the budget and sign constraints and no other constraint.

Fields

  • active: Target number of active assets. A CountOf is a number of assets, and a FractionOf is a fraction of the universe, rounded to the nearest asset. A plain number is read through count_or_fraction. The value selects the radius that activates this number of assets when the problem has only the budget and sign constraints. It is a Radius Calibration, not a cardinality constraint, and a different constraint can change the number of active assets. Use card for a hard cardinality constraint.

Constructors

ActiveAssetsUncertaintyAlgorithm(;    active::Real_CountFraction = FractionOf(0.2)) -> ActiveAssetsUncertaintyAlgorithm

Keywords correspond to the struct's fields. active is a CountOf of assets or a FractionOf of the universe. A plain number is read through count_or_fraction.

Validation

A search grid can turn a plain count into a fraction

A field that takes a CountOf or a FractionOf also takes a plain number, and count_or_fraction reads an Integer as a count and any other real number as a fraction. Julia promotes the elements of a vector literal to one type before the library reads them. So ["opt.ret.ucs.alg.method.active" => [3, 5, 8], "r.alpha" => [0.05, 0.1]] is a Vector{Pair{String, Vector{Float64}}}, and the counts arrive as 3.0, 5.0 and 8.0. The field then reads them as fractions, and the check of FractionOf refuses them. State the grid in the wrappers, such as [CountOf(3), CountOf(5), FractionOf(0.2)]. A wrapper keeps its type in every container.

Examples

julia> ActiveAssetsUncertaintyAlgorithm()ActiveAssetsUncertaintyAlgorithm  active ┼ FractionOf         │   val ┴ Float64: 0.2julia> ActiveAssetsUncertaintyAlgorithm(; active = CountOf(3)).activeCountOf  val ┴ Int64: 3

Related

References

  • [8] R. Zhou and D. P. Palomar. Understanding the Quintile Portfolio. IEEE Transactions on Signal Processing 68, 4030–4040 (2020).
source
PortfolioOptimisers.port_opt_view — Method
port_opt_view(
    risk_ucs::L1UncertaintySet,
    i,
    args...
) -> L1UncertaintySet

Return a view of an L1UncertaintySet restricted to the asset indices i.

The radius is one scalar budget for the universe, and the view keeps it unchanged. The view takes the entries of sd and mu at i, in the order of i. The restricted set then indexes the assets in the order that the optimiser gives.

Algorithm

  1. Take nothing_scalar_array_view(risk_ucs.sd, i), the scaling of the selected assets. A nothing stays nothing.
  2. Take nothing_scalar_array_view(risk_ucs.mu, i), the characteristic vector of the same assets. A nothing stays nothing.
  3. Build an L1UncertaintySet from risk_ucs.eps and the two views. The step does not rescale the radius, because the radius is the budget for the total error over the assets that the set covers.

Arguments

  • risk_ucs: $\ell_1$ uncertainty set.
  • i: Index of the cluster or of the assets.
  • args...: More positional arguments, which the method ignores.

Returns

  • risk_ucs::L1UncertaintySet: The set restricted to i.

Examples

julia> ucs = L1UncertaintySet(; eps = 0.5, sd = [0.1, 0.2, 0.3], mu = [0.05, 0.03, 0.01]);julia> PortfolioOptimisers.port_opt_view(ucs, [1, 3])L1UncertaintySet  eps ┼ Float64: 0.5   sd ┼ SubArray{Float64, 1, Vector{Float64}, Tuple{Vector{Int64}}, false}: [0.1, 0.3]   mu ┴ SubArray{Float64, 1, Vector{Float64}, Tuple{Vector{Int64}}, false}: [0.05, 0.01]

Related

source
PortfolioOptimisers.port_opt_view — Method
port_opt_view(
    risk_ucs::SignedL1UncertaintySet,
    i,
    args...
) -> SignedL1UncertaintySet

Return a view of a SignedL1UncertaintySet restricted to the asset indices i.

The two radii are scalar budgets for the universe, and the view keeps them unchanged. The view takes the entries of sd and mu at i, in the order of i. The restricted set then indexes the assets in the order that the optimiser gives.

Algorithm

  1. Take nothing_scalar_array_view(risk_ucs.sd, i), the scaling of the selected assets. A nothing stays nothing.
  2. Take nothing_scalar_array_view(risk_ucs.mu, i), the characteristic vector of the same assets. A nothing stays nothing.
  3. Rebuild the set from the two views with rebuild_struct. risk_ucs.ep and risk_ucs.en do not change. The step rescales neither radius, because each radius is the budget for the total error of its sign over the assets that the set covers.

Arguments

  • risk_ucs: Signed $\ell_1$ uncertainty set.
  • i: Index of the cluster or of the assets.
  • args...: More positional arguments, which the method ignores.

Returns

  • risk_ucs::SignedL1UncertaintySet: The set restricted to i.

Examples

julia> ucs = SignedL1UncertaintySet(; ep = 0.4, en = 0.6, sd = [0.1, 0.2, 0.3],                                    mu = [0.05, 0.03, 0.01]);julia> PortfolioOptimisers.port_opt_view(ucs, [1, 3])SignedL1UncertaintySet  ep ┼ Float64: 0.4  en ┼ Float64: 0.6  sd ┼ SubArray{Float64, 1, Vector{Float64}, Tuple{Vector{Int64}}, false}: [0.1, 0.3]  mu ┴ SubArray{Float64, 1, Vector{Float64}, Tuple{Vector{Int64}}, false}: [0.05, 0.01]

Related

source
PortfolioOptimisers.mu_ucs — Function
mu_ucs(ue::CharacteristicUncertaintySet, X::MatNum,
       F::Option{<:MatNum} = nothing; dims::Int = 1, kwargs...)
mu_ucs(ue::CharacteristicUncertaintySet{Nothing}, pr::AbstractPriorResult; rd = nothing, kwargs...)

Fits an $\ell_1$ uncertainty set on the characteristic vector, from returns data or from a Prior Result.

The two signatures are the two routes of a set with a pe field, and the two routes end in the same steps. The returns-data method fits ue.pe once through ucs_prior, which throws an ArgumentError when ue.pe is nothing. The method then gives the Prior Result to the prior-result method of the same set with pe = nothing. That method selects the shape of the set by dispatch on alg.

The prior-result method has a definition only for a set whose pe is nothing. Inside an optimiser, pr is the prior that the optimiser solves on. So the Radius Calibration reads the same mu as the objective.

The calibration reads the ranking, but the set keeps the order of the universe. mu and sd have one entry for each asset, in the order of the prior. The optimiser indexes the assets in that order, and port_opt_view takes its view in that order. Only the ladders read the sorted vector. A ladder is a list of radii, and it holds no index of an asset. The set holds $\hat{\boldsymbol{\mu}}$ in its mu field, so the consumer bounds the characteristic vector that the calibration read.

Algorithm

The returns-data method does step 1, and then it calls the prior-result method. The two prior-result methods do steps 2 to 5 and step 7 in the same way, and they do step 6 differently.

  1. Fit the prior pr with ucs_prior on ue.pe, X and F. Call the prior-result method of the set with pe = nothing.
  2. Reduce the Prior Result pr to the Investable Mask with investable_ucs_reduction to get prr. Inside an optimiser, pr is already reduced, and the step changes nothing. Outside an optimiser, on a prior fitted on a point-in-time Asset Panel, the step makes the reduction that an optimiser makes. The ranking then reads no NaN.
  3. Read alg = ue.alg, the shape algorithm.
  4. If alg.scaled is true, take sd = sqrt.(diag(prr.sigma)), the scaling of each asset. Else, take sd = nothing.
  5. Take idx = sortperm(prr.mu; rev = true), the ranking that sorts the characteristic in non-increasing order. Apply it to prr.mu and to sd.
  6. Find the radii with l1_resolve_eps on the sorted vectors. Build the set from the radii, with mu = prr.mu and sd in the order of the universe.
  7. Write the set back onto the full universe with expand_investable_ucs, and return it. A set fitted outside an optimiser then covers the same assets as the prior. A view of the set at the mask gives the reduced fit again.

For an L1UncertaintySetAlgorithm, step 6 finds the radius eps from alg.method and alg.paired, and builds an L1UncertaintySet.

For a SignedL1UncertaintySetAlgorithm, step 6 finds two radii on two ladders, and builds a SignedL1UncertaintySet. en comes from alg.mm on the sorted ranking. ep comes from alg.mp on the reversed, negated ranking, which is the bottom of the same ranking. Corollary 13 of [8] states this construction. Both calls pass paired = false, because the construction sets both ladders. The consumer multiplies en by $[\max_i (\sigma_i w_i)]_{+}$, and ep by $[\max_i (-\sigma_i w_i)]_{+}$. So en is the radius for the long leg and ep is the radius for the short leg, and each leg matches the end of the ranking that its calibration read.

Arguments

  • ue: Characteristic uncertainty set estimator.
  • X: Data matrix, such as the returns.
  • F: Factor matrix, or nothing. The prior estimator reads it.
  • dims: Dimension along which the computation runs.
  • pr: Prior Result for the calibration. The method reads pr.mu at the Investable Mask, and pr.sigma there when alg.scaled is true.
  • rd: Returns Result that the three-argument form gives with the prior. The method reduces it with the prior, and does not read it.
  • kwargs...: More keyword arguments, which the returns-data method gives to the prior estimator. The prior-result method ignores them.

Returns

  • mu_ucs::Union{L1UncertaintySet, SignedL1UncertaintySet}: The uncertainty set, on the full asset universe of pr.

Examples

julia> X = [0.1875 0.09375 0.0625            0.0625 0.03125 0.0];julia> alg = SignedL1UncertaintySetAlgorithm(; scaled = false);julia> mu_ucs(CharacteristicUncertaintySet(; alg = alg), X)SignedL1UncertaintySet  ep ┼ Float64: 0.015625  en ┼ Float64: 0.03125  sd ┼ nothing  mu ┴ Vector{Float64}: [0.125, 0.0625, 0.03125]

Related

References

  • [8] R. Zhou and D. P. Palomar. Understanding the Quintile Portfolio. IEEE Transactions on Signal Processing 68, 4030–4040 (2020).
source
PortfolioOptimisers.ucs — Function
ucs(ue::CharacteristicUncertaintySet, X::MatNum, F::Option{<:MatNum} = nothing; kwargs...)
sigma_ucs(ue::CharacteristicUncertaintySet, X::MatNum, F::Option{<:MatNum} = nothing; kwargs...)
ucs(ue::CharacteristicUncertaintySet{Nothing}, pr::AbstractPriorResult; kwargs...)
sigma_ucs(ue::CharacteristicUncertaintySet{Nothing}, pr::AbstractPriorResult; kwargs...)

Always throw an ArgumentError. CharacteristicUncertaintySet fits a set on the mean only.

The four methods have no procedure, so they have no # Algorithm section. The returns-data pair has the same (X, F) signature as the other families, not a catch-all signature. So the ReturnsResult methods of the base reach these methods with no ambiguity. The prior-result pair has the prior-result signature of the other families. So a set with no prior of its own reaches the same error through the three-argument route.

Arguments

  • ue: Characteristic uncertainty set estimator.
  • X: Data matrix, such as the returns. The methods ignore it.
  • F: Factor matrix, or nothing. The methods ignore it.
  • pr: Prior Result, which the methods ignore.
  • kwargs...: More keyword arguments, which the methods ignore.

Validation

  • All four methods always throw an ArgumentError. The $\ell_1$ set bounds a characteristic vector, such as the mean, and [8] defines no covariance analogue. So the methods have no covariance set to return. Each message names NormalUncertaintySet, DeltaUncertaintySet and ARCHUncertaintySet for a covariance set. The message of ucs also names mu_ucs for the mean set.

Returns

  • No method returns. Each method throws.

Related

References

  • [8] R. Zhou and D. P. Palomar. Understanding the Quintile Portfolio. IEEE Transactions on Signal Processing 68, 4030–4040 (2020).
source
PortfolioOptimisers.l1_resolve_eps — Function
l1_resolve_eps(method, mus::VecNum, sds::Option{<:VecNum}, paired::Bool)

Find the radius of a Num_UcSEps on the characteristic vector.

mus must be sorted in non-increasing order, and sds must have the same permutation. The method that takes a Number returns the radius that the caller gave. It has no procedure, so the # Algorithm and # Validation sections are not about it. The method that takes an ActiveAssetsUncertaintyAlgorithm calibrates the radius on the long-only ladder when paired is false, and on the paired ladder when paired is true.

Mathematical definition

The paired ladder is the sum of the ladder of the ranking and the ladder of the reversed, negated ranking. With $\sigma_i = 1$ it is the threshold of Lemma 6 of [8]. The scaled form adds the two scaled ladders of Corollary 13 of [8], which states them for two radii on $\mathcal{A}_2$. [8] states no lemma for one radius on the scaled set. So the scaled form is an extension of this library, and no lemma proves the number of active assets that it gives:

\[\begin{align} F_m &= \sum_{i=1}^{m} \frac{\hat{\mu}_i - \hat{\mu}_m}{\sigma_i} + \sum_{j=1}^{m} \frac{\hat{\mu}_{N-m+1} - \hat{\mu}_{N-j+1}}{\sigma_{N-j+1}}\,, \quad m = 1,\, \ldots,\, \left\lfloor N/2 \right\rfloor\,. \end{align}\]

Where:

  • $F_m$: Activation threshold of the $m$-th pair of one long asset and one short asset.
  • $\hat{\mu}_i$: $i$-th entry of the characteristic vector, sorted non-increasing.
  • $\sigma_i$: Scale factor of the $i$-th entry of the characteristic vector. It is $1$ when the set has no scaling.
  • $N$: Number of assets.

A radius in $(F_q,\, F_{q+1})$ makes the top $q$ assets long and the bottom $q$ assets short, so it activates $2q$ assets. Corollary 7 states this with $\sigma_i = 1$. Lemma 5, also with $\sigma_i = 1$, gives the reason that the ladder stops at $\lfloor N/2 \rfloor$. An optimal dollar-neutral solution satisfies $w_i = -w_{N+1-i}$. With an odd $N$, the middle asset is its own pair, so its weight satisfies $w = -w$ and the asset is never active. The largest count that the paired branch can reach is $2 \lfloor N/2 \rfloor$, which is $N-1$ when $N$ is odd.

Algorithm

  1. Check mus and sds, as # Validation states.
  2. Read N = length(mus), the size of the universe.
  3. If paired is false, build the long-only ladder with l1_activation_ladder, and convert method.active to a count with l1_active_count. Return the radius that l1_eps_from_ladder finds from the ladder and the count.
  4. Else, read half = N ÷ 2, the number of pairs that the universe has.
  5. Add the ladder of mus to the ladder of the reversed, negated ranking. Keep the first half entries as ladder, the paired ladder.
  6. Convert the target to a number of pairs with l1_active_pairs.
  7. Return the radius that l1_eps_from_ladder finds from ladder and the number of pairs.

Arguments

  • method: A radius as a Number, or an ActiveAssetsUncertaintyAlgorithm.
  • mus: Characteristic vector, sorted in non-increasing order.
  • sds: Scaling of each asset in the same permutation, or nothing.
  • paired: If true, the calibration reads the paired ladder. If false, it reads the long-only ladder.

Validation

  • all(isfinite, mus). Else, the method throws an IsNonFiniteError. A NaN entry makes every rung that reads it NaN, and the tie check of l1_eps_from_ladder then names the wrong cause. A prior fitted on a point-in-time Asset Panel has NaN outside its Investable Mask, and mu_ucs reduces it to the mask before the calibration.
  • If sds is not nothing: every entry is finite and > 0. Else, the method throws a DomainError. The ladder divides by each entry. A set can hold a zero scale, but the closed form of the radius cannot read one.
  • N ÷ 2 >= 1 when paired is true. Else, the method throws an ArgumentError. One asset cannot make a pair of a long asset and a short asset, so it has no paired ladder.

Returns

  • eps::Number: The radius.

Examples

julia> PortfolioOptimisers.l1_resolve_eps(0.25)0.25julia> alg = ActiveAssetsUncertaintyAlgorithm(; active = 2);julia> mus = [0.125, 0.0625, 0.03125, 0.0];julia> PortfolioOptimisers.l1_resolve_eps(alg, mus, nothing, false)0.09375julia> PortfolioOptimisers.l1_resolve_eps(alg, mus, nothing, true)0.046875

Related

References

  • [8] R. Zhou and D. P. Palomar. Understanding the Quintile Portfolio. IEEE Transactions on Signal Processing 68, 4030–4040 (2020).
source

References

[8]
R. Zhou and D. P. Palomar. Understanding the Quintile Portfolio. IEEE Transactions on Signal Processing 68, 4030–4040 (2020).