Bootstrap Uncertainty Sets

PortfolioOptimisers.BootstrapUncertaintySetEstimator — Type
abstract type BootstrapUncertaintySetEstimator <: AbstractUncertaintySetEstimator

Fits an uncertainty set from resamples of the return series, so that the set assumes no distribution for the returns.

All concrete subtypes must subtype BootstrapUncertaintySetEstimator. A subtype reads its bounds from the resamples, and not from a closed-form expression.

Interfaces

A subtype implements the three methods of AbstractUncertaintySetEstimator. It holds an ARCHBootstrapSet, which selects how the estimator draws the resamples.

Related

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

Selects how a block bootstrap draws its blocks of consecutive rows, which keep the serial dependence of the return series in the resample.

All concrete subtypes must subtype ARCHBootstrapSet. The library has three subtypes. They differ in the block length, in the wrap past the end of the series, and in the range of the start index. The table gives each scheme on these three axes.

SchemeBlock lengthWraps past the endStart range
StationaryBootstrapgeometric, restart probability 1 / block_sizeyes, by mod11:T
CircularBootstrapfixed block_sizeyes, by mod11:T
MovingBootstrapfixed block_sizeno1:(T - block_size + 1)

The wrap column decides if the scheme draws every observation equally often. The two schemes that wrap draw each of the T observations equally often. MovingBootstrap does not wrap, so it draws the first and the last observations of the series less often than the middle ones. Its docstring gives the measured rates.

Interfaces

To add a new scheme, subtype ARCHBootstrapSet and implement this method:

bootstrap_indices

  • bootstrap_indices(alg::ARCHBootstrapSet, rng::Random.AbstractRNG, T::Integer, block_size::Integer) -> Vector{Int}: Returns the row indices of one resample.

Arguments

  • alg: The concrete subtype instance.
  • rng: Random number generator.
  • T: Number of observations in the sample that the method resamples.
  • block_size: Block length, or the mean block length if the length is random.

Returns

  • idx::Vector{Int}: T indices in 1:T, which select the rows of one resample.

Related

source
PortfolioOptimisers.StationaryBootstrap — Type
struct StationaryBootstrap <: ARCHBootstrapSet

Draws blocks of random length with a geometric distribution, so that the resample is a stationary series.

A block starts anywhere in 1:T. Each next index is the previous index plus one, taken by mod1, so a block wraps past the end of the series. At each index, a new block starts with probability 1 / block_size. So the block length is geometric with mean block_size.

Over 101170 blocks at block_size = 10, the measured mean length is 9.884. The measured frequencies [0.101, 0.0921, 0.082, 0.0733, 0.0671, 0.0584] of the lengths 1:6 agree with the geometric masses [0.1, 0.09, 0.081, 0.0729, 0.0656, 0.059]. The mean is a little below block_size, because the last block of an index vector stops at T.

A block wraps, so the scheme draws every observation equally often. block_size is a mean and not a bound, so a block_size larger than T raises no error. The restart probability is then below 1 / T, and the index vector is almost one wrapped block. The spread becomes smaller, but not zero. Over 250 resamples of a 252-by-5 sample, the standard deviation of the bootstrap means at block_size = T + 1 is 0.377 of the value at block_size = 3.

Related

References

  • [175] D. N. Politis and J. P. Romano. The stationary bootstrap. Journal of the American Statistical Association 89, 1303–1313 (1994). Section 2.
source
PortfolioOptimisers.CircularBootstrap — Type
struct CircularBootstrap <: ARCHBootstrapSet

Draws blocks of fixed length block_size that wrap past the end of the series, so that the scheme draws every observation equally often.

A block starts anywhere in 1:T and holds the next block_size indices, each taken by mod1. So the scheme reads the series as a circle, and the wrap gives the equal rates. Over 20000 index vectors at T = 100 and block_size = 5, the scheme draws every observation between 0.985 and 1.015 times the mean rate. Under MovingBootstrap, the rate of the first observation is 0.192 of the middle rate.

A block_size of T or more gives a set of zero width. The first block fills the whole index vector, so every resample is a cyclic shift of the series. A cyclic shift is a permutation of the rows, and a permutation of the rows does not change the mean or the covariance. So every resample gives the same statistics, and the box width and the ellipsoidal shape matrix are zero to within rounding error. The library raises no error, because the constructor does not know T.

Related

References

  • [176] D. N. Politis and J. P. Romano. A circular block-resampling procedure for stationary data. In: Exploring the Limits of Bootstrap (John Wiley & Sons, 1992); pp. 263–270. Section 2.
source
PortfolioOptimisers.MovingBootstrap — Type
struct MovingBootstrap <: ARCHBootstrapSet

Draws blocks of fixed length block_size that do not wrap, so that no block joins the end of the series to its start.

A block starts in 1:(T - block_size + 1) and holds the next block_size indices, so the last index of a block is never above T. This scheme is the only one of the three that checks block_size, and it is the only one that needs the check. If block_size is larger than T, the start range is empty. Without the check, rand raises an ArgumentError about an empty range. The check raises a DomainError that names block_size and T. The two schemes that wrap take every index through mod1, which cannot leave 1:T, so they need no check.

Without the wrap, the scheme draws the observations at different rates. For j up to block_size, only j start positions give a block that holds observation j. So the scheme draws observation j about j / block_size as often as a middle observation, and the last block_size observations have the same ramp in the opposite order. At T = 100 and block_size = 5, the measured rates of the first five observations are 0.192, 0.392, 0.594, 0.791 and 0.987 of the middle rate. Use CircularBootstrap if you do not want this asymmetry.

Section 2.3 of [177] assumes that block_size divides T. This scheme does not make that assumption, and its last block stops at T.

Related

References

  • [177] H. R. Künsch. The jackknife and the bootstrap for general stationary observations. The Annals of Statistics 17, 1217–1241 (1989). Section 2.3, Equation 2.7.
source
PortfolioOptimisers.ARCHUncertaintySet — Type
struct ARCHUncertaintySet{__T_pe, __T_ce, __T_me, __T_alg, __T_n_sim, __T_block_size, __T_q, __T_rng, __T_seed, __T_bootstrap, __T_kwargs} <: BootstrapUncertaintySetEstimator

Fits a box, an ellipsoidal or a norm-ball uncertainty set from the spread of the statistics over block bootstrap resamples of the return series.

The method is the bootstrap method of Equation 11.18 of [12], and it assumes no distribution for the returns. Section 4 of [178] is the first work to read the bounds of a box from the percentiles of bootstrap means and covariances. That work resamples single observations, and it uses the percentile interval of the mean with no centre. Equation 11.18 of [12] resamples blocks, and it puts the half-width of the interval on the point estimate. Its Listing 11.11 builds the ellipsoid from the same resamples.

The bootstrap field selects one of the three block bootstraps. The library implements all three in bootstrap_indices, and the docstring of each bootstrap type cites the work that defines it.

