Normal Uncertainty Sets
PortfolioOptimisers.AbstractDiagonalConstruction — Type
abstract type AbstractDiagonalConstruction <: AbstractAlgorithmAbstract supertype of the rules that build the diagonal covariance shape of a normal uncertainty set.
The rules are for a NormalUncertaintySet. The shape of the covariance set is the asymptotic covariance of $\operatorname{vec}(\hat{\mathbf{\Sigma}})$, of size $N^{2} \times N^{2}$. An algorithm with diagonal = true keeps one variance for each entry of $\hat{\mathbf{\Sigma}}$, and each subtype states which variance. The mean axis does not read the rule, because its diagonal shape is the diagonal of $\hat{\mathbf{\Sigma}} / T$ under every subtype.
Interfaces
diagonal_sigma_shape
diagonal_sigma_shape(dc::AbstractDiagonalConstruction, pdm::Option{<:AbstractPosdefEstimator}, sigma_mu::MatNum, sigma::MatNum, T::Number) -> LinearAlgebra.Diagonal: Returns the diagonal covariance shape, $N^{2} \times N^{2}$, with non-negative entries.
Related
PortfolioOptimisers.DiagonalOfShape — Type
struct DiagonalOfShape <: AbstractDiagonalConstructionTakes the diagonal of the full covariance shape.
This is the default rule. Each entry is the exact variance of the matching entry of $\hat{\mathbf{\Sigma}}$, at the covariance matrix at the centre of the set. So the diagonal set and the full set, with diagonal = false, use the same sampling law.
Mathematical definition
\[\begin{align} \left(\mathbf{\Sigma}_{\mathbf{\Sigma}}\right)_{(i,j),(i,j)} &= \dfrac{\hat{\mathbf{\Sigma}}_{ii} \hat{\mathbf{\Sigma}}_{jj} + \hat{\mathbf{\Sigma}}_{ij}^{2}}{T}\,. \end{align}\]
Where:
- $\left(\mathbf{\Sigma}_{\mathbf{\Sigma}}\right)_{(i,j),(i,j)}$: Diagonal entry of the covariance shape at the $(i, j)$ entry of $\hat{\mathbf{\Sigma}}$.
- $\hat{\mathbf{\Sigma}}_{ii}$: $i$-th diagonal entry of $\hat{\mathbf{\Sigma}}$.
- $\hat{\mathbf{\Sigma}}_{ij}$: Estimated covariance between assets $i$ and $j$.
- $T$: Number of observations.
It is the variance of the $(i, j)$ entry of a $\mathrm{Wishart}(T, \hat{\mathbf{\Sigma}}/T)$ draw.
Algorithm
The method of diagonal_sigma_shape for this type does these steps.
- Build the full shape with
sigma_asymptotic_cov, which repairs it underpdm. - Return its diagonal as a
LinearAlgebra.Diagonal.
Examples
julia> DiagonalOfShape()DiagonalOfShape()Related
PortfolioOptimisers.ShapeOfDiagonal — Type
struct ShapeOfDiagonal <: AbstractDiagonalConstructionSets the covariances of $\hat{\mathbf{\Sigma}}$ to zero, then builds the covariance shape.
Each entry is the variance of the matching entry of $\hat{\mathbf{\Sigma}}$ if $\hat{\mathbf{\Sigma}}_{ij} = 0$ for $i \neq j$. The centre of the set stays $\hat{\mathbf{\Sigma}}$, with its covariances. The rule drops the term $\hat{\mathbf{\Sigma}}_{ij}^{2}$ from each off-diagonal entry, and DiagonalOfShape keeps that term. So this rule is less exact, and its diagonal set can differ from the full set, with diagonal = false.
Mathematical definition
\[\begin{align} \left(\mathbf{\Sigma}_{\mathbf{\Sigma}}\right)_{(i,j),(i,j)} &= \dfrac{\left(1 + \delta_{ij}\right) \hat{\mathbf{\Sigma}}_{ii} \hat{\mathbf{\Sigma}}_{jj}}{T}\,. \end{align}\]
Where:
- $\left(\mathbf{\Sigma}_{\mathbf{\Sigma}}\right)_{(i,j),(i,j)}$: Diagonal entry of the covariance shape at the $(i, j)$ entry of $\hat{\mathbf{\Sigma}}$.
- $\delta_{ij}$: Kronecker delta,
1when $i = j$ and0otherwise. - $\hat{\mathbf{\Sigma}}_{ii}$: $i$-th diagonal entry of $\hat{\mathbf{\Sigma}}$.
- $T$: Number of observations.
It is the diagonal of $T (\mathbf{I} + \mathbf{K})(\mathbf{D} \otimes \mathbf{D})$, where $\mathbf{D}$ is the diagonal of $\mathbf{\Sigma}_{\boldsymbol{\mu}}$. The two rules give the same value at each entry $(i, i)$.
Algorithm
The method of diagonal_sigma_shape for this type does these steps.
- Read
d, the diagonal ofsigma_mu. - Form the vector
v = vec(T .* d .* transpose(d)), whose entry $(i, j)$ in column-major order is $T d_{i} d_{j}$. - Double the $N$ entries $(i, i)$, at the stride
N + 1ofv. - Return
LinearAlgebra.Diagonal(v). The method makes no $N^{2} \times N^{2}$ matrix, and it does not readpdm. A diagonal matrix with non-negative entries is positive semi-definite, andposdef!does not change such a matrix.
Examples
julia> ShapeOfDiagonal()ShapeOfDiagonal()Related
PortfolioOptimisers.diagonal_sigma_shape — Function
diagonal_sigma_shape(::DiagonalOfShape, pdm::Option{<:AbstractPosdefEstimator},
sigma_mu::MatNum, sigma::MatNum, T::Number)
diagonal_sigma_shape(::ShapeOfDiagonal, ::Option{<:AbstractPosdefEstimator},
sigma_mu::MatNum, ::MatNum, T::Number)Returns the diagonal covariance shape of a NormalUncertaintySet under the rule that dc names.
Algorithm
- On
DiagonalOfShape, run the steps that its docstring lists. - On
ShapeOfDiagonal, run the steps that its docstring lists.
Arguments
dc: Construction of the diagonal shape.pdm: Positive definite matrix estimator of the full shape.ShapeOfDiagonaldoes not read it.sigma_mu: Mean asymptotic covariance frommu_asymptotic_cov.sigma: Point estimate of the covariance matrix. OnlyDiagonalOfShapereads it, and it reads only the size.T: Scaling parameter fromchoose_scaling_parameter.
Returns
sigma_sigma::LinearAlgebra.Diagonal: Diagonal covariance shape, $N^{2} \times N^{2}$.
Related
PortfolioOptimisers.NormalUncertaintySet — Type
struct NormalUncertaintySet{__T_pe, __T_alg, __T_n_sim, __T_q, __T_rng, __T_seed, __T_ens, __T_pdm, __T_dc, __T_kwargs} <: AbstractUncertaintySetEstimatorFits a box, an ellipsoidal or a norm-ball uncertainty set from the sampling laws of normal returns.
Under normal returns, the sample mean has a normal law, and the sample covariance has a Wishart law. Equation 11.16 of [12] states the two laws. The Wishart law is the distribution of Equation 9 of [174]. Corollary 4.2 of [169] gives the covariance of that law, which is the shape of the ellipsoid on the covariance axis. Equation 11.17 of [12] takes the box from the quantiles of the two laws.
alg selects the shape of the set. n_sim sets the number of draws on each route that simulates. DeltaUncertaintySet fits a box with no sample, and ARCHUncertaintySet fits a set with no assumed law.
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.
alg: Uncertainty set algorithm.
n_sim: Number of simulation samples.
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.
ens: Effective sample size.
pdm: Positive definite matrix estimator.
dc: Construction of the diagonal covariance shape. The estimator reads it only whenalgis anEllipsoidalUncertaintySetAlgorithmor aNormBallUncertaintySetAlgorithmwithdiagonal = true.DiagonalOfShapetakes the diagonal of the full shape, andShapeOfDiagonalbuilds the shape from the variances alone.
kwargs: More keyword arguments.
Constructors
NormalUncertaintySet(; pe::Option{<:AbstractLowOrderPriorEstimator} = EmpiricalPrior(), alg::AbstractUncertaintySetAlgorithm = BoxUncertaintySetAlgorithm(), n_sim::Integer = 3_000, q::Number = 0.05, rng::Random.AbstractRNG = Random.default_rng(), seed::Option{<:Integer} = nothing, ens::Option{<:Number} = nothing, pdm::Option{<:AbstractPosdefEstimator} = Posdef(), dc::AbstractDiagonalConstruction = DiagonalOfShape(), kwargs::NamedTuple = (;),) -> NormalUncertaintySetThe keywords are the fields of the struct.
Validation
n_sim > 0.0 < q < 1.
Examples
julia> NormalUncertaintySet()NormalUncertaintySet 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 alg ┼ BoxUncertaintySetAlgorithm() n_sim ┼ Int64: 3000 q ┼ Float64: 0.05 rng ┼ Random.TaskLocalRNG: Random.TaskLocalRNG() seed ┼ nothing ens ┼ nothing pdm ┼ Posdef │ alg ┼ UnionAll: NearestCorrelationMatrix.Newton │ kwargs ┴ @NamedTuple{}: NamedTuple() dc ┼ DiagonalOfShape() kwargs ┴ @NamedTuple{}: NamedTuple()Related
BoxUncertaintySetEllipsoidalUncertaintySetAbstractUncertaintySetEstimatorBoxUncertaintySetAlgorithmEllipsoidalUncertaintySetAlgorithmAbstractDiagonalConstruction
References
- [174] J. Wishart. The Generalised Product Moment Distribution in Samples from a Normal Multivariate Population. Biometrika 20A, 32–52 (1928). Section 3, Equation 9.
- [169] J. R. Magnus and H. Neudecker. The Commutation Matrix: Some Properties and Applications. The Annals of Statistics 7, 381–394 (1979). Section 4, Corollary 4.2.
- [12] D. Cajas. Advanced Portfolio Optimization: A Cutting-edge Quantitative Approach (Springer Nature Switzerland, 2025). Equations 11.16 and 11.17. 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::NormalUncertaintySet, X::MatNum,
F::Option{<:MatNum} = nothing; dims::Int = 1, kwargs...)
mu_ucs(ue::NormalUncertaintySet, X::MatNum,
F::Option{<:MatNum} = nothing; dims::Int = 1, kwargs...)
sigma_ucs(ue::NormalUncertaintySet, X::MatNum,
F::Option{<:MatNum} = nothing; dims::Int = 1, kwargs...)Fits the sets of a NormalUncertaintySet from returns data, through the prior of the set.
These are the returns-data methods of the three verbs. Each verb has one such method for all shapes, because the next call selects the shape. Each method fits ue.pe once through ucs_prior. It then gives the result to the prior-result method of the same verb, on the same set with pe = nothing. That method dispatches on the box, the ellipsoid or the norm ball.
So a set with a prior of its own fits on that prior alone, and the prior fits on the returns that the caller gives. The two routes use the same body for each shape. Let ue′ be ue with pe = nothing. Then ucs(ue, X) and ucs(ue′, prior(ue.pe, X)) give identical sets.
Algorithm
- Fit the prior with
ucs_prioronue.pe,XandFto getpr. - Call the prior-result method of the verb on
prand on the set withpe = nothing. That method builds the set of the shape thatue.algnames.
Arguments
ue: Normal 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.
Validation
ue.peis notnothing. If it is,ucs_priorraises anArgumentErrorthat names the prior-result calls.
Returns
mu_ucs::AbstractUncertaintySetResult: Expected returns uncertainty set, frommu_ucs.sigma_ucs::AbstractUncertaintySetResult: Covariance uncertainty set, fromsigma_ucs.(mu_ucs, sigma_ucs): Both, fromucs.
Related
PortfolioOptimisers.ucs — Method
ucs(ue::NormalUncertaintySet{Nothing, <:BoxUncertaintySetAlgorithm, <:Any, <:Any, <:Any},
pr::AbstractPriorResult; rd = nothing, kwargs...)Fits the box sets of the mean and the covariance under normal returns.
This is the prior-result method of the verb, and only a set whose pe is nothing has it. Inside an optimiser, pr is the prior that the optimiser solves on. So the set and the objective have the same centre, and the set folds with that prior under the online step. Outside an optimiser, the caller gives prior(pe, X). The returns-data method of the same verb fits the prior of the set through ucs_prior, and then it calls this method. So the two routes use the same body.
Mathematical definition
The method draws $M$ covariance matrices $\hat{\mathbf{\Sigma}}^{(m)} \sim \mathrm{Wishart}(T,\, \hat{\mathbf{\Sigma}}/T)$, and the element-wise quantiles of the draws are the bounds:
\[\begin{align} (\mathbf{\Sigma}_{l})_{ij} &= Q_{q/2}\!\left(\hat{\Sigma}^{(m)}_{ij}\right)\,, \\ (\mathbf{\Sigma}_{u})_{ij} &= Q_{1-q/2}\!\left(\hat{\Sigma}^{(m)}_{ij}\right)\,. \end{align}\]
The bounds of the mean use the normal complementary quantile $z_{q/2} = \Phi^{-1}(1-q/2)$:
\[\begin{align} \boldsymbol{\mu}_{l} &= \boldsymbol{0}\,, \\ \mu_{u,i} &= 2 z_{q/2} \sqrt{(\hat{\mathbf{\Sigma}}/T)_{ii}}\,. \end{align}\]
Where:
- $(\mathbf{\Sigma}_{l})_{ij}$, $(\mathbf{\Sigma}_{u})_{ij}$: Element-wise lower and upper bounds of the covariance.
- $Q_{q/2}$, $Q_{1-q/2}$: Quantile functions at the levels $q/2$ and $1 - q/2$.
- $\hat{\Sigma}^{(m)}_{ij}$: Entry $(i,j)$ of the $m$-th Wishart draw.
- $M$: Number of draws,
ue.n_sim. - $\boldsymbol{\mu}_{l}$, $\mu_{u,i}$: Lower bound, and $i$-th entry of the upper bound, that the builder writes for the mean axis.
- $z_{q/2} = \Phi^{-1}(1 - q/2)$: Normal complementary quantile.
- $\hat{\mathbf{\Sigma}}$: Estimated covariance matrix.
- $T$: Number of observations.
- $q$: Significance level.
Algorithm
- Reduce the Prior Result
prto the Investable Mask withinvestable_ucs_reductionto getprr. Inside an optimiser,pris 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. - Run
normal_box_preambleonprrto getT,sigma_muand the halvedq. - Build the mean set with
mu_normal_box_setfromprr.mu,sigma_muandq. - Build the covariance set with
sigma_normal_box_setfromue,prr,T,sigma_muandq. - Write both sets back onto the full universe with
expand_investable_ucs. 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. - Return the two sets as a tuple, mean first.
Arguments
ue: Normal uncertainty set estimator with no prior of its own.pr: Prior Result that the set fits on.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. The method ignores them.
Returns
mu_ucs::BoxUncertaintySet: Expected returns uncertainty set.sigma_ucs::BoxUncertaintySet: Covariance uncertainty set.
Related
PortfolioOptimisers.ucs — Method
ucs(ue::NormalUncertaintySet{Nothing,
<:EllipsoidalUncertaintySetAlgorithm{<:NormalKUncertaintyAlgorithm, <:Any},
<:Any, <:Any, <:Any},
pr::AbstractPriorResult; rd = nothing, kwargs...)Fits the ellipsoidal sets of the mean and the covariance under normal returns, with radii from simulated estimation errors.
This is the prior-result method of the verb, and only a set whose pe is nothing has it. Inside an optimiser, pr is the prior that the optimiser solves on. So the set and the objective have the same centre, and the set folds with that prior under the online step. Outside an optimiser, the caller gives prior(pe, X). The returns-data method of the same verb fits the prior of the set through ucs_prior, and then it calls this method. So the two routes use the same body.
Each row of the two samples is an estimation error. k_ucs measures a Mahalanobis distance against the shape matrix. So step 6 draws from the sampling law of the estimator, $\mathcal{N}(\hat{\boldsymbol{\mu}}, \hat{\mathbf{\Sigma}}/T)$, and subtracts $\hat{\boldsymbol{\mu}}$ from each draw. A draw from $\mathcal{N}(\hat{\boldsymbol{\mu}}, \hat{\mathbf{\Sigma}})$ multiplies every deviation by $\sqrt{T}$, so it also multiplies the radius by $\sqrt{T}$. The sample of step 7 has the scale of its shape for the same reason. The variance of an entry of a $\mathrm{Wishart}(T, \hat{\mathbf{\Sigma}}/T)$ draw is the matching diagonal entry of $\mathbf{\Sigma}_{\mathbf{\Sigma}}$.
The two draws use one generator, so the covariance radius of this method differs from that of sigma_ucs under one seed. Step 5 resolves the generator once, and step 6 advances it before step 7 draws. sigma_ucs draws its Wishart matrices from the start of the stream. The two mean radii are equal, because the mean sample is the first draw in both methods. The box route does not have this difference. sigma_normal_box_set resolves its own generator, so the two box methods give the same covariance box.
Mathematical definition
The two ellipsoids have the prior estimates as centres, and the two asymptotic covariances as shapes:
\[\begin{align} \mathbf{\Sigma}_{\boldsymbol{\mu}} &= \hat{\mathbf{\Sigma}} / T\,, \\ \mathbf{\Sigma}_{\mathbf{\Sigma}} &= T (\mathbf{I} + \mathbf{K})(\mathbf{\Sigma}_{\boldsymbol{\mu}} \otimes \mathbf{\Sigma}_{\boldsymbol{\mu}})\,. \end{align}\]
k_ucs gives the radius of each ellipsoid for NormalKUncertaintyAlgorithm, and the docstring of that algorithm states the form. The method gives the significance level to k_ucs with no division, because an ellipsoid cuts only the upper tail of a non-negative distance.
\[\begin{align} \mathcal{E}_{\boldsymbol{\mu}} &= \left\{\boldsymbol{\mu} : (\boldsymbol{\mu} - \hat{\boldsymbol{\mu}})^{\intercal} \mathbf{\Sigma}_{\boldsymbol{\mu}}^{-1} (\boldsymbol{\mu} - \hat{\boldsymbol{\mu}}) \leq k_{\boldsymbol{\mu}}^2 \right\}\,. \end{align}\]
\[\begin{align} \mathcal{E}_{\mathbf{\Sigma}} &= \left\{\mathbf{\Sigma} : \left\lVert \mathbf{\Sigma}_{\mathbf{\Sigma}}^{-1/2} \operatorname{vec}(\mathbf{\Sigma} - \hat{\mathbf{\Sigma}}) \right\rVert_2 \leq k_{\mathbf{\Sigma}} \right\}\,. \end{align}\]
Where:
- $\mathbf{\Sigma}_{\boldsymbol{\mu}}$: Asymptotic covariance of the mean estimator.
- $\mathbf{\Sigma}_{\mathbf{\Sigma}}$: Asymptotic covariance of the covariance estimator, vectorised.
- $\hat{\mathbf{\Sigma}}$: Estimated covariance matrix.
- $T$: Number of observations.
- $\mathbf{I}$: Identity matrix.
- $\mathbf{K}$: Commutation matrix.
- $\otimes$: Kronecker product.
- $\mathcal{E}_{\boldsymbol{\mu}}$: Ellipsoidal uncertainty set for expected returns.
- $\mathcal{E}_{\mathbf{\Sigma}}$: Ellipsoidal uncertainty set for covariance.
- $k_{\boldsymbol{\mu}}$, $k_{\mathbf{\Sigma}}$: Radii of the two ellipsoids, fitted on the sampled estimation errors.
Algorithm
- Reduce the Prior Result
prto the Investable Mask withinvestable_ucs_reductionto getprr. Inside an optimiser,pris 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. - Read
mu,sigmaandN = size(prr.X, 2)fromprr. The asset count comes from the returns matrix of the prior, so the method follows a prior that changes the asset count. - Resolve the scaling parameter
Twithchoose_scaling_parameter. - Build the mean shape
sigma_muwithmu_asymptotic_cov. - Resolve the random number generator from
ue.rngandue.seedwithresolve_rng. - Draw the mean sample
X_muwithnormal_mu_error_sample. Each row holds one estimation error of the mean. - Draw the covariance sample
X_sigmawithnormal_sigma_error_sample. Each row holds one vectorised estimation error of the covariance. - Build the covariance shape
sigma_sigmawithnormal_sigma_shape. - Fit the mean ellipsoid with
ellipsoidal_setonX_muandsigma_mu, withprr.muas the centre. - Fit the covariance ellipsoid the same way on
X_sigmaandsigma_sigma, withprr.sigmaas the centre. - Write both sets back onto the full universe with
expand_investable_ucs. 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. - Return the two sets as a tuple, mean first.
Arguments
ue: Normal uncertainty set estimator with no prior of its own.pr: Prior Result that the set fits on.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. The method ignores them.
Returns
mu_ucs::EllipsoidalUncertaintySet: Expected returns uncertainty set.sigma_ucs::EllipsoidalUncertaintySet: Covariance uncertainty set.
Related
PortfolioOptimisers.ucs — Method
ucs(ue::NormalUncertaintySet{Nothing, <:EllipsoidalUncertaintySetAlgorithm{<:Any, <:Any},
<:Any, <:Any, <:Any}, pr::AbstractPriorResult; rd = nothing, kwargs...)Fits the ellipsoidal sets of the mean and the covariance under normal returns, with radii that read no sample.
This is the prior-result method of the verb, and only a set whose pe is nothing has it. Inside an optimiser, pr is the prior that the optimiser solves on. So the set and the objective have the same centre, and the set folds with that prior under the online step. Outside an optimiser, the caller gives prior(pe, X). The returns-data method of the same verb fits the prior of the set through ucs_prior, and then it calls this method. So the two routes use the same body.
This method draws no sample. It is the method for each radius algorithm that reads no sample, which is ChiSqKUncertaintyAlgorithm, GeneralKUncertaintyAlgorithm or a plain number. The method for NormalKUncertaintyAlgorithm draws the sample that the empirical radius needs. The two routes build the same shapes, so they differ only in the radius.
Mathematical definition
The two ellipsoids have the prior estimates as centres, and the two asymptotic covariances as shapes:
\[\begin{align} \mathbf{\Sigma}_{\boldsymbol{\mu}} &= \hat{\mathbf{\Sigma}} / T\,, \\ \mathbf{\Sigma}_{\mathbf{\Sigma}} &= T (\mathbf{I} + \mathbf{K})(\mathbf{\Sigma}_{\boldsymbol{\mu}} \otimes \mathbf{\Sigma}_{\boldsymbol{\mu}})\,. \end{align}\]
Where:
- $\mathbf{\Sigma}_{\boldsymbol{\mu}}$: Asymptotic covariance of the mean estimator.
- $\mathbf{\Sigma}_{\mathbf{\Sigma}}$: Asymptotic covariance of the covariance estimator, vectorised.
- $\hat{\mathbf{\Sigma}}$: Estimated covariance matrix.
- $T$: Number of observations.
- $\mathbf{I}$: Identity matrix.
- $\mathbf{K}$: Commutation matrix.
- $\otimes$: Kronecker product.
k_ucs gives the radius of each ellipsoid for ue.alg.method, and the docstring of that algorithm states the closed form. The method gives the significance level to k_ucs with no division, because an ellipsoid cuts only the upper tail of a non-negative distance.
Algorithm
- Reduce the Prior Result
prto the Investable Mask withinvestable_ucs_reductionto getprr. Inside an optimiser,pris 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. - Read
sigma = prr.sigma. - Resolve the scaling parameter
Twithchoose_scaling_parameter. - Build the mean shape
sigma_muwithmu_asymptotic_cov. - Build the covariance shape
sigma_sigmawithnormal_sigma_shape. - Fit the mean ellipsoid with
ellipsoidal_setonsigma_mu, withnothingin place of a sample andprr.muas the centre. - Fit the covariance ellipsoid the same way on
sigma_sigma, withprr.sigmaas the centre. - Write both sets back onto the full universe with
expand_investable_ucs. 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. - Return the two sets as a tuple, mean first.
Arguments
ue: Normal uncertainty set estimator with no prior of its own.pr: Prior Result that the set fits on.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. The method ignores them.
Returns
mu_ucs::EllipsoidalUncertaintySet: Expected returns uncertainty set.sigma_ucs::EllipsoidalUncertaintySet: Covariance uncertainty set.
Related
PortfolioOptimisers.ucs — Method
ucs(ue::NormalUncertaintySet{Nothing, <:EllipsoidalUncertaintySetAlgorithm{<:Any, <:Any},
<:Any, <:Any, <:Any}, pr::AbstractPriorResult; rd = nothing, kwargs...)Fits the ellipsoidal sets of the mean and the covariance under normal returns, with radii that read no sample.
This is the prior-result method of the verb, and only a set whose pe is nothing has it. Inside an optimiser, pr is the prior that the optimiser solves on. So the set and the objective have the same centre, and the set folds with that prior under the online step. Outside an optimiser, the caller gives prior(pe, X). The returns-data method of the same verb fits the prior of the set through ucs_prior, and then it calls this method. So the two routes use the same body.
This method draws no sample. It is the method for each radius algorithm that reads no sample, which is ChiSqKUncertaintyAlgorithm, GeneralKUncertaintyAlgorithm or a plain number. The method for NormalKUncertaintyAlgorithm draws the sample that the empirical radius needs. The two routes build the same shapes, so they differ only in the radius.
Mathematical definition
The two ellipsoids have the prior estimates as centres, and the two asymptotic covariances as shapes:
\[\begin{align} \mathbf{\Sigma}_{\boldsymbol{\mu}} &= \hat{\mathbf{\Sigma}} / T\,, \\ \mathbf{\Sigma}_{\mathbf{\Sigma}} &= T (\mathbf{I} + \mathbf{K})(\mathbf{\Sigma}_{\boldsymbol{\mu}} \otimes \mathbf{\Sigma}_{\boldsymbol{\mu}})\,. \end{align}\]
Where:
- $\mathbf{\Sigma}_{\boldsymbol{\mu}}$: Asymptotic covariance of the mean estimator.
- $\mathbf{\Sigma}_{\mathbf{\Sigma}}$: Asymptotic covariance of the covariance estimator, vectorised.
- $\hat{\mathbf{\Sigma}}$: Estimated covariance matrix.
- $T$: Number of observations.
- $\mathbf{I}$: Identity matrix.
- $\mathbf{K}$: Commutation matrix.
- $\otimes$: Kronecker product.
k_ucs gives the radius of each ellipsoid for ue.alg.method, and the docstring of that algorithm states the closed form. The method gives the significance level to k_ucs with no division, because an ellipsoid cuts only the upper tail of a non-negative distance.
Algorithm
- Reduce the Prior Result
prto the Investable Mask withinvestable_ucs_reductionto getprr. Inside an optimiser,pris 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. - Read
sigma = prr.sigma. - Resolve the scaling parameter
Twithchoose_scaling_parameter. - Build the mean shape
sigma_muwithmu_asymptotic_cov. - Build the covariance shape
sigma_sigmawithnormal_sigma_shape. - Fit the mean ellipsoid with
ellipsoidal_setonsigma_mu, withnothingin place of a sample andprr.muas the centre. - Fit the covariance ellipsoid the same way on
sigma_sigma, withprr.sigmaas the centre. - Write both sets back onto the full universe with
expand_investable_ucs. 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. - Return the two sets as a tuple, mean first.
Arguments
ue: Normal uncertainty set estimator with no prior of its own.pr: Prior Result that the set fits on.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. The method ignores them.
Returns
mu_ucs::EllipsoidalUncertaintySet: Expected returns uncertainty set.sigma_ucs::EllipsoidalUncertaintySet: Covariance uncertainty set.
Related
PortfolioOptimisers.mu_ucs — Method
mu_ucs(ue::NormalUncertaintySet{Nothing, <:BoxUncertaintySetAlgorithm, <:Any, <:Any, <:Any},
pr::AbstractPriorResult; rd = nothing, kwargs...)Fits the box set of the mean under normal returns.
This is the prior-result method of the verb, and only a set whose pe is nothing has it. Inside an optimiser, pr is the prior that the optimiser solves on. So the set and the objective have the same centre, and the set folds with that prior under the online step. Outside an optimiser, the caller gives prior(pe, X). The returns-data method of the same verb fits the prior of the set through ucs_prior, and then it calls this method. So the two routes use the same body.
Mathematical definition
\[\begin{align} \boldsymbol{\mu}_{l} &= \boldsymbol{0}\,, \\ \mu_{u,i} &= 2 \Phi^{-1}\!\left(1 - \tfrac{q}{2}\right) \sqrt{(\hat{\mathbf{\Sigma}}/T)_{ii}}\,. \end{align}\]
Where:
- $\boldsymbol{\mu}_{l}$, $\mu_{u,i}$: Lower bound, and $i$-th entry of the upper bound, that the builder writes for the mean axis.
- $\Phi^{-1}(1 - q/2)$: Normal complementary quantile.
- $\hat{\mathbf{\Sigma}}$: Estimated covariance matrix.
- $T$: Number of observations.
- $q$: Significance level.
Algorithm
- Reduce the Prior Result
prto the Investable Mask withinvestable_ucs_reductionto getprr. Inside an optimiser,pris 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. - Run
normal_box_preambleonprrto getsigma_muand the halvedq. The method discardsT, because only the covariance set reads it. - Build the mean set with
mu_normal_box_setfromprr.mu,sigma_muandq. - 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: Normal uncertainty set estimator with no prior of its own.pr: Prior Result that the set fits on.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. The method ignores them.
Returns
mu_ucs::BoxUncertaintySet: Expected returns uncertainty set.
Related
PortfolioOptimisers.mu_ucs — Method
mu_ucs(ue::NormalUncertaintySet{Nothing,
<:EllipsoidalUncertaintySetAlgorithm{<:NormalKUncertaintyAlgorithm, <:Any},
<:Any, <:Any, <:Any},
pr::AbstractPriorResult; rd = nothing, kwargs...)Fits the ellipsoidal set of the mean under normal returns, with a radius from simulated estimation errors.
This is the prior-result method of the verb, and only a set whose pe is nothing has it. Inside an optimiser, pr is the prior that the optimiser solves on. So the set and the objective have the same centre, and the set folds with that prior under the online step. Outside an optimiser, the caller gives prior(pe, X). The returns-data method of the same verb fits the prior of the set through ucs_prior, and then it calls this method. So the two routes use the same body.
Each row of the sample is an estimation error. k_ucs measures a Mahalanobis distance against the shape matrix. So step 5 draws from the sampling law of the estimator, $\mathcal{N}(\hat{\boldsymbol{\mu}}, \hat{\mathbf{\Sigma}}/T)$, and subtracts $\hat{\boldsymbol{\mu}}$ from each draw. A draw from $\mathcal{N}(\hat{\boldsymbol{\mu}}, \hat{\mathbf{\Sigma}})$ multiplies every deviation by $\sqrt{T}$, so it also multiplies the radius by $\sqrt{T}$.
Mathematical definition
\[\mathcal{E}_{\boldsymbol{\mu}} = \left\{\boldsymbol{\mu} : (\boldsymbol{\mu} - \hat{\boldsymbol{\mu}})^{\intercal} \mathbf{\Sigma}_{\boldsymbol{\mu}}^{-1} (\boldsymbol{\mu} - \hat{\boldsymbol{\mu}}) \leq k_{\boldsymbol{\mu}}^2 \right\}\,, \qquad \mathbf{\Sigma}_{\boldsymbol{\mu}} = \hat{\mathbf{\Sigma}} / T\,.\]
Where:
- $\mathcal{E}_{\boldsymbol{\mu}}$: Ellipsoidal uncertainty set for expected returns.
- $\mathbf{\Sigma}_{\boldsymbol{\mu}}$: Asymptotic covariance of the mean estimator.
- $\hat{\boldsymbol{\mu}}$: Estimated expected returns vector.
- $k_{\boldsymbol{\mu}}$: Radius fitted on the sample, the $1 - q$ quantile of the sampled Mahalanobis distances.
- $\hat{\mathbf{\Sigma}}$: Estimated covariance matrix.
- $T$: Number of observations.
Algorithm
- Reduce the Prior Result
prto the Investable Mask withinvestable_ucs_reductionto getprr. Inside an optimiser,pris 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. - Read
muandsigmafromprr. - Resolve the scaling parameter
Twithchoose_scaling_parameter. - Build the mean shape
sigma_muwithmu_asymptotic_cov. - Resolve the random number generator with
resolve_rng. Draw the sampleX_muwithnormal_mu_error_sample. Each row holds one estimation error. - Fit the ellipsoid with
ellipsoidal_setonX_muandsigma_mu, withprr.muas 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: Normal uncertainty set estimator with no prior of its own.pr: Prior Result that the set fits on.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. The method ignores them.
Returns
mu_ucs::EllipsoidalUncertaintySet: Expected returns uncertainty set.
Related
PortfolioOptimisers.mu_ucs — Method
mu_ucs(ue::NormalUncertaintySet{Nothing, <:EllipsoidalUncertaintySetAlgorithm{<:Any, <:Any},
<:Any, <:Any, <:Any},
pr::AbstractPriorResult; rd = nothing, kwargs...)Fits the ellipsoidal set of the mean under normal returns, with a radius that reads no sample.
This is the prior-result method of the verb, and only a set whose pe is nothing has it. Inside an optimiser, pr is the prior that the optimiser solves on. So the set and the objective have the same centre, and the set folds with that prior under the online step. Outside an optimiser, the caller gives prior(pe, X). The returns-data method of the same verb fits the prior of the set through ucs_prior, and then it calls this method. So the two routes use the same body.
The shape matrix is $\hat{\mathbf{\Sigma}} / T$, the asymptotic covariance of the mean that mu_asymptotic_cov builds. This method draws no sample. It is the method for each radius algorithm that reads no sample, which is ChiSqKUncertaintyAlgorithm, GeneralKUncertaintyAlgorithm or a plain number. The method for NormalKUncertaintyAlgorithm draws the sample that the empirical radius needs, and it builds the same shape.
Mathematical definition
\[\mathcal{E}_{\boldsymbol{\mu}} = \left\{\boldsymbol{\mu} : (\boldsymbol{\mu} - \hat{\boldsymbol{\mu}})^{\intercal} \mathbf{\Sigma}_{\boldsymbol{\mu}}^{-1} (\boldsymbol{\mu} - \hat{\boldsymbol{\mu}}) \leq k_{\boldsymbol{\mu}}^2 \right\}\,, \qquad \mathbf{\Sigma}_{\boldsymbol{\mu}} = \hat{\mathbf{\Sigma}} / T\,.\]
Where:
- $\mathcal{E}_{\boldsymbol{\mu}}$: Ellipsoidal uncertainty set for expected returns.
- $\mathbf{\Sigma}_{\boldsymbol{\mu}}$: Asymptotic covariance of the mean estimator.
- $\hat{\boldsymbol{\mu}}$: Estimated expected returns vector.
- $k_{\boldsymbol{\mu}}$: Radius, the one
k_ucsreturns forue.alg.method. - $\hat{\mathbf{\Sigma}}$: Estimated covariance matrix.
- $T$: Number of observations.
The method gives the significance level to k_ucs with no division, because an ellipsoid cuts only the upper tail of a non-negative distance.
Algorithm
- Reduce the Prior Result
prto the Investable Mask withinvestable_ucs_reductionto getprr. Inside an optimiser,pris 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. - Read
sigma = prr.sigma. - Resolve the scaling parameter
Twithchoose_scaling_parameter. - Build the mean shape
sigma_muwithmu_asymptotic_cov. - Fit the ellipsoid with
ellipsoidal_setonsigma_mu, withnothingin place of a sample andprr.muas 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: Normal uncertainty set estimator with no prior of its own.pr: Prior Result that the set fits on.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. The method ignores them.
Returns
mu_ucs::EllipsoidalUncertaintySet: Expected returns uncertainty set.
Related
PortfolioOptimisers.mu_ucs — Method
mu_ucs(ue::NormalUncertaintySet{Nothing, <:EllipsoidalUncertaintySetAlgorithm{<:Any, <:Any},
<:Any, <:Any, <:Any},
pr::AbstractPriorResult; rd = nothing, kwargs...)Fits the ellipsoidal set of the mean under normal returns, with a radius that reads no sample.
This is the prior-result method of the verb, and only a set whose pe is nothing has it. Inside an optimiser, pr is the prior that the optimiser solves on. So the set and the objective have the same centre, and the set folds with that prior under the online step. Outside an optimiser, the caller gives prior(pe, X). The returns-data method of the same verb fits the prior of the set through ucs_prior, and then it calls this method. So the two routes use the same body.
The shape matrix is $\hat{\mathbf{\Sigma}} / T$, the asymptotic covariance of the mean that mu_asymptotic_cov builds. This method draws no sample. It is the method for each radius algorithm that reads no sample, which is ChiSqKUncertaintyAlgorithm, GeneralKUncertaintyAlgorithm or a plain number. The method for NormalKUncertaintyAlgorithm draws the sample that the empirical radius needs, and it builds the same shape.
Mathematical definition
\[\mathcal{E}_{\boldsymbol{\mu}} = \left\{\boldsymbol{\mu} : (\boldsymbol{\mu} - \hat{\boldsymbol{\mu}})^{\intercal} \mathbf{\Sigma}_{\boldsymbol{\mu}}^{-1} (\boldsymbol{\mu} - \hat{\boldsymbol{\mu}}) \leq k_{\boldsymbol{\mu}}^2 \right\}\,, \qquad \mathbf{\Sigma}_{\boldsymbol{\mu}} = \hat{\mathbf{\Sigma}} / T\,.\]
Where:
- $\mathcal{E}_{\boldsymbol{\mu}}$: Ellipsoidal uncertainty set for expected returns.
- $\mathbf{\Sigma}_{\boldsymbol{\mu}}$: Asymptotic covariance of the mean estimator.
- $\hat{\boldsymbol{\mu}}$: Estimated expected returns vector.
- $k_{\boldsymbol{\mu}}$: Radius, the one
k_ucsreturns forue.alg.method. - $\hat{\mathbf{\Sigma}}$: Estimated covariance matrix.
- $T$: Number of observations.
The method gives the significance level to k_ucs with no division, because an ellipsoid cuts only the upper tail of a non-negative distance.
Algorithm
- Reduce the Prior Result
prto the Investable Mask withinvestable_ucs_reductionto getprr. Inside an optimiser,pris 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. - Read
sigma = prr.sigma. - Resolve the scaling parameter
Twithchoose_scaling_parameter. - Build the mean shape
sigma_muwithmu_asymptotic_cov. - Fit the ellipsoid with
ellipsoidal_setonsigma_mu, withnothingin place of a sample andprr.muas 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: Normal uncertainty set estimator with no prior of its own.pr: Prior Result that the set fits on.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. The method ignores them.
Returns
mu_ucs::EllipsoidalUncertaintySet: Expected returns uncertainty set.
Related
PortfolioOptimisers.sigma_ucs — Method
sigma_ucs(ue::NormalUncertaintySet{Nothing, <:BoxUncertaintySetAlgorithm, <:Any, <:Any, <:Any},
pr::AbstractPriorResult; rd = nothing, kwargs...)Fits the box set of the covariance under normal returns.
This is the prior-result method of the verb, and only a set whose pe is nothing has it. Inside an optimiser, pr is the prior that the optimiser solves on. So the set and the objective have the same centre, and the set folds with that prior under the online step. Outside an optimiser, the caller gives prior(pe, X). The returns-data method of the same verb fits the prior of the set through ucs_prior, and then it calls this method. So the two routes use the same body.
Mathematical definition
The method draws $M$ matrices $\hat{\mathbf{\Sigma}}^{(m)} \sim \mathrm{Wishart}(T,\,\hat{\mathbf{\Sigma}}/T)$, and the element-wise quantiles of the draws are the bounds:
\[\begin{align} (\mathbf{\Sigma}_{l})_{ij} &= Q_{q/2}\!\left(\hat{\Sigma}^{(m)}_{ij}\right)\,, \\ (\mathbf{\Sigma}_{u})_{ij} &= Q_{1-q/2}\!\left(\hat{\Sigma}^{(m)}_{ij}\right)\,. \end{align}\]
Where:
- $(\mathbf{\Sigma}_{l})_{ij}$, $(\mathbf{\Sigma}_{u})_{ij}$: Element-wise lower and upper bounds of the covariance.
- $Q_{q/2}$, $Q_{1-q/2}$: Quantile functions at the levels $q/2$ and $1 - q/2$.
- $\hat{\Sigma}^{(m)}_{ij}$: Entry $(i,j)$ of the $m$-th Wishart draw.
- $M$: Number of draws,
ue.n_sim. - $\hat{\mathbf{\Sigma}}$: Estimated covariance matrix.
- $T$: Number of observations.
- $q$: Significance level.
Algorithm
- Reduce the Prior Result
prto the Investable Mask withinvestable_ucs_reductionto getprr. Inside an optimiser,pris 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. - Run
normal_box_preambleonprrto getT,sigma_muand the halvedq. - Build the covariance set with
sigma_normal_box_setfromue,prr,T,sigma_muandq. - 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: Normal uncertainty set estimator with no prior of its own.pr: Prior Result that the set fits on.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. The method ignores them.
Returns
sigma_ucs::BoxUncertaintySet: Covariance uncertainty set.
Related
PortfolioOptimisers.sigma_ucs — Method
sigma_ucs(ue::NormalUncertaintySet{Nothing,
<:EllipsoidalUncertaintySetAlgorithm{<:NormalKUncertaintyAlgorithm, <:Any},
<:Any, <:Any, <:Any},
pr::AbstractPriorResult; rd = nothing, kwargs...)Fits the ellipsoidal set of the covariance under normal returns, with a radius from simulated estimation errors.
This is the prior-result method of the verb, and only a set whose pe is nothing has it. Inside an optimiser, pr is the prior that the optimiser solves on. So the set and the objective have the same centre, and the set folds with that prior under the online step. Outside an optimiser, the caller gives prior(pe, X). The returns-data method of the same verb fits the prior of the set through ucs_prior, and then it calls this method. So the two routes use the same body.
Each row of the sample is an estimation error. Step 5 subtracts $\hat{\mathbf{\Sigma}}$ from each Wishart draw. The variance of an entry of a $\mathrm{Wishart}(T, \hat{\mathbf{\Sigma}}/T)$ draw is the matching diagonal entry of $\mathbf{\Sigma}_{\mathbf{\Sigma}}$. So the sample and its shape matrix have the same scale. The method reads N from size(prr.X, 2), and ucs reads it from the same source. So a prior that changes the asset count changes N in both methods, and the two shape matrices are equal.
Under one seed, this radius differs from the covariance radius of ucs. This method draws its Wishart matrices from the start of the stream. ucs resolves one generator and draws its mean sample first, so its Wishart draws differ from these. Both radii are valid fits of the same quantity. The two methods give the same covariance set only on the box route.
Mathematical definition
\[\mathcal{E}_{\mathbf{\Sigma}} = \left\{\mathbf{\Sigma} : \left\lVert \mathbf{\Sigma}_{\mathbf{\Sigma}}^{-1/2} \operatorname{vec}(\mathbf{\Sigma} - \hat{\mathbf{\Sigma}}) \right\rVert_2 \leq k_{\mathbf{\Sigma}} \right\}\,, \qquad \mathbf{\Sigma}_{\mathbf{\Sigma}} = T (\mathbf{I} + \mathbf{K})(\mathbf{\Sigma}_{\boldsymbol{\mu}} \otimes \mathbf{\Sigma}_{\boldsymbol{\mu}})\,.\]
Where:
- $\mathcal{E}_{\mathbf{\Sigma}}$: Ellipsoidal uncertainty set for the covariance matrix.
- $\mathbf{\Sigma}_{\mathbf{\Sigma}}$: Asymptotic covariance of the covariance estimator, vectorised.
- $\mathbf{\Sigma}_{\boldsymbol{\mu}}$: Asymptotic covariance of the mean estimator.
- $\mathbf{I}$: Identity matrix.
- $\mathbf{K}$: Commutation matrix.
- $\otimes$: Kronecker product.
- $k_{\mathbf{\Sigma}}$: Radius fitted on the sample, the $1 - q$ quantile of the sampled Mahalanobis distances.
- $\hat{\mathbf{\Sigma}}$: Estimated covariance matrix.
- $T$: Number of observations.
Algorithm
- Reduce the Prior Result
prto the Investable Mask withinvestable_ucs_reductionto getprr. Inside an optimiser,pris 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. - Read
sigma = prr.sigmaandN = size(prr.X, 2). - Resolve the scaling parameter
Twithchoose_scaling_parameter. - Build the mean shape
sigma_muwithmu_asymptotic_cov. - Resolve the random number generator with
resolve_rng. Draw the sampleX_sigmawithnormal_sigma_error_sample. Each row holds one vectorised estimation error. - Build the covariance shape
sigma_sigmawithnormal_sigma_shape. - Fit the ellipsoid with
ellipsoidal_setonX_sigmaandsigma_sigma, withprr.sigmaas 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: Normal uncertainty set estimator with no prior of its own.pr: Prior Result that the set fits on.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. The method ignores them.
Returns
sigma_ucs::EllipsoidalUncertaintySet: Covariance uncertainty set.
Related
PortfolioOptimisers.sigma_ucs — Method
sigma_ucs(ue::NormalUncertaintySet{Nothing,
<:EllipsoidalUncertaintySetAlgorithm{<:Any, <:Any},
<:Any, <:Any, <:Any}, pr::AbstractPriorResult; rd = nothing, kwargs...)Fits the ellipsoidal set of the covariance under normal returns, with a radius that reads no sample.
This is the prior-result method of the verb, and only a set whose pe is nothing has it. Inside an optimiser, pr is the prior that the optimiser solves on. So the set and the objective have the same centre, and the set folds with that prior under the online step. Outside an optimiser, the caller gives prior(pe, X). The returns-data method of the same verb fits the prior of the set through ucs_prior, and then it calls this method. So the two routes use the same body.
This method draws no sample. It is the method for each radius algorithm that reads no sample, which is ChiSqKUncertaintyAlgorithm, GeneralKUncertaintyAlgorithm or a plain number. The method for NormalKUncertaintyAlgorithm draws the sample that the empirical radius needs. The two routes build the same shapes, so they differ only in the radius.
Mathematical definition
\[\mathcal{E}_{\mathbf{\Sigma}} = \left\{\mathbf{\Sigma} : \left\lVert \mathbf{\Sigma}_{\mathbf{\Sigma}}^{-1/2} \operatorname{vec}(\mathbf{\Sigma} - \hat{\mathbf{\Sigma}}) \right\rVert_2 \leq k_{\mathbf{\Sigma}} \right\}\,, \qquad \mathbf{\Sigma}_{\mathbf{\Sigma}} = T (\mathbf{I} + \mathbf{K})(\mathbf{\Sigma}_{\boldsymbol{\mu}} \otimes \mathbf{\Sigma}_{\boldsymbol{\mu}})\,.\]
Where:
- $\mathcal{E}_{\mathbf{\Sigma}}$: Ellipsoidal uncertainty set for the covariance matrix.
- $\mathbf{\Sigma}_{\mathbf{\Sigma}}$: Asymptotic covariance of the covariance estimator, vectorised.
- $\mathbf{\Sigma}_{\boldsymbol{\mu}}$: Asymptotic covariance of the mean estimator, $\hat{\mathbf{\Sigma}} / T$.
- $\mathbf{I}$: Identity matrix.
- $\mathbf{K}$: Commutation matrix.
- $\otimes$: Kronecker product.
- $k_{\mathbf{\Sigma}}$: Radius, the one
k_ucsreturns forue.alg.method. - $\hat{\mathbf{\Sigma}}$: Estimated covariance matrix.
- $T$: Number of observations.
The method gives the significance level to k_ucs with no division, because an ellipsoid cuts only the upper tail of a non-negative distance.
Algorithm
- Reduce the Prior Result
prto the Investable Mask withinvestable_ucs_reductionto getprr. Inside an optimiser,pris 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. - Read
sigma = prr.sigma. - Resolve the scaling parameter
Twithchoose_scaling_parameter. - Build the mean shape
sigma_muwithmu_asymptotic_cov. - Build the covariance shape
sigma_sigmawithnormal_sigma_shape. - Fit the ellipsoid with
ellipsoidal_setonsigma_sigma, withnothingin place of a sample andprr.sigmaas 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: Normal uncertainty set estimator with no prior of its own.pr: Prior Result that the set fits on.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. The method ignores them.
Returns
sigma_ucs::EllipsoidalUncertaintySet: Covariance uncertainty set.
Related
PortfolioOptimisers.sigma_ucs — Method
sigma_ucs(ue::NormalUncertaintySet{Nothing,
<:EllipsoidalUncertaintySetAlgorithm{<:Any, <:Any},
<:Any, <:Any, <:Any}, pr::AbstractPriorResult; rd = nothing, kwargs...)Fits the ellipsoidal set of the covariance under normal returns, with a radius that reads no sample.
This is the prior-result method of the verb, and only a set whose pe is nothing has it. Inside an optimiser, pr is the prior that the optimiser solves on. So the set and the objective have the same centre, and the set folds with that prior under the online step. Outside an optimiser, the caller gives prior(pe, X). The returns-data method of the same verb fits the prior of the set through ucs_prior, and then it calls this method. So the two routes use the same body.
This method draws no sample. It is the method for each radius algorithm that reads no sample, which is ChiSqKUncertaintyAlgorithm, GeneralKUncertaintyAlgorithm or a plain number. The method for NormalKUncertaintyAlgorithm draws the sample that the empirical radius needs. The two routes build the same shapes, so they differ only in the radius.
Mathematical definition
\[\mathcal{E}_{\mathbf{\Sigma}} = \left\{\mathbf{\Sigma} : \left\lVert \mathbf{\Sigma}_{\mathbf{\Sigma}}^{-1/2} \operatorname{vec}(\mathbf{\Sigma} - \hat{\mathbf{\Sigma}}) \right\rVert_2 \leq k_{\mathbf{\Sigma}} \right\}\,, \qquad \mathbf{\Sigma}_{\mathbf{\Sigma}} = T (\mathbf{I} + \mathbf{K})(\mathbf{\Sigma}_{\boldsymbol{\mu}} \otimes \mathbf{\Sigma}_{\boldsymbol{\mu}})\,.\]
Where:
- $\mathcal{E}_{\mathbf{\Sigma}}$: Ellipsoidal uncertainty set for the covariance matrix.
- $\mathbf{\Sigma}_{\mathbf{\Sigma}}$: Asymptotic covariance of the covariance estimator, vectorised.
- $\mathbf{\Sigma}_{\boldsymbol{\mu}}$: Asymptotic covariance of the mean estimator, $\hat{\mathbf{\Sigma}} / T$.
- $\mathbf{I}$: Identity matrix.
- $\mathbf{K}$: Commutation matrix.
- $\otimes$: Kronecker product.
- $k_{\mathbf{\Sigma}}$: Radius, the one
k_ucsreturns forue.alg.method. - $\hat{\mathbf{\Sigma}}$: Estimated covariance matrix.
- $T$: Number of observations.
The method gives the significance level to k_ucs with no division, because an ellipsoid cuts only the upper tail of a non-negative distance.
Algorithm
- Reduce the Prior Result
prto the Investable Mask withinvestable_ucs_reductionto getprr. Inside an optimiser,pris 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. - Read
sigma = prr.sigma. - Resolve the scaling parameter
Twithchoose_scaling_parameter. - Build the mean shape
sigma_muwithmu_asymptotic_cov. - Build the covariance shape
sigma_sigmawithnormal_sigma_shape. - Fit the ellipsoid with
ellipsoidal_setonsigma_sigma, withnothingin place of a sample andprr.sigmaas 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: Normal uncertainty set estimator with no prior of its own.pr: Prior Result that the set fits on.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. The method ignores them.
Returns
sigma_ucs::EllipsoidalUncertaintySet: Covariance uncertainty set.
Related
PortfolioOptimisers.ucs — Method
ucs(ue::NormalUncertaintySet{Nothing,
<:NormBallUncertaintySetAlgorithm{<:NormalKUncertaintyAlgorithm, <:Any, <:Any},
<:Any, <:Any, <:Any}, pr::AbstractPriorResult; rd = nothing, kwargs...)Fits the norm-ball sets of the mean and the covariance under normal returns, with radii from simulated estimation errors.
This is the prior-result method of the verb, and only a set whose pe is nothing has it. Inside an optimiser, pr is the prior that the optimiser solves on. So the set and the objective have the same centre, and the set folds with that prior under the online step. Outside an optimiser, the caller gives prior(pe, X). The returns-data method of the same verb fits the prior of the set through ucs_prior, and then it calls this method. So the two routes use the same body.
The two sets are the two ellipsoids of the ellipsoidal route, with each shape matrix in factored form. So they are the same regions, and they give the same weights. A NormBallUncertaintySet holds the factor, so the consumer factorises nothing when it builds the model. This method draws the two samples from one generator, so the Wishart draws come after the normal draws in the stream.
Algorithm
- Reduce the Prior Result
prto the Investable Mask withinvestable_ucs_reductionto getprr. Inside an optimiser,pris 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. - Read
mu,sigmaandN = size(prr.X, 2)fromprr. - Resolve the scaling parameter
Twithchoose_scaling_parameter. Build the mean shapesigma_muwithmu_asymptotic_cov. - Resolve one generator with
resolve_rng. Draw the two samples withnormal_mu_error_sampleandnormal_sigma_error_sample, mean first. - Build the covariance shape
sigma_sigmawithnormal_sigma_shape. - Assemble the two sets with
norm_ball_set, on the mean shape and on the covariance shape. - Write both sets back onto the full universe with
expand_investable_ucs. 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. - Return the two sets as a tuple, mean first.
Arguments
ue: Normal uncertainty set estimator with no prior of its own.pr: Prior Result that the set fits on.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. The method ignores them.
Returns
mu_ucs::NormBallUncertaintySet: Expected returns uncertainty set.sigma_ucs::NormBallUncertaintySet: Covariance uncertainty set.
Related
NormalUncertaintySetNormBallUncertaintySetAlgorithmNormBallUncertaintySetnorm_ball_setk_norm_ballmu_ucssigma_ucs
References
- [169] J. R. Magnus and H. Neudecker. The Commutation Matrix: Some Properties and Applications. The Annals of Statistics 7, 381–394 (1979). Section 4, Corollary 4.2.
- [12] D. Cajas. Advanced Portfolio Optimization: A Cutting-edge Quantitative Approach (Springer Nature Switzerland, 2025). Section 11.3.2. The original source of this formulation was not found. The formulation follows this work and is not checked against the original.
- [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.ucs — Method
ucs(ue::NormalUncertaintySet{Nothing, <:NormBallUncertaintySetAlgorithm{<:Any, <:Any, <:Any},
<:Any, <:Any, <:Any}, pr::AbstractPriorResult; rd = nothing, kwargs...)Fits the norm-ball sets of the mean and the covariance under normal returns, with radii that read no sample.
This is the prior-result method of the verb, and only a set whose pe is nothing has it. Inside an optimiser, pr is the prior that the optimiser solves on. So the set and the objective have the same centre, and the set folds with that prior under the online step. Outside an optimiser, the caller gives prior(pe, X). The returns-data method of the same verb fits the prior of the set through ucs_prior, and then it calls this method. So the two routes use the same body.
This method draws no sample. It is the method for each radius algorithm that reads no sample, which is ChiSqKUncertaintyAlgorithm, GeneralKUncertaintyAlgorithm or a plain number. The method for NormalKUncertaintyAlgorithm draws the sample that the empirical radius needs. The two routes build the same maps, so they differ only in the radius.
Algorithm
- Reduce the Prior Result
prto the Investable Mask withinvestable_ucs_reductionto getprr. Inside an optimiser,pris 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. - Read
sigma = prr.sigma. - Resolve the scaling parameter
Twithchoose_scaling_parameter. Build the mean shapesigma_muwithmu_asymptotic_cov. - Build the covariance shape
sigma_sigmawithnormal_sigma_shape. - Assemble the two sets with
norm_ball_set, withnothingin place of a sample. - Write both sets back onto the full universe with
expand_investable_ucs. 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. - Return the two sets as a tuple, mean first.
Arguments
ue: Normal uncertainty set estimator with no prior of its own.pr: Prior Result that the set fits on.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. The method ignores them.
Returns
mu_ucs::NormBallUncertaintySet: Expected returns uncertainty set.sigma_ucs::NormBallUncertaintySet: Covariance uncertainty set.
Related
NormalUncertaintySetNormBallUncertaintySetAlgorithmNormBallUncertaintySetnorm_ball_setk_norm_ballmu_ucssigma_ucs
References
- [169] J. R. Magnus and H. Neudecker. The Commutation Matrix: Some Properties and Applications. The Annals of Statistics 7, 381–394 (1979). Section 4, Corollary 4.2.
- [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::NormalUncertaintySet{Nothing,
<:NormBallUncertaintySetAlgorithm{<:NormalKUncertaintyAlgorithm, <:Any, <:Any},
<:Any, <:Any, <:Any}, pr::AbstractPriorResult; rd = nothing, kwargs...)Fits the norm-ball set of the mean under normal returns, with a radius from simulated estimation errors.
This is the prior-result method of the verb, and only a set whose pe is nothing has it. Inside an optimiser, pr is the prior that the optimiser solves on. So the set and the objective have the same centre, and the set folds with that prior under the online step. Outside an optimiser, the caller gives prior(pe, X). The returns-data method of the same verb fits the prior of the set through ucs_prior, and then it calls this method. So the two routes use the same body.
The map is a factor of $\hat{\mathbf{\Sigma}} / T$. So the set is the mean ellipsoid of the ellipsoidal route, with its shape in factored form. This method draws its normal sample from the start of the stream. ucs also draws its mean sample first, so under one seed the two radii are equal.
Algorithm
- Reduce the Prior Result
prto the Investable Mask withinvestable_ucs_reductionto getprr. Inside an optimiser,pris 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. - Read
muandsigmafromprr. - Resolve the scaling parameter
Twithchoose_scaling_parameter. Build the mean shapesigma_muwithmu_asymptotic_cov. - Resolve the generator with
resolve_rng. Draw the sample withnormal_mu_error_sample. - Assemble the set with
norm_ball_set, withprr.muas 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: Normal uncertainty set estimator with no prior of its own.pr: Prior Result that the set fits on.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. The method ignores them.
Returns
mu_ucs::NormBallUncertaintySet: Expected returns uncertainty set.
Related
NormalUncertaintySetNormBallUncertaintySetAlgorithmNormBallUncertaintySetnorm_ball_setnormal_mu_error_samplesigma_ucs
References
- [12] D. Cajas. Advanced Portfolio Optimization: A Cutting-edge Quantitative Approach (Springer Nature Switzerland, 2025). Section 11.3.2. The original source of this formulation was not found. The formulation follows this work and is not checked against the original.
- [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::NormalUncertaintySet{Nothing, <:NormBallUncertaintySetAlgorithm{<:Any, <:Any, <:Any},
<:Any, <:Any, <:Any}, pr::AbstractPriorResult; rd = nothing, kwargs...)Fits the norm-ball set of the mean under normal returns, with a radius that reads no sample.
This is the prior-result method of the verb, and only a set whose pe is nothing has it. Inside an optimiser, pr is the prior that the optimiser solves on. So the set and the objective have the same centre, and the set folds with that prior under the online step. Outside an optimiser, the caller gives prior(pe, X). The returns-data method of the same verb fits the prior of the set through ucs_prior, and then it calls this method. So the two routes use the same body.
This method draws no sample. It is the method for each radius algorithm that reads no sample, which is ChiSqKUncertaintyAlgorithm, GeneralKUncertaintyAlgorithm or a plain number. The method for NormalKUncertaintyAlgorithm draws the sample that the empirical radius needs, and builds the same map.
Algorithm
- Reduce the Prior Result
prto the Investable Mask withinvestable_ucs_reductionto getprr. Inside an optimiser,pris 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. - Read
sigma = prr.sigma. - Resolve the scaling parameter
Twithchoose_scaling_parameter. Build the mean shapesigma_muwithmu_asymptotic_cov. - Assemble the set with
norm_ball_set, withnothingin place of a sample andprr.muas 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: Normal uncertainty set estimator with no prior of its own.pr: Prior Result that the set fits on.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. The method ignores them.
Returns
mu_ucs::NormBallUncertaintySet: Expected returns uncertainty set.
Related
NormalUncertaintySetNormBallUncertaintySetAlgorithmNormBallUncertaintySetnorm_ball_setk_norm_ballsigma_ucs
References
- [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::NormalUncertaintySet{Nothing,
<:NormBallUncertaintySetAlgorithm{<:NormalKUncertaintyAlgorithm, <:Any, <:Any},
<:Any, <:Any, <:Any}, pr::AbstractPriorResult; rd = nothing, kwargs...)Fits the norm-ball set of the covariance under normal returns, with a radius from simulated estimation errors.
This is the prior-result method of the verb, and only a set whose pe is nothing has it. Inside an optimiser, pr is the prior that the optimiser solves on. So the set and the objective have the same centre, and the set folds with that prior under the online step. Outside an optimiser, the caller gives prior(pe, X). The returns-data method of the same verb fits the prior of the set through ucs_prior, and then it calls this method. So the two routes use the same body.
The map is a factor of the asymptotic covariance of the vectorised covariance. So the set is the covariance ellipsoid of the ellipsoidal route, with its shape in factored form. Under one seed, this radius differs from the covariance radius of ucs. This method draws its Wishart matrices from the start of the stream, and ucs draws its mean sample first. Both radii are valid fits of the same quantity.
Algorithm
- Reduce the Prior Result
prto the Investable Mask withinvestable_ucs_reductionto getprr. Inside an optimiser,pris 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. - Read
sigma = prr.sigmaandN = size(prr.X, 2). - Resolve the scaling parameter
Twithchoose_scaling_parameter. Build the mean shapesigma_muwithmu_asymptotic_cov. - Resolve the generator with
resolve_rng. Draw the sample withnormal_sigma_error_sample. - Build the covariance shape
sigma_sigmawithnormal_sigma_shape. - Assemble the set with
norm_ball_set, withprr.sigmaas 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: Normal uncertainty set estimator with no prior of its own.pr: Prior Result that the set fits on.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. The method ignores them.
Returns
sigma_ucs::NormBallUncertaintySet: Covariance uncertainty set.
Related
NormalUncertaintySetNormBallUncertaintySetAlgorithmNormBallUncertaintySetnorm_ball_setnormal_sigma_error_samplemu_ucs
References
- [169] J. R. Magnus and H. Neudecker. The Commutation Matrix: Some Properties and Applications. The Annals of Statistics 7, 381–394 (1979). Section 4, Corollary 4.2.
- [12] D. Cajas. Advanced Portfolio Optimization: A Cutting-edge Quantitative Approach (Springer Nature Switzerland, 2025). Section 11.3.2. The original source of this formulation was not found. The formulation follows this work and is not checked against the original.
- [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::NormalUncertaintySet{Nothing, <:NormBallUncertaintySetAlgorithm{<:Any, <:Any, <:Any},
<:Any, <:Any, <:Any}, pr::AbstractPriorResult; rd = nothing, kwargs...)Fits the norm-ball set of the covariance under normal returns, with a radius that reads no sample.
This is the prior-result method of the verb, and only a set whose pe is nothing has it. Inside an optimiser, pr is the prior that the optimiser solves on. So the set and the objective have the same centre, and the set folds with that prior under the online step. Outside an optimiser, the caller gives prior(pe, X). The returns-data method of the same verb fits the prior of the set through ucs_prior, and then it calls this method. So the two routes use the same body.
This method draws no sample. It is the method for each radius algorithm that reads no sample, which is ChiSqKUncertaintyAlgorithm, GeneralKUncertaintyAlgorithm or a plain number. The method for NormalKUncertaintyAlgorithm draws the sample that the empirical radius needs, and builds the same map.
Algorithm
- Reduce the Prior Result
prto the Investable Mask withinvestable_ucs_reductionto getprr. Inside an optimiser,pris 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. - Read
sigma = prr.sigma. - Resolve the scaling parameter
Twithchoose_scaling_parameter. Build the mean shapesigma_muwithmu_asymptotic_cov. - Build the covariance shape
sigma_sigmawithnormal_sigma_shape. - Assemble the set with
norm_ball_set, withnothingin place of a sample andprr.sigmaas 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: Normal uncertainty set estimator with no prior of its own.pr: Prior Result that the set fits on.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. The method ignores them.
Returns
sigma_ucs::NormBallUncertaintySet: Covariance uncertainty set.
Related
NormalUncertaintySetNormBallUncertaintySetAlgorithmNormBallUncertaintySetnorm_ball_setk_norm_ballmu_ucs
References
- [169] J. R. Magnus and H. Neudecker. The Commutation Matrix: Some Properties and Applications. The Annals of Statistics 7, 381–394 (1979). Section 4, Corollary 4.2.
- [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).
- [169]
- J. R. Magnus and H. Neudecker. The Commutation Matrix: Some Properties and Applications. The Annals of Statistics 7, 381–394 (1979).
- [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).
- [174]
- J. Wishart. The Generalised Product Moment Distribution in Samples from a Normal Multivariate Population. Biometrika 20A, 32–52 (1928).