Bootstrap Uncertainty Sets
PortfolioOptimisers.BootstrapUncertaintySetEstimator — Type
abstract type BootstrapUncertaintySetEstimator <: AbstractUncertaintySetEstimatorFits 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
PortfolioOptimisers.ARCHBootstrapSet — Type
abstract type ARCHBootstrapSet <: AbstractAlgorithmSelects 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.
| Scheme | Block length | Wraps past the end | Start range |
|---|---|---|---|
StationaryBootstrap | geometric, restart probability 1 / block_size | yes, by mod1 | 1:T |
CircularBootstrap | fixed block_size | yes, by mod1 | 1:T |
MovingBootstrap | fixed block_size | no | 1:(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}:Tindices in1:T, which select the rows of one resample.
Related
PortfolioOptimisers.StationaryBootstrap — Type
struct StationaryBootstrap <: ARCHBootstrapSetDraws 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.
PortfolioOptimisers.CircularBootstrap — Type
struct CircularBootstrap <: ARCHBootstrapSetDraws 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.
PortfolioOptimisers.MovingBootstrap — Type
struct MovingBootstrap <: ARCHBootstrapSetDraws 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.
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} <: BootstrapUncertaintySetEstimatorFits 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, ornothing. Withnothing, 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. Withnothing, the returns-data method raises anArgumentError. 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. ForStationaryBootstrap, it is the mean block length.
q: Significance level that sets the size of the uncertainty set, with0 < q < 1. A smallerqgives a larger set, with wider box intervals or a larger radius. A largerqgives a smaller set, nearer to the point estimate.
rng: Random number generator.
seed: Optional seed. If set, the draws come from a copy ofrngseeded with it, sorngdoes not advance and every call draws the same values. Ifnothing, the draws come fromrngitself.
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 = (;),) -> ARCHUncertaintySetThe keywords are the fields of the struct.
Validation
ceis not anAbstractVarianceEstimator. A variance estimator has nocovorcor, soassert_covariance_estimatorraises anArgumentErrorthat namesce.n_sim > 0.n_sim > 1ifalgis anEllipsoidalUncertaintySetAlgorithmor aNormBallUncertaintySetAlgorithm. Both shapes read the covariance of the bootstrap deviations, and one resample has no covariance.BoxUncertaintySetAlgorithmreads quantiles, so it accepts one resample.block_size > 0.0 < q < 1.
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
BootstrapUncertaintySetEstimatorARCHBootstrapSetStationaryBootstrapCircularBootstrapMovingBootstrapBoxUncertaintySetEllipsoidalUncertaintySet
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.
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
- Set the restart probability
ptoinv(block_size). - Draw
idx[1]uniformly from1:T. This starts the first block. - For each later
t, draw one uniform variate. If the variate is belowp, drawidx[t]uniformly from1:T, which starts a new block. If not, setidx[t]tomod1(idx[t - 1] + 1, T). This continues the block, and wraps it past the end of the series. - Return
idx. Step 3 makes the block length geometric with meanblock_size. For each value ofblock_size,mod1keeps every index in1:T.
CircularBootstrap
- Set the fill position
tto zero. - While
tis belowT, draw a startsuniformly from1:T. - Fill the next
min(block_size, T - t)entries withmod1(s + k, T), forkfrom zero. This puts one block in the vector, and wraps it past the end of the series. If fewer thanblock_sizeentries are free, the last block of the vector is shorter. - Increase
tbyblock_size. Go back to step 2 whiletis belowT. - Return
idx.mod1keeps every index in1:T, so this method needs no check onblock_size.
MovingBootstrap
- Make sure that
block_sizeis not larger thanT. If it is larger, raise aDomainError, because step 3 then has an empty range. - Set the fill position
tto zero. - While
tis belowT, draw a startsuniformly from1:(T - block_size + 1). The upper end is the last start whose block ends at or beforeT. - Fill the next
min(block_size, T - t)entries withs + k, forkfrom zero. This puts one block in the vector, with no wrap. If fewer thanblock_sizeentries are free, the last block of the vector is shorter. - Increase
tbyblock_size. Go back to step 3 whiletis belowT. - Return
idx. The range of step 3 keepss + kat or belowT, so no index leaves1: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 forStationaryBootstrap, and the fixed block length for the other two schemes.
Validation
MovingBootstrapneedsblock_size <= T, and raises aDomainErrorotherwise. The other two methods accept ablock_sizelarger thanTwith no error. The docstring of each type states the result.
Returns
idx::Vector{Int}: Indices in1:Tthat 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.
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
- Fit the prior with
ucs_prioronue.pe,XandFto getpr. - Give
prto the prior-result method of the verb, on the set withpe = nothing. That method builds the set of the shape thatue.algnames.
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.meandue.ce.
Validation
ue.peis notnothing. Otherwiseucs_priorraises anArgumentErrorthat names the prior-result calls.
Returns
mu_ucs::AbstractUncertaintySetResult: Uncertainty set of the expected returns, frommu_ucs.sigma_ucs::AbstractUncertaintySetResult: Uncertainty set of the covariance, fromsigma_ucs.(mu_ucs, sigma_ucs): Both sets, fromucs.
Related
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
- 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. - Take
Xfrom the reduced Prior Result. The method resamples thisX, so under a Scenario Cap it resamples only the rows that the prior keeps. - Draw the resampled statistics with
bootstrap_generatorto getmusandsigmasfrom one index stream. - Halve
ue.qto get the tail massqof each side of a bound. - Take the quantiles of each entry of
muswithvec_quantile_boundsto getmu_landmu_u. - Take the quantiles of each entry of
sigmaswithbox_quantile_boundsto getsigma_landsigma_u. - Build the two
BoxUncertaintySetvalues. The bounds come from steps 5 and 6. The centresvalare themuand thesigmaof the reduced Prior Result. So a set does not always contain its own centre. - 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 centresvalcome frompr, andue.meandue.cefit the bounds on the resamples. So the centres and the bounds can disagree.pr: Prior Result that the set fits on. The method resamplespr.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 toue.meandue.ce.
Returns
mu_ucs::BoxUncertaintySet: Box of the expected returns.sigma_ucs::BoxUncertaintySet: Box of the covariance.
Related
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_ucsfits each radius fromue.alg.methodat the levelue.q.
Algorithm
- 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. - Take
Xfrom the reduced Prior Result. The method resamples thisX, so under a Scenario Cap it resamples only the rows that the prior keeps. - Draw the resampled statistics with
bootstrap_generatorto getmusandsigmasfrom one index stream. - Subtract the
muof the reduced Prior Result from each column ofmusto getX_mu. Subtract its vectorisedsigmafrom each slice ofsigmasto getX_sigma. Transpose both, so that each row is one simulation. The subtraction writes intomusandsigmas, so the method holds no second copy of the resamples. - Fit
ue.ceonX_muto get the shape matrixsigma_mu. This is the only fit ofue.ceon the mean axis. The shape is empirical, and no asymptotic formula enters. - Fit
ue.ceonX_sigmato get the shape matrixsigma_sigma. This is the second fit ofue.ceon the covariance axis. - Build both sets with
bootstrap_ellipsoidal_set. It fits each radiuskat the levelue.q, with the degrees of freedom capped atue.n_sim - 1. - 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.cefits 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 frompr, andue.meandue.cefit the spread, so the centres and the spread can disagree.pr: Prior Result that the set fits on. The method resamplespr.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 toue.meandue.ce.
Returns
mu_ucs::EllipsoidalUncertaintySet: Ellipsoid of the expected returns.sigma_ucs::EllipsoidalUncertaintySet: Ellipsoid of the covariance.
Related
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
- 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. - Take
Xfrom the reduced Prior Result. The method resamples thisX, so under a Scenario Cap it resamples only the rows that the prior keeps. - Draw the resampled means with
mu_bootstrap_generatorto getmus. This method fits no covariance, so it does not readue.ce. - Halve
ue.qto get the tail massqof each side of a bound. - Take the quantiles of each entry of
muswithvec_quantile_boundsto getmu_landmu_u. - Build the
BoxUncertaintySet. The bounds come from step 5, and the centrevalis themuof the reduced Prior Result. So the set does not always contain its own centre. - 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 centrevalcomes frompr, andue.mefits the bounds on the resamples. So the centre and the bounds can disagree.pr: Prior Result that the set fits on. The method resamplespr.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 toue.me.
Returns
mu_ucs::BoxUncertaintySet: Box of the expected returns.
Related
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_ucsfits it fromue.alg.methodat the levelue.q.
Algorithm
- 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. - Take
Xfrom the reduced Prior Result. The method resamples thisX, so under a Scenario Cap it resamples only the rows that the prior keeps. - Draw the resampled means with
mu_bootstrap_generatorto getmus. - Subtract the
muof the reduced Prior Result from each column ofmusto get the deviation matrixX_mu. Transpose it, so that each row is one simulation. The subtraction writes intomus, so the method holds no second copy of the resamples. - Fit
ue.ceonX_muto get the shape matrixsigma_mu. The shape is empirical, and no asymptotic formula enters. - Build the set with
bootstrap_ellipsoidal_set. It fits the radiuskat the levelue.q, with the degrees of freedom capped atue.n_sim - 1. - 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.mefits the mean of every resample, andue.cefits the shape matrix over the deviations.pr: Prior Result that the set fits on. The method resamplespr.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 toue.me.
Returns
mu_ucs::EllipsoidalUncertaintySet: Ellipsoid of the expected returns.
Related
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
- 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. - Take
Xfrom the reduced Prior Result. The method resamples thisX, so under a Scenario Cap it resamples only the rows that the prior keeps. - Draw the resampled covariances with
sigma_bootstrap_generatorto getsigmas. This method fits no mean, so it does not readue.me. - Halve
ue.qto get the tail massqof each side of a bound. - Take the quantiles of each entry of
sigmaswithbox_quantile_boundsto getsigma_landsigma_u. - Build the
BoxUncertaintySet. The bounds come from step 5, and the centrevalis thesigmaof the reduced Prior Result. So the set does not always contain its own centre. - 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 centrevalcomes frompr, andue.cefits the bounds on the resamples. So the centre and the bounds can disagree.pr: Prior Result that the set fits on. The method resamplespr.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 toue.ce.
Returns
sigma_ucs::BoxUncertaintySet: Box of the covariance.
Related
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_ucsfits it fromue.alg.methodat the levelue.q.
Algorithm
- 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. - Take
Xfrom the reduced Prior Result. The method resamples thisX, so under a Scenario Cap it resamples only the rows that the prior keeps. - Draw the resampled covariances with
sigma_bootstrap_generatorto getsigmas. This is the first fit ofue.ce. - Subtract the vectorised
sigmaof the reduced Prior Result from each slice ofsigmasto get the deviation matrixX_sigma. Transpose it, so that each row is one simulation. The subtraction writes intosigmas, so the method holds no second copy of the resamples. - Fit
ue.ceonX_sigmato get the shape matrixsigma_sigma. This is the second fit ofue.ce. The shape is empirical, and no asymptotic formula enters. - Build the set with
bootstrap_ellipsoidal_set. It fits the radiuskat the levelue.q, with the degrees of freedom capped atue.n_sim - 1. - 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.cefits 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 resamplespr.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 toue.ce.
Returns
sigma_ucs::EllipsoidalUncertaintySet: Ellipsoid of the covariance.
Related
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
- 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. - Take
XandN = size(X, 2)from the reduced Prior Result. The method resamples thisX. - Refit both statistics on every resample with
bootstrap_generatorto getmusandsigmasfrom one index stream. - Subtract the
muof the reduced Prior Result from every resampled mean to getX_mu. Subtract itssigmafrom every resampled covariance to getX_sigma. Each column holds one deviation. The subtraction writes into the resampled statistics, so the method holds no second copy of the resamples. - Build the two sets with
norm_ball_deviation_seton the transposed deviations. - 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 resamplespr.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 toue.meandue.ce.
Returns
mu_ucs::NormBallUncertaintySet: Norm ball of the expected returns.sigma_ucs::NormBallUncertaintySet: Norm ball of the covariance.
Related
ARCHUncertaintySetNormBallUncertaintySetAlgorithmNormBallUncertaintySetnorm_ball_deviation_setbootstrap_generatormu_ucssigma_ucs
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).
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
- 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. - Take
XandN = size(X, 2)from the reduced Prior Result. The method resamples thisX. - Refit the mean on every resample with
mu_bootstrap_generatorto getmus. - Subtract the
muof the reduced Prior Result from every resampled mean to getX_mu. Each column holds one deviation. The subtraction writes into the resampled means, so the method holds no second copy of the resamples. - Build the set with
norm_ball_deviation_seton the transposed deviations, with themuof the reduced Prior Result as the centre. - 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 resamplespr.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 toue.me.
Returns
mu_ucs::NormBallUncertaintySet: Norm ball of the expected returns.
Related
ARCHUncertaintySetNormBallUncertaintySetAlgorithmNormBallUncertaintySetnorm_ball_deviation_setmu_bootstrap_generatorsigma_ucs
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).
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
- 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. - Take
XandN = size(X, 2)from the reduced Prior Result. The method resamples thisX. - Refit the covariance on every resample with
sigma_bootstrap_generatorto getsigmas. - Subtract the
sigmaof the reduced Prior Result from every resampled covariance, and vectorise the difference, to getX_sigma. Each column holds one deviation. The subtraction writes into the resampled covariances, so the method holds no second copy of the resamples. - Build the set with
norm_ball_deviation_seton the transposed deviations, with thesigmaof the reduced Prior Result as the centre. - 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 resamplespr.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 toue.ce.
Returns
sigma_ucs::NormBallUncertaintySet: Norm ball of the covariance.
Related
ARCHUncertaintySetNormBallUncertaintySetAlgorithmNormBallUncertaintySetnorm_ball_deviation_setsigma_bootstrap_generatormu_ucs
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).
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).