The name does not refer to a volatility model. It comes from the bootstrap module of the Python package arch, which fits volatility models, but this type fits no such model. It refits me and ce on each resample, and it reads the spread of the refits.

The centre and the bounds come from different estimators, and the library does not make them agree. pe fits the centre val, and me and ce fit the bounds on the resamples. If the two disagree, a box does not always contain its own centre. Take pe = EmpiricalPrior(), me = MedianExpectedReturns(), block_size = 3 and seed = 987654321. Over 250 resamples of a 252-by-5 sample, the val of one asset is -0.000934, which is above its ub of -0.001007.

On the mean axis, the consumer reads only val and the half-width (ub - lb) / 2. So the consumer ignores the asymmetry, and the set has the centre of the prior and the width of the bootstrap. On the covariance axis, the consumer reads both bounds, and it does not read val.

ce enters the ellipsoidal covariance axis twice. It fits the covariance of every resample, and then it fits the shape matrix over the deviations of those covariances. The mean axis uses ce once, over the mean deviations. A ce with no bias correction changes the resampled covariances by 0.397% over 252 observations. It changes the shape matrix of the covariance axis by 1.784% over 100 resamples, and the shape matrix of the mean axis by exactly 1.0%.

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.
  • ce: Covariance estimator.
  • me: Expected returns estimator.
  • alg: Uncertainty set algorithm.
  • n_sim: Number of simulation samples.
  • block_size: Block length of the bootstrap. For StationaryBootstrap, it is the mean block length.
  • q: Significance level that sets the size of the uncertainty set, with 0 < q < 1. A smaller q gives a larger set, with wider box intervals or a larger radius. A larger q gives a smaller set, nearer to the point estimate.
  • rng: Random number generator.
  • seed: Optional seed. If set, the draws come from a copy of rng seeded with it, so rng does not advance and every call draws the same values. If nothing, the draws come from rng itself.
  • bootstrap: Block bootstrap scheme, which selects how the estimator draws the blocks.
  • kwargs: More keyword arguments.

Constructors

ARCHUncertaintySet(;    pe::Option{<:AbstractLowOrderPriorEstimator} = EmpiricalPrior(),    ce::StatsBase.CovarianceEstimator = PortfolioOptimisersCovariance(),    me::AbstractExpectedReturnsEstimator = SimpleExpectedReturns(),    alg::AbstractUncertaintySetAlgorithm = BoxUncertaintySetAlgorithm(),    n_sim::Integer = 3_000,    block_size::Integer = 3,    q::Number = 0.05,    rng::Random.AbstractRNG = Random.default_rng(),    seed::Option{<:Integer} = nothing,    bootstrap::ARCHBootstrapSet = StationaryBootstrap(),    kwargs::NamedTuple = (;),) -> ARCHUncertaintySet

The keywords are the fields of the struct.

Validation

Examples

julia> ARCHUncertaintySet()ARCHUncertaintySet          pe ┼ EmpiricalPrior             │           ce ┼ PortfolioOptimisersCovariance             │              │   ce ┼ Covariance             │              │      │    me ┼ SimpleExpectedReturns             │              │      │       │   w ┴ nothing             │              │      │    ce ┼ GeneralCovariance             │              │      │       │   ce ┼ StatsBase.SimpleCovariance: StatsBase.SimpleCovariance(true)             │              │      │       │    w ┴ nothing             │              │      │   alg ┼ FullMoment()             │              │      │     w ┴ nothing             │              │   mp ┼ MatrixProcessing             │              │      │     pdm ┼ Posdef             │              │      │         │      alg ┼ UnionAll: NearestCorrelationMatrix.Newton             │              │      │         │   kwargs ┴ @NamedTuple{}: NamedTuple()             │              │      │      dn ┼ nothing             │              │      │      dt ┼ nothing             │              │      │     alg ┼ nothing             │              │      │   order ┴ NTuple{4, Symbol}: (:pdm, :dn, :dt, :alg)             │           me ┼ SimpleExpectedReturns             │              │   w ┴ nothing             │      horizon ┼ nothing             │   fill_limit ┼ nothing             │        x_src ┴ nothing          ce ┼ PortfolioOptimisersCovariance             │   ce ┼ Covariance             │      │    me ┼ SimpleExpectedReturns             │      │       │   w ┴ nothing             │      │    ce ┼ GeneralCovariance             │      │       │   ce ┼ StatsBase.SimpleCovariance: StatsBase.SimpleCovariance(true)             │      │       │    w ┴ nothing             │      │   alg ┼ FullMoment()             │      │     w ┴ nothing             │   mp ┼ MatrixProcessing             │      │     pdm ┼ Posdef             │      │         │      alg ┼ UnionAll: NearestCorrelationMatrix.Newton             │      │         │   kwargs ┴ @NamedTuple{}: NamedTuple()             │      │      dn ┼ nothing             │      │      dt ┼ nothing             │      │     alg ┼ nothing             │      │   order ┴ NTuple{4, Symbol}: (:pdm, :dn, :dt, :alg)          me ┼ SimpleExpectedReturns             │   w ┴ nothing         alg ┼ BoxUncertaintySetAlgorithm()       n_sim ┼ Int64: 3000  block_size ┼ Int64: 3           q ┼ Float64: 0.05         rng ┼ Random.TaskLocalRNG: Random.TaskLocalRNG()        seed ┼ nothing   bootstrap ┼ StationaryBootstrap()      kwargs ┴ @NamedTuple{}: NamedTuple()

Related

References

  • [178] R. H. Tütüncü and M. Koenig. Robust Asset Allocation. Annals of Operations Research 132, 157–187 (2004). Sections 2.1 and 4, Equations 4 and 5.
  • [12] D. Cajas. Advanced Portfolio Optimization: A Cutting-edge Quantitative Approach (Springer Nature Switzerland, 2025). Equation 11.18 and Listing 11.11. The original source of this formulation was not found. The formulation follows this work and is not checked against the original.
source
PortfolioOptimisers.bootstrap_indices — Function
bootstrap_indices(alg::ARCHBootstrapSet, rng::Random.AbstractRNG, T::Integer,
                  block_size::Integer)

Makes the vector of T observation indices for one resample of a block bootstrap.

The three methods put blocks of consecutive indices one after the other until the vector holds T indices. They differ only in the block length, in the wrap past the end of the series, and in the range of the start index. ARCHBootstrapSet gives the three axes in a table.

Algorithm

Julia selects the method on the type of alg. Each procedure below is one of the three methods.

StationaryBootstrap

  1. Set the restart probability p to inv(block_size).
  2. Draw idx[1] uniformly from 1:T. This starts the first block.
  3. For each later t, draw one uniform variate. If the variate is below p, draw idx[t] uniformly from 1:T, which starts a new block. If not, set idx[t] to mod1(idx[t - 1] + 1, T). This continues the block, and wraps it past the end of the series.
  4. Return idx. Step 3 makes the block length geometric with mean block_size. For each value of block_size, mod1 keeps every index in 1:T.

