Delta Uncertainty Sets
PortfolioOptimisers.DeltaUncertaintySet — Type
struct DeltaUncertaintySet{__T_pe, __T_dmu, __T_dsigma} <: AbstractUncertaintySetEstimatorFits a box uncertainty set whose half-width is a fixed fraction of the absolute value of each prior moment.
The method is the delta method of Equation 11.15 of [12]. dmu sets the fraction on the mean axis, and dsigma sets it on the covariance axis. Three estimators fit a box, and this one is the only one that draws no sample. The other two are NormalUncertaintySet and ARCHUncertaintySet.
The two axes write different kinds of bounds. mu_delta_box_set writes a width, and sigma_delta_box_set writes absolute bounds. Read both before you read a fitted set entry by entry. The constructor accepts a fraction of zero on each axis. A zero gives that axis a box with no width, and the model then uses the nominal expression of that axis with no worst case.
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.
dmu: Fraction of the absolute value of each expected return that sets the half-width of the mean box.
dsigma: Fraction of the absolute value of each covariance entry that sets the half-width of the covariance box.
Constructors
DeltaUncertaintySet(; pe::Option{<:AbstractLowOrderPriorEstimator} = EmpiricalPrior(), dmu::Number = 0.1, dsigma::Number = 0.1) -> DeltaUncertaintySetThe keywords are the fields of the struct.
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 │ x_src ┴ nothing dmu ┼ Float64: 0.1 dsigma ┴ Float64: 0.1Related
BoxUncertaintySet: the result of both axes, which states the rule that the two axes read their bounds differently.mu_delta_box_set: the builder of the mean axis, which writes a width.sigma_delta_box_set: the builder of the covariance axis, which writes absolute bounds.AbstractUncertaintySetEstimatorAbstractPriorEstimator
References
- [12] D. Cajas. Advanced Portfolio Optimization: A Cutting-edge Quantitative Approach (Springer Nature Switzerland, 2025). Equation 11.15. The original source of this formulation was not found. The formulation follows this work and is not checked against the original.
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...)Fits the delta boxes of the mean axis and the covariance axis, from returns data or from a Prior Result.
The two methods are the two routes of a set that has a pe field, and the first route ends in the second. The returns-data method fits ue.pe once through ucs_prior. It then gives the result to the prior-result method of the same set with pe = nothing. So both routes build the two boxes from one pr with the same two calls.
Only a set whose pe is nothing has the prior-result method. A set with a prior of its own fits its boxes on that prior alone. A set with no prior of its own fits its boxes on the pr that the caller gives. Inside an optimiser, that pr is the prior that the optimiser solves on.
The single-axis verbs mu_ucs and sigma_ucs each fit the prior once on the returns-data route. Two single-axis calls cost two prior fits, and one ucs call costs one fit for the same two boxes. The three verbs give identical boxes on their common axes, because they call the same two builders on identical priors.
Mathematical definition
The prior gives the mean $\hat{\boldsymbol{\mu}}$ and the covariance $\hat{\mathbf{\Sigma}}$. The bounds of the two boxes 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 that the builder writes for the mean axis.
- $\mathbf{\Sigma}_{lb}$, $\mathbf{\Sigma}_{ub}$: Lower and upper bounds of the covariance matrix.
- $\hat{\boldsymbol{\mu}}$: Estimated mean vector.
- $\hat{\mathbf{\Sigma}}$: Estimated covariance matrix.
- $\delta_{\mu}$: Fraction of the absolute mean that sets the half-width of the mean box.
- $\delta_{\sigma}$: Fraction of the absolute covariance that sets the half-width of the covariance box.
- $|\cdot|$: Element-wise absolute value.
Algorithm
The returns-data method does step 1 and forwards the call. The prior-result method does steps 2 to 6 on the pr that the caller gives.
- Fit the prior with
ucs_prioronue.pe,XandFto getpr. Forwardprto the prior-result method of the set withpe = nothing. Ifue.peisnothing,ucs_priorraises anArgumentErrorthat names the prior-result calls. - 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. - Call
mu_delta_box_seton the reduced Prior Result andue.dmuto get the box of the mean axis. The box holds a width, so the model halves the difference of its bounds. - Call
sigma_delta_box_seton the reduced Prior Result andue.dsigmato get the box of the covariance axis. The box holds absolute bounds, and both bounds bind. - Write both boxes back onto the full universe with
expand_investable_ucs. A box fitted outside an optimiser then covers the same assets as the prior. A view of the box at the mask gives the reduced fit again. - Return the two boxes as a tuple, with the mean axis first.
Arguments
ue: Delta uncertainty set estimator. It gives the two fractions, and on the returns-data route it also gives the prior estimator.X: Matrix of asset returns.F: Optional matrix of factor returns, which a factor prior needs.dims: Dimension along which the computation runs.pr: Prior Result that the set fits on. The method readspr.muandpr.sigma.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 returns-data method gives to the prior estimator. The prior-result method ignores them.
Returns
mu_ucs::BoxUncertaintySet: Box of the mean axis, whose bounds hold a width.sigma_ucs::BoxUncertaintySet: Box of the covariance axis, whose bounds are absolute.
Related
DeltaUncertaintySetBoxUncertaintySetmu_delta_box_setsigma_delta_box_setucs_priormu_ucs: the mean axis alone, with a prior fit of its own.sigma_ucs: the covariance axis alone, with a prior fit of its own.
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...)Fits the delta box of the mean axis, from returns data or from a Prior Result.
The two methods are the two routes of a set that has a pe field, and the first route ends in the second, as ucs states. On the returns-data route, the method fits its own prior. It gives the same box as the first element of ucs, but it costs one more prior fit. This path does not read ue.dsigma.
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 that the builder writes for the mean axis.
- $\hat{\boldsymbol{\mu}}$: Estimated mean vector.
- $\delta_{\mu}$: Fraction of the absolute mean that sets the half-width of the mean box.
- $|\cdot|$: Element-wise absolute value.
Algorithm
- On the returns-data route, fit the prior with
ucs_prioronue.pe,XandFto getpr. Forwardprto 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 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. - Call
mu_delta_box_seton the reduced Prior Result andue.dmuto get the box of the mean axis. This path reads onlypr.mu. - Write the box back onto the full universe with
expand_investable_ucs, and return it. A box fitted outside an optimiser then covers the same assets as the prior. A view of the box at the mask gives the reduced fit again.
Arguments
ue: Delta uncertainty set estimator. It gives the fraction of the mean axis, and on the returns-data route it also gives the prior estimator.X: Matrix of asset returns.F: Optional matrix of factor returns, which a factor prior needs.dims: Dimension along which the computation runs.pr: Prior Result that the set fits on. The method reads onlypr.mu.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 returns-data method gives to the prior estimator. The prior-result method ignores them.
Returns
mu_ucs::BoxUncertaintySet: Box of the mean axis. Its bounds hold a width, not a pair of bounds on the mean.
Related
DeltaUncertaintySetBoxUncertaintySetmu_delta_box_set: the builder that this method calls, which states the convention of the width.ucs_priorucs: both axes from 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...)Fits the delta box of the covariance axis, from returns data or from a Prior Result.
The two methods are the two routes of a set that has a pe field, and the first route ends in the second, as ucs states. On the returns-data route, the method fits its own prior. It gives the same box as the second element of ucs, but it costs one more prior fit. This path does not read ue.dmu.
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 of the covariance matrix.
- $\hat{\mathbf{\Sigma}}$: Estimated covariance matrix.
- $\delta_{\sigma}$: Fraction of the absolute covariance that sets the half-width of the covariance box.
- $|\cdot|$: Element-wise absolute value.
Algorithm
- On the returns-data route, fit the prior with
ucs_prioronue.pe,XandFto getpr. Forwardprto 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 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. - Call
sigma_delta_box_seton the reduced Prior Result andue.dsigmato get the box of the covariance axis. This path reads onlypr.sigma. - Write the box back onto the full universe with
expand_investable_ucs, and return it. A box fitted outside an optimiser then covers the same assets as the prior. A view of the box at the mask gives the reduced fit again.
Arguments
ue: Delta uncertainty set estimator. It gives the fraction of the covariance axis, and on the returns-data route it also gives the prior estimator.X: Matrix of asset returns.F: Optional matrix of factor returns, which a factor prior needs.dims: Dimension along which the computation runs.pr: Prior Result that the set fits on. The method reads onlypr.sigma.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 returns-data method gives to the prior estimator. The prior-result method ignores them.
Returns
sigma_ucs::BoxUncertaintySet: Box of the covariance axis. Its two bounds are absolute, and each bound binds alone.
Related
DeltaUncertaintySetBoxUncertaintySetsigma_delta_box_set: the builder that this method calls, which states the convention of absolute bounds and the note on positive semidefiniteness.ucs_priorucs: both axes from one prior fit.mu_ucs
References
- [12]
- D. Cajas. Advanced Portfolio Optimization: A Cutting-edge Quantitative Approach (Springer Nature Switzerland, 2025).