Delta Uncertainty Sets: private API
PortfolioOptimisers.mu_delta_box_set — Function
mu_delta_box_set(pr, dmu::Number) -> BoxUncertaintySetBuilds the mean-axis delta box, which writes a width on the upper bound and zero on the lower one.
Neither bound is a bound on the mean. BoxUncertaintySet owns the rule: on this axis set_ucs_return_constraints! reads the pair only through its half-width $(\boldsymbol{u} - \boldsymbol{\ell}) / 2$ and centres that width on val, so a builder is free to put the whole width in $\boldsymbol{u}$, and this one does. The set the model sees is therefore $\hat{\boldsymbol{\mu}} \pm \delta_{\mu} \lvert \hat{\boldsymbol{\mu}} \rvert$, the $\delta_{\mu}$ of Equation 11.15. The zero lower bound is not a claim that the mean is non-negative, and abs fixes the width alone and never the centre: on $\hat{\mu}_i = -0.6$ with $\delta_{\mu} = 0.1$ the builder writes $\ell_i = 0$ and $u_i = 0.12$, and the model sees $[-0.66,\, -0.54]$, centred on the negative value. Its covariance-axis sibling sigma_delta_box_set is on the other side of the same rule.
Mathematical definition
\[\begin{align} \boldsymbol{\ell} &= \boldsymbol{0}\,, \\ \boldsymbol{u} &= 2 \delta_{\mu} \lvert \hat{\boldsymbol{\mu}} \rvert\,. \end{align}\]
Where:
- $\boldsymbol{\ell}$, $\boldsymbol{u}$: Lower and upper bounds the builder writes.
- $\hat{\boldsymbol{\mu}}$: Estimated mean vector.
- $\delta_{\mu}$: Delta bound for expected returns.
- $\lvert \cdot \rvert$: Element-wise absolute value.
Algorithm
- Build
lb, a range oflength(pr.mu)zeros of the element type ofpr.mu. It is a range and not a vector, because every entry holds the same value and the consumer reads it once. - Build
ub, twice the half-width the model is to see, fromdmuand the element-wise absolute value ofpr.mu. The factor of two is what makes the half-width come out at $\delta_{\mu} \lvert \hat{\boldsymbol{\mu}} \rvert$. - Build a
BoxUncertaintySetfromlb,ubandval = pr.mu, the characteristic vector the width is centred on.
Arguments
pr: Fitted prior. Onlypr.muis read.dmu: Delta bound for expected returns. Admuof zero writeslb == ub == 0, a half-width of zero, so the model's worst case collapses onto the nominal $\hat{\boldsymbol{\mu}}^{\intercal} \boldsymbol{w}$.
Returns
mu_ucs::BoxUncertaintySet: The mean-axis box, whoselbis a range of zeros, whoseubholds twice the half-width, and whosevalispr.mu.
Related
DeltaUncertaintySetBoxUncertaintySet: the owner of the two-axis convention this builder is one side of.sigma_delta_box_set: the other side, which writes absolute bounds.set_ucs_return_constraints!: the consumer that halves the difference.
References
- [5] D. Cajas. Advanced Portfolio Optimization: A Cutting-edge Quantitative Approach (Springer Nature Switzerland, 2025). Equation 11.15.
PortfolioOptimisers.sigma_delta_box_set — Function
sigma_delta_box_set(pr, dsigma::Number) -> BoxUncertaintySetBuilds the covariance-axis delta box, which writes absolute bounds, both of which bind in the model.
It is the other side of the rule BoxUncertaintySet owns. On this axis set_ucs_variance_risk! reads $\operatorname{tr}(\mathbf{A}_{u} \mathbf{\Sigma}_{u}) - \operatorname{tr}(\mathbf{A}_{l} \mathbf{\Sigma}_{l})$ under $\mathbf{A}_{u},\, \mathbf{A}_{l} \geq 0$ and $\mathbf{A}_{u} - \mathbf{A}_{l} = \mathbf{W}$, so each bound enters on its own and neither is halved against the other. That route names no centre, so it never reads val, and its mean-axis sibling is mu_delta_box_set.
The map is element-wise, and it is not a scaling of the matrix: a positive entry of $\hat{\mathbf{\Sigma}}$ shrinks to $1 - \delta_{\sigma}$ of itself in $\mathbf{\Sigma}_{l}$, while a negative entry grows to $1 + \delta_{\sigma}$. The order $\mathbf{\Sigma}_{l} \leq \hat{\mathbf{\Sigma}} \leq \mathbf{\Sigma}_{u}$ therefore holds entry by entry at every $\delta_{\sigma}$, on a negative entry as much as on a positive one: $-0.2$ with $\delta_{\sigma} = 0.2$ gives $-0.24$ and $-0.16$. The cone order does not follow. This builder applies no posdef!, where its sampling sibling sigma_normal_box_set applies one to both bounds, so a large $\delta_{\sigma}$ leaves $\mathbf{\Sigma}_{l}$ indefinite. The consumer does not need it to be definite. It reads the two bounds entry by entry through the two traces above and factorises neither, so an indefinite lower bound builds, solves, and widens the worst case rather than breaking it. The library documents this rather than guarding it, so a $\delta_{\sigma}$ chosen far outside $(0, 1)$ is the caller's to justify.
Mathematical definition
\[\begin{align} \mathbf{\Sigma}_{l} &= \hat{\mathbf{\Sigma}} - \delta_{\sigma} \lvert \hat{\mathbf{\Sigma}} \rvert\,, \\ \mathbf{\Sigma}_{u} &= \hat{\mathbf{\Sigma}} + \delta_{\sigma} \lvert \hat{\mathbf{\Sigma}} \rvert\,. \end{align}\]
Where:
- $\mathbf{\Sigma}_{l}$, $\mathbf{\Sigma}_{u}$: Lower and upper bounds for the covariance matrix.
- $\hat{\mathbf{\Sigma}}$: Estimated covariance matrix.
- $\delta_{\sigma}$: Delta bound for covariance.
- $\lvert \cdot \rvert$: Element-wise absolute value.
Algorithm
- Build
d_sigma, the element-wise half-width, fromdsigmaand the element-wise absolute value ofpr.sigma. It is non-negative everywhere, which is what orders the two bounds. - Subtract
d_sigmafrompr.sigma, giving the lower bound. It is symmetric, because both operands are. - Add
d_sigmatopr.sigma, giving the upper bound. - Build a
BoxUncertaintySetfrom the two bounds andval = pr.sigma, the covariance they are calibrated on. The covariance route ignoresval, which the mean route reads, so the field is carried for the reader rather than for this consumer.
Arguments
pr: Fitted prior. Onlypr.sigmais read.dsigma: Delta bound for covariance. Adsigmaof zero writeslb == ub == pr.sigma, so the two traces collapse to $\operatorname{tr}(\mathbf{W} \hat{\mathbf{\Sigma}})$ and the model sees the nominal variance.
Returns
sigma_ucs::BoxUncertaintySet: The covariance-axis box, whoselbandubare absolute bounds and whosevalispr.sigma.
Related
DeltaUncertaintySetBoxUncertaintySet: the owner of the two-axis convention this builder is one side of.mu_delta_box_set: the other side, which writes a width.set_ucs_variance_risk!: the consumer that reads both bounds absolutely.
References
- [5] D. Cajas. Advanced Portfolio Optimization: A Cutting-edge Quantitative Approach (Springer Nature Switzerland, 2025). Equation 11.15.
References
- [5]
- D. Cajas. Advanced Portfolio Optimization: A Cutting-edge Quantitative Approach (Springer Nature Switzerland, 2025).