CircularBootstrap

  1. Set the fill position t to zero.
  2. While t is below T, draw a start s uniformly from 1:T.
  3. Fill the next min(block_size, T - t) entries with mod1(s + k, T), for k from zero. This puts one block in the vector, and wraps it past the end of the series. If fewer than block_size entries are free, the last block of the vector is shorter.
  4. Increase t by block_size. Go back to step 2 while t is below T.
  5. Return idx. mod1 keeps every index in 1:T, so this method needs no check on block_size.

MovingBootstrap

  1. Make sure that block_size is not larger than T. If it is larger, raise a DomainError, because step 3 then has an empty range.
  2. Set the fill position t to zero.
  3. While t is below T, draw a start s uniformly from 1:(T - block_size + 1). The upper end is the last start whose block ends at or before T.
  4. Fill the next min(block_size, T - t) entries with s + k, for k from zero. This puts one block in the vector, with no wrap. If fewer than block_size entries are free, the last block of the vector is shorter.
  5. Increase t by block_size. Go back to step 3 while t is below T.
  6. Return idx. The range of step 3 keeps s + k at or below T, so no index leaves 1:T.

Arguments

  • alg: Bootstrap scheme. Its type selects the method.
  • rng: Random number generator.
  • T: Number of observations in the sample that the method resamples.
  • block_size: Block length. It is the mean block length for StationaryBootstrap, and the fixed block length for the other two schemes.

Validation

  • MovingBootstrap needs block_size <= T, and raises a DomainError otherwise. The other two methods accept a block_size larger than T with no error. The docstring of each type states the result.

Returns

  • idx::Vector{Int}: Indices in 1:T that select the rows of one resample.

Related

References

  • [175] D. N. Politis and J. P. Romano. The stationary bootstrap. Journal of the American Statistical Association 89, 1303–1313 (1994). Section 2.
  • [176] D. N. Politis and J. P. Romano. A circular block-resampling procedure for stationary data. In: Exploring the Limits of Bootstrap (John Wiley & Sons, 1992); pp. 263–270. Section 2.
  • [177] H. R. Künsch. The jackknife and the bootstrap for general stationary observations. The Annals of Statistics 17, 1217–1241 (1989). Section 2.3, Equation 2.7.
source
PortfolioOptimisers.ucs — Function
ucs(ue::ARCHUncertaintySet, X::MatNum,
    F::Option{<:MatNum} = nothing; dims::Int = 1, kwargs...)
mu_ucs(ue::ARCHUncertaintySet, X::MatNum,
       F::Option{<:MatNum} = nothing; dims::Int = 1, kwargs...)
sigma_ucs(ue::ARCHUncertaintySet, X::MatNum,
          F::Option{<:MatNum} = nothing; dims::Int = 1, kwargs...)

Fits the sets of an ARCHUncertaintySet from returns data, through a fit of the prior of the set.

These are the returns-data methods of the three verbs. Each verb has one such method for all three shapes, because the next call selects the shape. Each method fits ue.pe once through ucs_prior. It then gives the Prior Result to the prior-result method of the same verb, on the same set with pe = nothing. That method selects the box, the ellipsoid or the norm ball on the type of ue.alg.

The method resamples the X of that Prior Result. So a set with a prior of its own fits on that prior, and the prior fits on the returns that the caller gives. The keyword arguments go to the prior fit and to the estimators of the resamples.

Algorithm

  1. Fit the prior with ucs_prior on ue.pe, X and F to get pr.
  2. Give pr to the prior-result method of the verb, on the set with pe = nothing. That method builds the set of the shape that ue.alg names.

Arguments

  • ue: ARCH uncertainty set estimator.
  • X: Matrix of asset returns.
  • F: Optional matrix of factor returns, which a factor prior needs.
  • dims: Dimension along which the computation runs.
  • kwargs...: More keyword arguments, which the method gives to the prior estimator, ue.me and ue.ce.

Validation

  • ue.pe is not nothing. Otherwise ucs_prior raises an ArgumentError that names the prior-result calls.

Returns

  • mu_ucs::AbstractUncertaintySetResult: Uncertainty set of the expected returns, from mu_ucs.
  • sigma_ucs::AbstractUncertaintySetResult: Uncertainty set of the covariance, from sigma_ucs.
  • (mu_ucs, sigma_ucs): Both sets, from ucs.

Related

source
PortfolioOptimisers.ucs — Method
ucs(ue::ARCHUncertaintySet{Nothing, <:Any, <:Any, <:BoxUncertaintySetAlgorithm, <:Any, <:Any,
                           <:Any, <:Any, <:Any}, pr::AbstractPriorResult; rd = nothing, kwargs...)

Fits the box uncertainty sets of the expected returns and the covariance from block bootstrap resamples of the returns.

This is the prior-result method of the verb. Only a set whose pe is nothing has it. Inside an optimiser, pr is the prior that the optimiser solves on. The set then has the same centre as the objective, and the method resamples the rows of that prior. Outside an optimiser, give pr = prior(pe, X). The returns-data method of the same verb fits the prior of the set through ucs_prior and calls this method.

Both sets come from one pass over one index stream, so the mean and the covariance of a simulation come from the same resample. If ue.seed is set, this method and the pair mu_ucs and sigma_ucs return the same bounds bit for bit. The reason is that resolve_rng starts each call at the same place of one index stream. If ue.seed is nothing, the bounds differ. Over 200 resamples of a 252-by-5 sample, the lower bound of the mean changed by 5.31e-4, and the width of the set is 9.53e-3. So a caller who splits one ucs call into two calls gets the same answer only if a seed is set.

Mathematical definition

The method fits $\hat{\boldsymbol{\mu}}^{(m)}$ and $\hat{\mathbf{\Sigma}}^{(m)}$ on each of the $M$ resamples. The bounds are the quantiles of each entry:

\[\begin{align} \mu_{lb,i} &= Q_{q/2}\!\left(\hat{\mu}^{(m)}_i\right)\,, \\ \mu_{ub,i} &= Q_{1-q/2}\!\left(\hat{\mu}^{(m)}_i\right)\,. \end{align}\]

\[\begin{align} (\mathbf{\Sigma}_{lb})_{ij} &= Q_{q/2}\!\left(\hat{\Sigma}^{(m)}_{ij}\right)\,, \\ (\mathbf{\Sigma}_{ub})_{ij} &= Q_{1-q/2}\!\left(\hat{\Sigma}^{(m)}_{ij}\right)\,. \end{align}\]

