Delta Uncertainty Sets
PortfolioOptimisers.DeltaUncertaintySet — Type
struct DeltaUncertaintySet{__T_pe, __T_dmu, __T_dsigma} <: AbstractUncertaintySetEstimatorFits a box uncertainty set by widening the prior statistics by a fixed fraction of their own absolute value.
It is the delta method of Equation 11.15 of the source, the one route in the family that draws no sample: dmu and dsigma are the two fractions. Its sampling counterparts are NormalUncertaintySet and ARCHUncertaintySet. The two axes do not write the same kind of bound, so read mu_delta_box_set and sigma_delta_box_set before you read a fitted set entry by entry. A fraction of zero is admitted on either axis and collapses that axis to a degenerate box, which leaves the model with its nominal expression on that axis and no worst case at all.
Fields
pe: Prior estimator the set fits on the returns it is handed, ornothing. Withnothingthe set holds no prior of its own and is calibrated on the prior result it is handed — inside an optimiser, the prior the optimiser is solving on, so its centre is the objective's own — through the prior-result arm of the ucs triple; the returns-data form then refuses by name. The default,EmpiricalPrior(), fits an empirical prior on the returns.
dmu: Uncertainty bound for expected returns.
dsigma: Uncertainty bound for covariance.
Constructors
DeltaUncertaintySet(; pe::Option{<:AbstractLowOrderPriorEstimator} = EmpiricalPrior(), dmu::Number = 0.1, dsigma::Number = 0.1) -> DeltaUncertaintySetKeywords correspond to the struct's fields.
Validation
dmu >= 0.dsigma >= 0.
Examples
julia> DeltaUncertaintySet()DeltaUncertaintySet 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 dmu ┼ Float64: 0.1 dsigma ┴ Float64: 0.1Related
BoxUncertaintySet: the result both axes return, and the owner of the rule that the two axes read their bounds differently.mu_delta_box_set: the mean-axis builder, which writes a width.sigma_delta_box_set: the covariance-axis builder, which writes absolute bounds.AbstractUncertaintySetEstimatorAbstractPriorEstimator
References
- [5] D. Cajas. Advanced Portfolio Optimization: A Cutting-edge Quantitative Approach (Springer Nature Switzerland, 2025). Equation 11.15.
PortfolioOptimisers.ucs — Function
ucs(ue::DeltaUncertaintySet, X::MatNum,
F::Option{<:MatNum} = nothing; dims::Int = 1, kwargs...)
ucs(ue::DeltaUncertaintySet{Nothing}, pr::AbstractPriorResult; rd = nothing, kwargs...)Constructs box uncertainty sets for mean and covariance statistics using delta bounds, from the set's own prior fitted on returns data or from a prior result the set is handed.
The two methods are the two routes a set with a pe field takes and share one tail. The returns-data method fits ue.pe once through ucs_prior and hands the result to the prior-result method of the same set with its pe set to nothing, so both routes build the two boxes from one pr by the same two calls. The prior-result method is defined only for a set whose pe is nothing, because a set with a prior of its own is calibrated on that prior and on nothing else; a set with no prior of its own is calibrated on the pr it is handed, which inside an optimiser is the prior the optimiser is solving on. The single-axis verbs mu_ucs and sigma_ucs fit the prior once each on the returns-data route, so the single-axis pair costs two prior fits for the same two sets. The three verbs agree on their common axes to the last bit, because they call the same two builders on an identically fitted prior.
Mathematical definition
Given prior mean $\hat{\boldsymbol{\mu}}$ and covariance $\hat{\mathbf{\Sigma}}$, the box bounds are:
\[\begin{align} \boldsymbol{\mu}_{lb} &= \boldsymbol{0}\,, \\ \boldsymbol{\mu}_{ub} &= 2 \delta_{\mu} |\hat{\boldsymbol{\mu}}|\,. \end{align}\]
\[\begin{align} \mathbf{\Sigma}_{lb} &= \hat{\mathbf{\Sigma}} - \delta_{\sigma} |\hat{\mathbf{\Sigma}}|\,, \\ \mathbf{\Sigma}_{ub} &= \hat{\mathbf{\Sigma}} + \delta_{\sigma} |\hat{\mathbf{\Sigma}}|\,. \end{align}\]
Where:
- $\boldsymbol{\mu}_{lb}$, $\boldsymbol{\mu}_{ub}$: Lower and upper bounds for expected returns.
- $\mathbf{\Sigma}_{lb}$, $\mathbf{\Sigma}_{ub}$: Lower and upper bounds for covariance matrix.
- $\hat{\boldsymbol{\mu}}$: Estimated mean vector.
- $\hat{\mathbf{\Sigma}}$: Estimated covariance matrix.
- $\delta_{\mu}$: Delta bound for expected returns.
- $\delta_{\sigma}$: Delta bound for covariance.
- $|\cdot|$: Element-wise absolute value.
Algorithm
The returns-data method runs step 1 and forwards; the prior-result method runs steps 2 to 6 on the pr it is handed.
- Fit the prior with
ucs_prioronue.pe,XandF, givingpr, and forward to the prior-result method of the set withpe = nothing. Apeofnothingis refused there by name. - Reduce the prior result to the Investable Mask with
investable_ucs_reduction. Inside an optimiser the result arrives already reduced and the step is a passthrough; standalone, on a prior fitted on a point-in-time Asset Panel, it takes the view the optimiser would have taken. - Call
mu_delta_box_setonprandue.dmu, giving the mean-axis box. It writes a width, so the model halves the difference of its bounds. - Call
sigma_delta_box_setonprandue.dsigma, giving the covariance-axis box. It writes absolute bounds, both of which bind. - Return the two boxes as a tuple, the mean axis first.
- Before the two sets leave, write both back onto the full universe with
expand_investable_ucs, so a set fitted standalone is over the same assets the prior is, and a view of it at the mask recovers the reduced fit.
Arguments
ue: Delta uncertainty set estimator. Provides delta bounds and, on the returns-data route, the prior estimator.X: Data matrix (e.g., returns).F: Optional factor matrix. Used by the prior estimator.dims: Dimension along which to perform the computation.pr: Fitted prior result the set is calibrated on.pr.muandpr.sigmaare read.rd: Returns result the three-argument form passes beside the prior. Not read.kwargs...: Additional keyword arguments passed to the prior estimator.
Returns
mu_ucs::BoxUncertaintySet: Expected returns uncertainty set, whose bounds encode a width.sigma_ucs::BoxUncertaintySet: Covariance uncertainty set, whose bounds are absolute.
Related
DeltaUncertaintySetBoxUncertaintySetmu_delta_box_setsigma_delta_box_setucs_priormu_ucs: the mean axis alone, which fits its own prior.sigma_ucs: the covariance axis alone, which fits its own prior.
PortfolioOptimisers.mu_ucs — Function
mu_ucs(ue::DeltaUncertaintySet, X::MatNum,
F::Option{<:MatNum} = nothing; dims::Int = 1, kwargs...)
mu_ucs(ue::DeltaUncertaintySet{Nothing}, pr::AbstractPriorResult; rd = nothing, kwargs...)Constructs a box uncertainty set for expected returns (mean) using delta bounds, from the set's own prior fitted on returns data or from a prior result the set is handed.
The two methods are the two routes a set with a pe field takes and share one tail, as ucs states. On the returns-data route it fits its own prior, so it reaches the same set as the first element of ucs at the cost of a second fit. ue.dsigma is not read on this path.
Mathematical definition
\[\begin{align} \boldsymbol{\mu}_{lb} &= \boldsymbol{0}\,, \\ \boldsymbol{\mu}_{ub} &= 2 \delta_{\mu} |\hat{\boldsymbol{\mu}}|\,. \end{align}\]
Where:
- $\boldsymbol{\mu}_{lb}$, $\boldsymbol{\mu}_{ub}$: Lower and upper bounds for expected returns.
- $\hat{\boldsymbol{\mu}}$: Estimated mean vector.
- $\delta_{\mu}$: Delta bound for expected returns.
- $|\cdot|$: Element-wise absolute value.
Algorithm
- On the returns-data route, fit the prior with
ucs_prioronue.pe,XandF, givingpr, and forward to the prior-result method of the set withpe = nothing. - Reduce the prior result to the Investable Mask with
investable_ucs_reduction. Inside an optimiser the result arrives already reduced and the step is a passthrough; standalone, on a prior fitted on a point-in-time Asset Panel, it takes the view the optimiser would have taken. - Call
mu_delta_box_setonprandue.dmu, giving the mean-axis box, and return it.pr.muis the only quantity this path reads. - Before the set leaves, write it back onto the full universe with
expand_investable_ucs, so a set fitted standalone is over the same assets the prior is, and a view of it at the mask recovers the reduced fit.
Arguments
ue: Delta uncertainty set estimator. Provides delta bounds and, on the returns-data route, the prior estimator.X: Data matrix (e.g., returns).F: Optional factor matrix. Used by the prior estimator (default:nothing).dims: Dimension along which to perform the computation.pr: Fitted prior result the set is calibrated on. Onlypr.muis read.rd: Returns result the three-argument form passes beside the prior. Not read.kwargs...: Additional keyword arguments passed to the prior estimator.
Returns
mu_ucs::BoxUncertaintySet: Expected returns uncertainty set, whose bounds encode a width rather than a pair of bounds on the mean.
Related
DeltaUncertaintySetBoxUncertaintySetmu_delta_box_set: the builder this method forwards to, and the owner of the width convention.ucs_priorucs: both axes on one prior fit.sigma_ucs
PortfolioOptimisers.sigma_ucs — Function
sigma_ucs(ue::DeltaUncertaintySet, X::MatNum,
F::Option{<:MatNum} = nothing; dims::Int = 1, kwargs...)
sigma_ucs(ue::DeltaUncertaintySet{Nothing}, pr::AbstractPriorResult; rd = nothing, kwargs...)Constructs a box uncertainty set for covariance using delta bounds, from the set's own prior fitted on returns data or from a prior result the set is handed.
The two methods are the two routes a set with a pe field takes and share one tail, as ucs states. On the returns-data route it fits its own prior, so it reaches the same set as the second element of ucs at the cost of a second fit. ue.dmu is not read on this path.
Mathematical definition
\[\begin{align} \mathbf{\Sigma}_{lb} &= \hat{\mathbf{\Sigma}} - \delta_{\sigma} |\hat{\mathbf{\Sigma}}|\,, \\ \mathbf{\Sigma}_{ub} &= \hat{\mathbf{\Sigma}} + \delta_{\sigma} |\hat{\mathbf{\Sigma}}|\,. \end{align}\]
Where:
- $\mathbf{\Sigma}_{lb}$, $\mathbf{\Sigma}_{ub}$: Lower and upper bounds for covariance matrix.
- $\hat{\mathbf{\Sigma}}$: Estimated covariance matrix.
- $\delta_{\sigma}$: Delta bound for covariance.
- $|\cdot|$: Element-wise absolute value.
Algorithm
- On the returns-data route, fit the prior with
ucs_prioronue.pe,XandF, givingpr, and forward to the prior-result method of the set withpe = nothing. - Reduce the prior result to the Investable Mask with
investable_ucs_reduction. Inside an optimiser the result arrives already reduced and the step is a passthrough; standalone, on a prior fitted on a point-in-time Asset Panel, it takes the view the optimiser would have taken. - Call
sigma_delta_box_setonprandue.dsigma, giving the covariance-axis box, and return it.pr.sigmais the only quantity this path reads. - Before the set leaves, write it back onto the full universe with
expand_investable_ucs, so a set fitted standalone is over the same assets the prior is, and a view of it at the mask recovers the reduced fit.
Arguments
ue: Delta uncertainty set estimator. Provides delta bounds and, on the returns-data route, the prior estimator.X: Data matrix (e.g., returns).F: Optional factor matrix. Used by the prior estimator (default:nothing).dims: Dimension along which to perform the computation.pr: Fitted prior result the set is calibrated on. Onlypr.sigmais read.rd: Returns result the three-argument form passes beside the prior. Not read.kwargs...: Additional keyword arguments passed to the prior estimator.
Returns
sigma_ucs::BoxUncertaintySet: Covariance uncertainty set, whose two bounds are absolute and bind on their own.
Related
DeltaUncertaintySetBoxUncertaintySetsigma_delta_box_set: the builder this method forwards to, and the owner of the absolute-bound convention and of the positive-semidefiniteness note.ucs_priorucs: both axes on one prior fit.mu_ucs
References
- [5]
- D. Cajas. Advanced Portfolio Optimization: A Cutting-edge Quantitative Approach (Springer Nature Switzerland, 2025).