Shrunk Expected Returns: private API
PortfolioOptimisers.AbstractShrunkExpectedReturnsEstimator — Type
abstract type AbstractShrunkExpectedReturnsEstimator <: AbstractExpectedReturnsEstimatorAbstract supertype for all shrunk expected returns estimators.
All concrete and/or abstract types implementing shrinkage-based expected returns estimation algorithms should be subtypes of AbstractShrunkExpectedReturnsEstimator.
Related
PortfolioOptimisers.AbstractShrunkExpectedReturnsAlgorithm — Type
abstract type AbstractShrunkExpectedReturnsAlgorithm <: AbstractExpectedReturnsAlgorithmAbstract supertype for all shrinkage algorithms for expected returns estimation.
All concrete and/or abstract types implementing specific shrinkage algorithms (e.g., James-Stein, Bayes-Stein) should be subtypes of AbstractShrunkExpectedReturnsAlgorithm.
Related
References
- [5] D. Cajas. Advanced Portfolio Optimization: A Cutting-edge Quantitative Approach (Springer Nature Switzerland, 2025). Section 3.4.1.
PortfolioOptimisers.AbstractShrunkExpectedReturnsTarget — Type
abstract type AbstractShrunkExpectedReturnsTarget <: AbstractExpectedReturnsAlgorithmAbstract supertype for all shrinkage targets used in expected returns estimation.
Concrete types implementing specific shrinkage targets (e.g., grand mean, volatility-weighted mean) should subtype AbstractShrunkExpectedReturnsTarget.
Related
References
- [5] D. Cajas. Advanced Portfolio Optimization: A Cutting-edge Quantitative Approach (Springer Nature Switzerland, 2025). Equation 3.43.
- [25] A. Meucci. Risk and Asset Allocation (Springer Berlin Heidelberg, 2005).
- [26] Y. Feng and D. P. Palomar. A signal processing perspective of financial engineering. Foundations and Trends in Signal Processing 9, 1–231 (2016).
PortfolioOptimisers.target_mean — Function
target_mean(
tgt::GrandMean,
mu::ArrNum,
sigma::MatNum,
args...;
kwargs...
) -> StepRangeLen
target_mean(
tgt::VolatilityWeighted,
mu::ArrNum,
sigma::MatNum,
isigma::Option{<:MatNum} = nothing;
kwargs...
) -> StepRangeLen
target_mean(
tgt::MeanSquaredError,
mu::ArrNum,
sigma::MatNum,
args...;
T::Integer,
kwargs...
) -> StepRangeLenCompute the shrinkage target vector for expected returns estimation.
target_mean is the single owner of the three shrinkage targets. JamesStein, BayesStein and BodnarOkhrinParolya all reach it, so each target is written once.
Every element of the returned vector holds the same value, so the function returns a StepRangeLen rather than a dense vector.
Algorithm
The method that Julia selects is the algorithm, and the closed form of each branch lives on the tag that selects it. Every branch ends the same way: it computes one scalar val and returns range(val, val; length = length(mu)), a constant range rather than a dense vector.
tgtis aGrandMean: take the unweighted mean ofmu. It reads neithersigmanorisigmanorT.tgtis aVolatilityWeighted: solve forisigmawhen the caller passed none, flattenmuwhen it has one row, then divide the sum ofisigma * muby the sum ofisigma.tgtis aMeanSquaredError: divide the trace ofsigmaby the keywordT. It reads neithermunorisigma, so only the length ofmureaches the result.
Each branch takes the arguments the other two do not need through args... and kwargs..., so one call site serves all three.
Arguments
tgt: The shrinkage target type.tgt::GrandMean: Fills the vector with the mean ofmu.tgt::VolatilityWeighted: Fills the vector with the inverse-covariance-weighted mean ofmu.tgt::MeanSquaredError: Fills the vector with the trace ofsigmadivided byT.
mu: 1D array of expected returns.sigma: Covariance matrixassets × assets.isigma: Inverse covariance matrix, taken positionally by theVolatilityWeightedmethod. Ifnothing, the method computessigma \ LinearAlgebra.Iitself. The other two methods swallow it inargs....T: Number of observations. It is a required keyword of theMeanSquaredErrormethod. The other two methods swallow it inkwargs....kwargs...: Additional keyword arguments (ignored).
Returns
b::StepRangeLen: Target vector for shrinkage estimation, of lengthlength(mu).
Related
GrandMean: the closed form of the branch of step 1.VolatilityWeighted: the closed form of the branch of step 2.MeanSquaredError: the closed form of the branch of step 3.AbstractShrunkExpectedReturnsTargetShrunkExpectedReturnsArrNumMatNumOption
References
- [5] D. Cajas. Advanced Portfolio Optimization: A Cutting-edge Quantitative Approach (Springer Nature Switzerland, 2025). Equation 3.43.
- [25] A. Meucci. Risk and Asset Allocation (Springer Berlin Heidelberg, 2005).
- [26] Y. Feng and D. P. Palomar. A signal processing perspective of financial engineering. Foundations and Trends in Signal Processing 9, 1–231 (2016).
References
- [5]
- D. Cajas. Advanced Portfolio Optimization: A Cutting-edge Quantitative Approach (Springer Nature Switzerland, 2025).
- [25]
- A. Meucci. Risk and Asset Allocation (Springer Berlin Heidelberg, 2005).
- [26]
- Y. Feng and D. P. Palomar. A signal processing perspective of financial engineering. Foundations and Trends in Signal Processing 9, 1–231 (2016).