Where:

  • $\mu_{lb,i}$, $\mu_{ub,i}$: Lower and upper bounds of the expected return of asset $i$.
  • $(\mathbf{\Sigma}_{lb})_{ij}$, $(\mathbf{\Sigma}_{ub})_{ij}$: Lower and upper bounds of the covariance entry $(i,j)$.
  • $Q_{q/2}$, $Q_{1-q/2}$: Quantile functions at the levels $q/2$ and $1-q/2$.
  • $\hat{\mu}^{(m)}_i$: Bootstrap mean of asset $i$ in resample $m$.
  • $\hat{\Sigma}^{(m)}_{ij}$: Bootstrap covariance entry $(i,j)$ in resample $m$.
  • $q$: Significance level.

Algorithm

  1. Reduce the Prior Result to the Investable Mask with investable_ucs_reduction. Inside an optimiser, the result 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.
  2. Take X from the reduced Prior Result. The method resamples this X, so under a Scenario Cap it resamples only the rows that the prior keeps.
  3. Draw the resampled statistics with bootstrap_generator to get mus and sigmas from one index stream.
  4. Halve ue.q to get the tail mass q of each side of a bound.
  5. Take the quantiles of each entry of mus with vec_quantile_bounds to get mu_l and mu_u.
  6. Take the quantiles of each entry of sigmas with box_quantile_bounds to get sigma_l and sigma_u.
  7. Build the two BoxUncertaintySet values. The bounds come from steps 5 and 6. The centres val are the mu and the sigma of the reduced Prior Result. So a set does not always contain its own centre.
  8. Write both sets back onto the full universe with expand_investable_ucs, and return them. 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.

Arguments

  • ue: ARCH uncertainty set estimator. The centres val come from pr, and ue.me and ue.ce fit the bounds on the resamples. So the centres and the bounds can disagree.
  • pr: Prior Result that the set fits on. The method resamples pr.X.
  • rd: Returns Result that the three-argument form gives beside the prior. The reduction takes a view of it, and the method does not use the view.
  • kwargs...: More keyword arguments, which the method gives to ue.me and ue.ce.

Returns

  • mu_ucs::BoxUncertaintySet: Box of the expected returns.
  • sigma_ucs::BoxUncertaintySet: Box of the covariance.

Related

source
PortfolioOptimisers.ucs — Method
ucs(ue::ARCHUncertaintySet{Nothing, <:Any, <:Any, <:EllipsoidalUncertaintySetAlgorithm, <:Any, <:Any,
                           <:Any, <:Any, <:Any}, pr::AbstractPriorResult; rd = nothing, kwargs...)

Fits the ellipsoidal uncertainty sets of the expected returns and the covariance from block bootstrap resamples of the returns.

This is the prior-result method of the verb. Only a set whose pe is nothing has it. Inside an optimiser, pr is the prior that the optimiser solves on. The set then has the same centre as the objective, and the method resamples the rows of that prior. Outside an optimiser, give pr = prior(pe, X). The returns-data method of the same verb fits the prior of the set through ucs_prior and calls this method.

Both sets come from one pass over one index stream. The shape matrices are the empirical covariances of the bootstrap deviations, and ue.ce fits them. So ue.ce enters the covariance axis twice. It fits every resample, and then it fits the deviations of the resampled covariances. The mean axis uses ue.ce once, over the mean deviations.

If ue.seed is set, this method and the pair mu_ucs and sigma_ucs give the same sets. If ue.seed is nothing, they do not.

Mathematical definition

The bootstrap deviations are $\boldsymbol{\delta}_{\mu}^{(m)} = \hat{\boldsymbol{\mu}}^{(m)} - \hat{\boldsymbol{\mu}}$ and $\boldsymbol{\delta}_{\Sigma}^{(m)} = \operatorname{vec}(\hat{\mathbf{\Sigma}}^{(m)} - \hat{\mathbf{\Sigma}})$. Their empirical covariances are:

\[\begin{align} \mathbf{\Sigma}_{\mu} &= \operatorname{Cov}\!\left(\boldsymbol{\delta}_{\mu}^{(m)}\right)\,, \\ \mathbf{\Sigma}_{\Sigma} &= \operatorname{Cov}\!\left(\boldsymbol{\delta}_{\Sigma}^{(m)}\right)\,. \end{align}\]

The ellipsoidal sets are:

\[\begin{align} \mathcal{E}_{\mu} &= \left\{\boldsymbol{\mu} : (\boldsymbol{\mu} - \hat{\boldsymbol{\mu}})^{\intercal} \mathbf{\Sigma}_{\mu}^{-1} (\boldsymbol{\mu} - \hat{\boldsymbol{\mu}}) \leq k_{\mu}^2\right\}\,. \end{align}\]

\[\begin{align} \mathcal{E}_{\Sigma} &= \left\{\mathbf{\Sigma} : \left\lVert \mathbf{\Sigma}_{\Sigma}^{-1/2} \operatorname{vec}(\mathbf{\Sigma} - \hat{\mathbf{\Sigma}}) \right\rVert_2 \leq k_{\Sigma}\right\}\,. \end{align}\]

Where:

  • $\mathbf{\Sigma}_{\mu}$: Empirical covariance of the bootstrap deviations of the mean.
  • $\mathbf{\Sigma}_{\Sigma}$: Empirical covariance of the vectorised bootstrap deviations of the covariance.
  • $\hat{\boldsymbol{\mu}}$, $\hat{\mathbf{\Sigma}}$: Estimated mean vector and covariance matrix.
  • $\boldsymbol{\delta}_{\mu}^{(m)}$, $\boldsymbol{\delta}_{\Sigma}^{(m)}$: Bootstrap deviations of the mean and of the covariance.
  • $\mathcal{E}_{\mu}$: Ellipsoidal uncertainty set of the expected returns.
  • $\mathcal{E}_{\Sigma}$: Ellipsoidal uncertainty set of the covariance.
  • $k_{\mu}$, $k_{\Sigma}$: Radii of the two sets. k_ucs fits each radius from ue.alg.method at the level ue.q.

Algorithm

  1. Reduce the Prior Result to the Investable Mask with investable_ucs_reduction. Inside an optimiser, the result 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.
  2. Take X from the reduced Prior Result. The method resamples this X, so under a Scenario Cap it resamples only the rows that the prior keeps.
  3. Draw the resampled statistics with bootstrap_generator to get mus and sigmas from one index stream.
  4. Subtract the mu of the reduced Prior Result from each column of mus to get X_mu. Subtract its vectorised sigma from each slice of sigmas to get X_sigma. Transpose both, so that each row is one simulation. The subtraction writes into mus and sigmas, so the method holds no second copy of the resamples.
  5. Fit ue.ce on X_mu to get the shape matrix sigma_mu. This is the only fit of ue.ce on the mean axis. The shape is empirical, and no asymptotic formula enters.
  6. Fit ue.ce on X_sigma to get the shape matrix sigma_sigma. This is the second fit of ue.ce on the covariance axis.
  7. Build both sets with bootstrap_ellipsoidal_set. It fits each radius k at the level ue.q, with the degrees of freedom capped at ue.n_sim - 1.
  8. Write both sets back onto the full universe with expand_investable_ucs, and return them. 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.

Arguments

  • ue: ARCH uncertainty set estimator. ue.ce fits the covariance of every resample and the shape matrix over the deviations. So it enters the covariance axis twice and the mean axis once. The centres come from pr, and ue.me and ue.ce fit the spread, so the centres and the spread can disagree.
  • pr: Prior Result that the set fits on. The method resamples pr.X.
  • rd: Returns Result that the three-argument form gives beside the prior. The reduction takes a view of it, and the method does not use the view.
  • kwargs...: More keyword arguments, which the method gives to ue.me and ue.ce.

Returns

  • mu_ucs::EllipsoidalUncertaintySet: Ellipsoid of the expected returns.
  • sigma_ucs::EllipsoidalUncertaintySet: Ellipsoid of the covariance.

Related

source
PortfolioOptimisers.mu_ucs — Method
mu_ucs(ue::ARCHUncertaintySet{Nothing, <:Any, <:Any, <:BoxUncertaintySetAlgorithm, <:Any, <:Any,
                              <:Any, <:Any, <:Any}, pr::AbstractPriorResult; rd = nothing, kwargs...)

Fits the box uncertainty set of the expected returns from block bootstrap resamples of the returns.

This is the prior-result method of the verb. Only a set whose pe is nothing has it. Inside an optimiser, pr is the prior that the optimiser solves on. The set then has the same centre as the objective, and the method resamples the rows of that prior. Outside an optimiser, give pr = prior(pe, X). The returns-data method of the same verb fits the prior of the set through ucs_prior and calls this method.

The method draws its own index stream. If ue.seed is set, it returns the same bounds as the mean set of ucs, bit for bit, because resolve_rng starts each call at the same place. If ue.seed is nothing, the bounds differ. Over 200 resamples of a 252-by-5 sample, the lower bound changed by 5.31e-4, and the width of the set is 9.53e-3.

Mathematical definition

\[\begin{align} \mu_{lb,i} &= Q_{q/2}\!\left(\hat{\mu}^{(m)}_i\right)\,, \\ \mu_{ub,i} &= Q_{1-q/2}\!\left(\hat{\mu}^{(m)}_i\right)\,. \end{align}\]

Where:

  • $\mu_{lb,i}$, $\mu_{ub,i}$: Lower and upper bounds of the expected return of asset $i$.
  • $Q_{q/2}$, $Q_{1-q/2}$: Quantile functions at the levels $q/2$ and $1-q/2$.
  • $\hat{\mu}^{(m)}_i$: Bootstrap mean of asset $i$ in resample $m$.
  • $q$: Significance level.

Algorithm

  1. Reduce the Prior Result to the Investable Mask with investable_ucs_reduction. Inside an optimiser, the result 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.
  2. Take X from the reduced Prior Result. The method resamples this X, so under a Scenario Cap it resamples only the rows that the prior keeps.
  3. Draw the resampled means with mu_bootstrap_generator to get mus. This method fits no covariance, so it does not read ue.ce.
  4. Halve ue.q to get the tail mass q of each side of a bound.
  5. Take the quantiles of each entry of mus with vec_quantile_bounds to get mu_l and mu_u.
  6. Build the BoxUncertaintySet. The bounds come from step 5, and the centre val is the mu of the reduced Prior Result. So the set does not always contain its own centre.
  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.

Arguments

  • ue: ARCH uncertainty set estimator. The centre val comes from pr, and ue.me fits the bounds on the resamples. So the centre and the bounds can disagree.
  • pr: Prior Result that the set fits on. The method resamples pr.X.
  • rd: Returns Result that the three-argument form gives beside the prior. The reduction takes a view of it, and the method does not use the view.
  • kwargs...: More keyword arguments, which the method gives to ue.me.

Returns

  • mu_ucs::BoxUncertaintySet: Box of the expected returns.

Related

source
PortfolioOptimisers.mu_ucs — Method
mu_ucs(ue::ARCHUncertaintySet{Nothing, <:Any, <:Any, <:EllipsoidalUncertaintySetAlgorithm, <:Any, <:Any,
                              <:Any, <:Any, <:Any}, pr::AbstractPriorResult; rd = nothing, kwargs...)

Fits the ellipsoidal uncertainty set of the expected returns from block bootstrap resamples of the returns.

This is the prior-result method of the verb. Only a set whose pe is nothing has it. Inside an optimiser, pr is the prior that the optimiser solves on. The set then has the same centre as the objective, and the method resamples the rows of that prior. Outside an optimiser, give pr = prior(pe, X). The returns-data method of the same verb fits the prior of the set through ucs_prior and calls this method.

The shape matrix is the empirical covariance of the bootstrap deviations of the mean, and ue.ce fits it. So ue.ce enters this axis once, although the method fits no covariance on a resample. If ue.seed is set, the method returns the same set as the mean set of ucs. If ue.seed is nothing, it does not.

Mathematical definition

\[\begin{align} \mathbf{\Sigma}_{\mu} &= \operatorname{Cov}\!\left(\hat{\boldsymbol{\mu}}^{(m)} - \hat{\boldsymbol{\mu}}\right)\,, \\ \mathcal{E}_{\mu} &= \left\{\boldsymbol{\mu} : (\boldsymbol{\mu} - \hat{\boldsymbol{\mu}})^{\intercal} \mathbf{\Sigma}_{\mu}^{-1} (\boldsymbol{\mu} - \hat{\boldsymbol{\mu}}) \leq k_{\mu}^2\right\}\,. \end{align}\]

Where:

  • $\mathbf{\Sigma}_{\mu}$: Empirical covariance of the bootstrap deviations of the mean.
  • $\hat{\boldsymbol{\mu}}$: Estimated mean vector.
  • $\mathcal{E}_{\mu}$: Ellipsoidal uncertainty set of the expected returns.
  • $k_{\mu}$: Radius of the set. k_ucs fits it from ue.alg.method at the level ue.q.

Algorithm

  1. Reduce the Prior Result to the Investable Mask with investable_ucs_reduction. Inside an optimiser, the result 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.
  2. Take X from the reduced Prior Result. The method resamples this X, so under a Scenario Cap it resamples only the rows that the prior keeps.
  3. Draw the resampled means with mu_bootstrap_generator to get mus.
  4. Subtract the mu of the reduced Prior Result from each column of mus to get the deviation matrix X_mu. Transpose it, so that each row is one simulation. The subtraction writes into mus, so the method holds no second copy of the resamples.
  5. Fit ue.ce on X_mu to get the shape matrix sigma_mu. The shape is empirical, and no asymptotic formula enters.
  6. Build the set with bootstrap_ellipsoidal_set. It fits the radius k at the level ue.q, with the degrees of freedom capped at ue.n_sim - 1.
  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.

Arguments

  • ue: ARCH uncertainty set estimator. ue.me fits the mean of every resample, and ue.ce fits the shape matrix over the deviations.
  • pr: Prior Result that the set fits on. The method resamples pr.X.
  • rd: Returns Result that the three-argument form gives beside the prior. The reduction takes a view of it, and the method does not use the view.
  • kwargs...: More keyword arguments, which the method gives to ue.me.

Returns

  • mu_ucs::EllipsoidalUncertaintySet: Ellipsoid of the expected returns.

Related

source
PortfolioOptimisers.sigma_ucs — Method
sigma_ucs(ue::ARCHUncertaintySet{Nothing, <:Any, <:Any, <:BoxUncertaintySetAlgorithm, <:Any, <:Any,
                                 <:Any, <:Any, <:Any}, pr::AbstractPriorResult; rd = nothing, kwargs...)

Fits the box uncertainty set of the covariance from block bootstrap resamples of the returns.

This is the prior-result method of the verb. Only a set whose pe is nothing has it. Inside an optimiser, pr is the prior that the optimiser solves on. The set then has the same centre as the objective, and the method resamples the rows of that prior. Outside an optimiser, give pr = prior(pe, X). The returns-data method of the same verb fits the prior of the set through ucs_prior and calls this method.

The method draws its own index stream. If ue.seed is set, it returns the same bounds as the covariance set of ucs, bit for bit, because resolve_rng starts each call at the same place. If ue.seed is nothing, the bounds differ. Over 200 resamples of a 252-by-5 sample, the lower bound changed by 2.12e-5.

Mathematical definition

\[\begin{align} (\mathbf{\Sigma}_{lb})_{ij} &= Q_{q/2}\!\left(\hat{\Sigma}^{(m)}_{ij}\right)\,, \\ (\mathbf{\Sigma}_{ub})_{ij} &= Q_{1-q/2}\!\left(\hat{\Sigma}^{(m)}_{ij}\right)\,. \end{align}\]

Where:

  • $(\mathbf{\Sigma}_{lb})_{ij}$, $(\mathbf{\Sigma}_{ub})_{ij}$: Lower and upper bounds of the covariance entry $(i,j)$.
  • $Q_{q/2}$, $Q_{1-q/2}$: Quantile functions at the levels $q/2$ and $1-q/2$.
  • $\hat{\Sigma}^{(m)}_{ij}$: Bootstrap covariance entry $(i,j)$ in resample $m$.
  • $q$: Significance level.

Algorithm

  1. Reduce the Prior Result to the Investable Mask with investable_ucs_reduction. Inside an optimiser, the result 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.
  2. Take X from the reduced Prior Result. The method resamples this X, so under a Scenario Cap it resamples only the rows that the prior keeps.
  3. Draw the resampled covariances with sigma_bootstrap_generator to get sigmas. This method fits no mean, so it does not read ue.me.
  4. Halve ue.q to get the tail mass q of each side of a bound.
  5. Take the quantiles of each entry of sigmas with box_quantile_bounds to get sigma_l and sigma_u.
  6. Build the BoxUncertaintySet. The bounds come from step 5, and the centre val is the sigma of the reduced Prior Result. So the set does not always contain its own centre.
  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.

Arguments

  • ue: ARCH uncertainty set estimator. The centre val comes from pr, and ue.ce fits the bounds on the resamples. So the centre and the bounds can disagree.
  • pr: Prior Result that the set fits on. The method resamples pr.X.
  • rd: Returns Result that the three-argument form gives beside the prior. The reduction takes a view of it, and the method does not use the view.
  • kwargs...: More keyword arguments, which the method gives to ue.ce.

Returns

  • sigma_ucs::BoxUncertaintySet: Box of the covariance.

Related

source
PortfolioOptimisers.sigma_ucs — Method
sigma_ucs(ue::ARCHUncertaintySet{Nothing, <:Any, <:Any, <:EllipsoidalUncertaintySetAlgorithm, <:Any, <:Any,
                                 <:Any, <:Any, <:Any}, pr::AbstractPriorResult; rd = nothing, kwargs...)

Fits the ellipsoidal uncertainty set of the covariance from block bootstrap resamples of the returns.

This is the prior-result method of the verb. Only a set whose pe is nothing has it. Inside an optimiser, pr is the prior that the optimiser solves on. The set then has the same centre as the objective, and the method resamples the rows of that prior. Outside an optimiser, give pr = prior(pe, X). The returns-data method of the same verb fits the prior of the set through ucs_prior and calls this method.

The shape matrix is the empirical covariance of the bootstrap deviations of the covariance, and ue.ce fits it. So ue.ce enters this axis twice. It fits every resample, and then it fits the deviations. A ue.ce with no bias correction changes the resampled covariances by 0.397% over 252 observations, and the shape matrix by 1.784% over 100 resamples. If ue.seed is set, the method returns the same set as the covariance set of ucs. If ue.seed is nothing, it does not.

Mathematical definition

\[\begin{align} \mathbf{\Sigma}_{\Sigma} &= \operatorname{Cov}\!\left(\operatorname{vec}(\hat{\mathbf{\Sigma}}^{(m)} - \hat{\mathbf{\Sigma}})\right)\,, \\ \mathcal{E}_{\Sigma} &= \left\{\mathbf{\Sigma} : \left\lVert \mathbf{\Sigma}_{\Sigma}^{-1/2} \operatorname{vec}(\mathbf{\Sigma} - \hat{\mathbf{\Sigma}}) \right\rVert_2 \leq k_{\Sigma}\right\}\,. \end{align}\]

Where:

  • $\mathbf{\Sigma}_{\Sigma}$: Empirical covariance of the vectorised bootstrap deviations of the covariance.
  • $\hat{\mathbf{\Sigma}}$: Estimated covariance matrix.
  • $\mathcal{E}_{\Sigma}$: Ellipsoidal uncertainty set of the covariance.
  • $k_{\Sigma}$: Radius of the set. k_ucs fits it from ue.alg.method at the level ue.q.

Algorithm

  1. Reduce the Prior Result to the Investable Mask with investable_ucs_reduction. Inside an optimiser, the result 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.
  2. Take X from the reduced Prior Result. The method resamples this X, so under a Scenario Cap it resamples only the rows that the prior keeps.
  3. Draw the resampled covariances with sigma_bootstrap_generator to get sigmas. This is the first fit of ue.ce.
  4. Subtract the vectorised sigma of the reduced Prior Result from each slice of sigmas to get the deviation matrix X_sigma. Transpose it, so that each row is one simulation. The subtraction writes into sigmas, so the method holds no second copy of the resamples.
  5. Fit ue.ce on X_sigma to get the shape matrix sigma_sigma. This is the second fit of ue.ce. The shape is empirical, and no asymptotic formula enters.
  6. Build the set with bootstrap_ellipsoidal_set. It fits the radius k at the level ue.q, with the degrees of freedom capped at ue.n_sim - 1.
  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.

Arguments

  • ue: ARCH uncertainty set estimator. ue.ce fits the covariance of every resample and the shape matrix over the deviations, so it enters this axis twice.
  • pr: Prior Result that the set fits on. The method resamples pr.X.
  • rd: Returns Result that the three-argument form gives beside the prior. The reduction takes a view of it, and the method does not use the view.
  • kwargs...: More keyword arguments, which the method gives to ue.ce.

Returns

  • sigma_ucs::EllipsoidalUncertaintySet: Ellipsoid of the covariance.

Related

source
PortfolioOptimisers.ucs — Method
ucs(ue::ARCHUncertaintySet{Nothing, <:Any, <:Any, <:NormBallUncertaintySetAlgorithm, <:Any,
                           <:Any, <:Any, <:Any, <:Any}, pr::AbstractPriorResult; rd = nothing, kwargs...)

Fits the norm-ball uncertainty sets of the expected returns and the covariance from block bootstrap resamples of the returns.

This is the prior-result method of the verb. Only a set whose pe is nothing has it. Inside an optimiser, pr is the prior that the optimiser solves on. The set then has the same centre as the objective, and the method resamples the rows of that prior. Outside an optimiser, give pr = prior(pe, X). The returns-data method of the same verb fits the prior of the set through ucs_prior and calls this method.

This route builds no shape matrix, because the scaled bootstrap deviations are the geometry map. The ellipsoidal route fits ue.ce on the deviations. On the covariance axis, the result is an $N^{2} \times N^{2}$ matrix of rank at most $\min(M - 1, N(N+1)/2)$. That matrix is rank deficient at every sample size, and the default matrix processing repairs it. The map that norm_ball_deviation_factor builds has the same second moment exactly, at the rank of the sample, and ue.ce does not fit it. ue.ce still fits the covariance of every resample, so it enters this axis once and not twice.

On the mean axis, the map has full rank if ue.n_sim is larger than $N$. The two shapes then agree, and the two sets give the same optimal weights.

Mathematical definition

\[\mathbf{L} = \dfrac{\left(\mathbf{X} - \boldsymbol{1}\bar{\mathbf{x}}^{\intercal}\right)^{\intercal}}{\sqrt{M - 1}}\,, \qquad \mathbf{L}\mathbf{L}^{\intercal} = \operatorname{Cov}(\mathbf{X})\,, \qquad U = \left\{ \hat{\mathbf{z}} + \mathbf{L}\mathbf{u} \, \vert \, \lVert \mathbf{u} \rVert_{p} \leq \kappa \right\}\,.\]

Where:

  • $\mathbf{L}$: Geometry map.
  • $\mathbf{X}$: Bootstrap deviations, one row per resample.
  • $\bar{\mathbf{x}}$: Column means of $\mathbf{X}$.
  • $M$: Number of resamples, ue.n_sim.
  • $\hat{\mathbf{z}}$: Point estimate that the method subtracts to get the deviations.
  • $\kappa$, $p$: Radius and norm order of the ball.

Algorithm

  1. Reduce the Prior Result to the Investable Mask with investable_ucs_reduction. Inside an optimiser, the result 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.
  2. Take X and N = size(X, 2) from the reduced Prior Result. The method resamples this X.
  3. Refit both statistics on every resample with bootstrap_generator to get mus and sigmas from one index stream.
  4. Subtract the mu of the reduced Prior Result from every resampled mean to get X_mu. Subtract its sigma from every resampled covariance to get X_sigma. Each column holds one deviation. The subtraction writes into the resampled statistics, so the method holds no second copy of the resamples.
  5. Build the two sets with norm_ball_deviation_set on the transposed deviations.
  6. Write both sets back onto the full universe with expand_investable_ucs. Return them as a tuple, with the mean set first. 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.

Arguments

  • ue: ARCH uncertainty set estimator.
  • pr: Prior Result that the set fits on. The method resamples pr.X.
  • rd: Returns Result that the three-argument form gives beside the prior. The reduction takes a view of it, and the method does not use the view.
  • kwargs...: More keyword arguments, which the method gives to ue.me and ue.ce.

Returns

  • mu_ucs::NormBallUncertaintySet: Norm ball of the expected returns.
  • sigma_ucs::NormBallUncertaintySet: Norm ball of the covariance.

Related

References

  • [12] D. Cajas. Advanced Portfolio Optimization: A Cutting-edge Quantitative Approach (Springer Nature Switzerland, 2025). Section 11.3.2, Listing 11.11. The original source of this formulation was not found. The formulation follows this work and is not checked against the original.
  • [170] D. Goldfarb and G. Iyengar. Robust Portfolio Selection Problems. Mathematics of Operations Research 28, 1–38 (2003). Section 5, Equation 50.
  • [168] L. El Ghaoui, M. Oks and F. Oustry. Worst-Case Value-At-Risk and Robust Portfolio Optimization: A Conic Programming Approach. Operations Research 51, 543–556 (2003). Theorem 1, Equation 8.
  • [171] D. Bertsimas, D. B. Brown and C. Caramanis. Theory and Applications of Robust Optimization. SIAM Review 53, 464–501 (2011). Section 2.2, Theorem 2. The original source of this formulation was not found. The formulation follows this work and is not checked against the original.
  • [172] D. Bertsimas, D. Pachamanova and M. Sim. Robust linear optimization under general norms. Operations Research Letters 32, 510–516 (2004).
source
PortfolioOptimisers.mu_ucs — Method
mu_ucs(ue::ARCHUncertaintySet{Nothing, <:Any, <:Any, <:NormBallUncertaintySetAlgorithm, <:Any,
                              <:Any, <:Any, <:Any, <:Any}, pr::AbstractPriorResult; rd = nothing, kwargs...)

Fits the norm-ball uncertainty set of the expected returns from block bootstrap resamples of the returns.

This is the prior-result method of the verb. Only a set whose pe is nothing has it. Inside an optimiser, pr is the prior that the optimiser solves on. The set then has the same centre as the objective, and the method resamples the rows of that prior. Outside an optimiser, give pr = prior(pe, X). The returns-data method of the same verb fits the prior of the set through ucs_prior and calls this method.

This route builds no shape matrix, because the scaled bootstrap deviations are the geometry map. ue.ce does not enter this axis. The ellipsoidal route fits ue.ce on the mean deviations, and the map has the same second moment without it. If ue.seed is set, the method sees the same resamples as the mean set of ucs. If ue.seed is nothing, it does not.

Algorithm

  1. Reduce the Prior Result to the Investable Mask with investable_ucs_reduction. Inside an optimiser, the result 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.
  2. Take X and N = size(X, 2) from the reduced Prior Result. The method resamples this X.
  3. Refit the mean on every resample with mu_bootstrap_generator to get mus.
  4. Subtract the mu of the reduced Prior Result from every resampled mean to get X_mu. Each column holds one deviation. The subtraction writes into the resampled means, so the method holds no second copy of the resamples.
  5. Build the set with norm_ball_deviation_set on the transposed deviations, with the mu of the reduced Prior Result as the centre.
  6. 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.

Arguments

  • ue: ARCH uncertainty set estimator.
  • pr: Prior Result that the set fits on. The method resamples pr.X.
  • rd: Returns Result that the three-argument form gives beside the prior. The reduction takes a view of it, and the method does not use the view.
  • kwargs...: More keyword arguments, which the method gives to ue.me.

Returns

  • mu_ucs::NormBallUncertaintySet: Norm ball of the expected returns.

Related

References

  • [12] D. Cajas. Advanced Portfolio Optimization: A Cutting-edge Quantitative Approach (Springer Nature Switzerland, 2025). Section 11.3.2, Listing 11.11. The original source of this formulation was not found. The formulation follows this work and is not checked against the original.
  • [170] D. Goldfarb and G. Iyengar. Robust Portfolio Selection Problems. Mathematics of Operations Research 28, 1–38 (2003). Section 5, Equation 50.
  • [168] L. El Ghaoui, M. Oks and F. Oustry. Worst-Case Value-At-Risk and Robust Portfolio Optimization: A Conic Programming Approach. Operations Research 51, 543–556 (2003). Theorem 1, Equation 8.
  • [171] D. Bertsimas, D. B. Brown and C. Caramanis. Theory and Applications of Robust Optimization. SIAM Review 53, 464–501 (2011). Section 2.2, Theorem 2. The original source of this formulation was not found. The formulation follows this work and is not checked against the original.
  • [172] D. Bertsimas, D. Pachamanova and M. Sim. Robust linear optimization under general norms. Operations Research Letters 32, 510–516 (2004).
source
PortfolioOptimisers.sigma_ucs — Method
sigma_ucs(ue::ARCHUncertaintySet{Nothing, <:Any, <:Any, <:NormBallUncertaintySetAlgorithm,
                                 <:Any, <:Any, <:Any, <:Any, <:Any}, pr::AbstractPriorResult; rd = nothing, kwargs...)

Fits the norm-ball uncertainty set of the covariance from block bootstrap resamples of the returns.

This is the prior-result method of the verb. Only a set whose pe is nothing has it. Inside an optimiser, pr is the prior that the optimiser solves on. The set then has the same centre as the objective, and the method resamples the rows of that prior. Outside an optimiser, give pr = prior(pe, X). The returns-data method of the same verb fits the prior of the set through ucs_prior and calls this method.

This route is the only route of the library that bounds a covariance with no matrix of side $N^{2}$. The ellipsoidal route fits ue.ce on the $M \times N^{2}$ deviations. A vectorised symmetric matrix has only $N(N+1)/2$ free coordinates, so that shape is rank deficient at every sample size. The default matrix processing then repairs it into a matrix that the sample does not give.

The map that norm_ball_deviation_factor builds is the scaled deviations. So it has the second moment of the sample exactly, at the rank $\min(M - 1, N(N+1)/2)$. k_norm_ball reads that rank, and not the side of a shape matrix. The chi-squared radius of the ellipsoidal route reads the same rank by default. It reads $N^{2}$ degrees of freedom only if its ChiSqKUncertaintyAlgorithm has ambient = true.

Algorithm

  1. Reduce the Prior Result to the Investable Mask with investable_ucs_reduction. Inside an optimiser, the result 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.
  2. Take X and N = size(X, 2) from the reduced Prior Result. The method resamples this X.
  3. Refit the covariance on every resample with sigma_bootstrap_generator to get sigmas.
  4. Subtract the sigma of the reduced Prior Result from every resampled covariance, and vectorise the difference, to get X_sigma. Each column holds one deviation. The subtraction writes into the resampled covariances, so the method holds no second copy of the resamples.
  5. Build the set with norm_ball_deviation_set on the transposed deviations, with the sigma of the reduced Prior Result as the centre.
  6. 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.

Arguments

  • ue: ARCH uncertainty set estimator.
  • pr: Prior Result that the set fits on. The method resamples pr.X.
  • rd: Returns Result that the three-argument form gives beside the prior. The reduction takes a view of it, and the method does not use the view.
  • kwargs...: More keyword arguments, which the method gives to ue.ce.

Returns

  • sigma_ucs::NormBallUncertaintySet: Norm ball of the covariance.

Related

References

  • [12] D. Cajas. Advanced Portfolio Optimization: A Cutting-edge Quantitative Approach (Springer Nature Switzerland, 2025). Section 11.3.2, Listing 11.11. The original source of this formulation was not found. The formulation follows this work and is not checked against the original.
  • [170] D. Goldfarb and G. Iyengar. Robust Portfolio Selection Problems. Mathematics of Operations Research 28, 1–38 (2003). Section 5, Equation 50.
  • [168] L. El Ghaoui, M. Oks and F. Oustry. Worst-Case Value-At-Risk and Robust Portfolio Optimization: A Conic Programming Approach. Operations Research 51, 543–556 (2003). Theorem 1, Equation 8.
  • [171] D. Bertsimas, D. B. Brown and C. Caramanis. Theory and Applications of Robust Optimization. SIAM Review 53, 464–501 (2011). Section 2.2, Theorem 2. The original source of this formulation was not found. The formulation follows this work and is not checked against the original.
  • [172] D. Bertsimas, D. Pachamanova and M. Sim. Robust linear optimization under general norms. Operations Research Letters 32, 510–516 (2004).
source

References

[12]
D. Cajas. Advanced Portfolio Optimization: A Cutting-edge Quantitative Approach (Springer Nature Switzerland, 2025).
[168]
L. El Ghaoui, M. Oks and F. Oustry. Worst-Case Value-At-Risk and Robust Portfolio Optimization: A Conic Programming Approach. Operations Research 51, 543–556 (2003).
[170]
D. Goldfarb and G. Iyengar. Robust Portfolio Selection Problems. Mathematics of Operations Research 28, 1–38 (2003).
[171]
D. Bertsimas, D. B. Brown and C. Caramanis. Theory and Applications of Robust Optimization. SIAM Review 53, 464–501 (2011).
[172]
D. Bertsimas, D. Pachamanova and M. Sim. Robust linear optimization under general norms. Operations Research Letters 32, 510–516 (2004).
[175]
D. N. Politis and J. P. Romano. The stationary bootstrap. Journal of the American Statistical Association 89, 1303–1313 (1994).
[176]
D. N. Politis and J. P. Romano. A circular block-resampling procedure for stationary data. In: Exploring the Limits of Bootstrap (John Wiley & Sons, 1992); pp. 263–270.
[177]
H. R. Künsch. The jackknife and the bootstrap for general stationary observations. The Annals of Statistics 17, 1217–1241 (1989).
[178]
R. H. Tütüncü and M. Koenig. Robust Asset Allocation. Annals of Operations Research 132, 157–187 (2004).