Shrunk Expected Returns
PortfolioOptimisers.GrandMean Type
struct GrandMean <: AbstractShrunkExpectedReturnsTarget endShrinkage target representing the grand mean of expected returns.
GrandMean computes the shrinkage target as the mean of all asset expected returns, resulting in a vector where each element is the same grand mean value. This is commonly used in shrinkage estimators to reduce estimation error by pulling individual expected returns toward the overall average.
Related
sourcePortfolioOptimisers.VolatilityWeighted Type
struct VolatilityWeighted <: AbstractShrunkExpectedReturnsTarget endShrinkage target representing the volatility-weighted mean of expected returns.
VolatilityWeighted computes the shrinkage target as a weighted mean of expected returns, where weights are inversely proportional to asset volatility (from the inverse covariance matrix). This approach accounts for differences in asset risk when estimating the shrinkage target.
Related
sourcePortfolioOptimisers.MeanSquaredError Type
struct MeanSquaredError <: AbstractShrunkExpectedReturnsTarget endShrinkage target representing the mean squared error of expected returns.
MeanSquaredError computes the shrinkage target as the trace of the covariance matrix divided by the number of observations, resulting in a vector where each element is the same value. This target is useful for certain shrinkage estimators that minimize mean squared error.
Related
sourcePortfolioOptimisers.JamesStein Type
struct JamesStein{T1} <: AbstractShrunkExpectedReturnsAlgorithm
target::T1
endShrinkage algorithm implementing the James-Stein estimator for expected returns.
JamesStein applies shrinkage to asset expected returns by pulling them toward a specified target (e.g., grand mean, volatility-weighted mean). The estimator reduces estimation error, especially in high-dimensional settings.
Fields
target: The shrinkage target type.
Constructor
JamesStein(; target::AbstractShrunkExpectedReturnsTarget = GrandMean())Keyword arguments correspond to the fields above.
Examples
julia> JamesStein()
JamesStein
target ┴ GrandMean()Related
PortfolioOptimisers.BayesStein Type
struct BayesStein{T1} <: AbstractShrunkExpectedReturnsAlgorithm
target::T1
endShrinkage algorithm implementing the Bayes-Stein estimator for expected returns.
BayesStein applies shrinkage to asset expected returns by pulling them toward a specified target (e.g., grand mean, volatility-weighted mean) using Bayesian principles. This estimator is useful for reducing estimation error, especially when sample sizes are small.
Fields
target: The shrinkage target type.
Constructor
BayesStein(; target::AbstractShrunkExpectedReturnsTarget = GrandMean())Keyword arguments correspond to the fields above.
Examples
julia> BayesStein()
BayesStein
target ┴ GrandMean()Related
PortfolioOptimisers.BodnarOkhrinParolya Type
struct BodnarOkhrinParolya{T1} <: AbstractShrunkExpectedReturnsAlgorithm
target::T1
endShrinkage algorithm implementing the Bodnar-Okhrin-Parolya estimator for expected returns.
BodnarOkhrinParolya applies shrinkage to asset expected returns by pulling them toward a specified target (e.g., grand mean, volatility-weighted mean) using the Bodnar-Okhrin-Parolya approach. This estimator is designed for robust estimation in high-dimensional settings.
Fields
target: The shrinkage target type.
Constructor
BodnarOkhrinParolya(; target::AbstractShrunkExpectedReturnsTarget = GrandMean())Keyword arguments correspond to the fields above.
Examples
julia> BodnarOkhrinParolya()
BodnarOkhrinParolya
target ┴ GrandMean()Related
sourcePortfolioOptimisers.ShrunkExpectedReturns Type
struct ShrunkExpectedReturns{T1, T2, T3} <: AbstractShrunkExpectedReturnsEstimator
me::T1
ce::T2
alg::T3
endContainer type for shrinkage-based expected returns estimators.
ShrunkExpectedReturns encapsulates all components required for shrinkage estimation of expected returns, including the mean estimator, covariance estimator, and shrinkage algorithm. This enables modular and extensible workflows for robust expected returns estimation using shrinkage techniques.
Fields
me: Mean estimator for expected returns.ce: Covariance estimator.alg: Shrinkage algorithm (e.g., James-Stein, Bayes-Stein).
Constructor
ShrunkExpectedReturns(; me::AbstractExpectedReturnsEstimator = SimpleExpectedReturns(),
ce::StatsBase.CovarianceEstimator = PortfolioOptimisersCovariance(),
alg::AbstractShrunkExpectedReturnsAlgorithm = JamesStein())Keyword arguments correspond to the fields above.
Examples
julia> ShrunkExpectedReturns()
ShrunkExpectedReturns
me ┼ SimpleExpectedReturns
│ w ┴ nothing
ce ┼ PortfolioOptimisersCovariance
│ ce ┼ Covariance
│ │ me ┼ SimpleExpectedReturns
│ │ │ w ┴ nothing
│ │ ce ┼ GeneralCovariance
│ │ │ ce ┼ StatsBase.SimpleCovariance: StatsBase.SimpleCovariance(true)
│ │ │ w ┴ nothing
│ │ alg ┴ Full()
│ mp ┼ DefaultMatrixProcessing
│ │ pdm ┼ Posdef
│ │ │ alg ┴ UnionAll: NearestCorrelationMatrix.Newton
│ │ denoise ┼ nothing
│ │ detone ┼ nothing
│ │ alg ┴ nothing
alg ┼ JamesStein
│ target ┴ GrandMean()Related
Statistics.mean Method
mean(me::ShrunkExpectedReturns, X::AbstractMatrix; dims::Int = 1, kwargs...)Compute shrunk expected returns using the specified estimator.
This method applies a shrinkage algorithm to the sample expected returns, pulling them toward a specified target to reduce estimation error, especially in high-dimensional settings.
Arguments
me: Shrunk expected returns estimator.me::ShrunkExpectedReturns{<:Any, <:Any, <:JamesStein}: Use the James-Stein algorithm.me::ShrunkExpectedReturns{<:Any, <:Any, <:BayesStein}: Use the Bayes-Stein algorithm.me::ShrunkExpectedReturns{<:Any, <:Any, <:BodnarOkhrinParolya}: Use the Bodnar-Okhrin-Parolya algorithm.
X: Data matrix (observations × assets).dims: Dimension along which to compute the mean.kwargs...: Additional keyword arguments passed to the mean and covariance estimators.
Returns
mu::AbstractArray: Shrunk expected returns vector.
Details
Computes the sample mean and covariance.
Computes the shrinkage target using
target_mean.Computes the shrinkage intensity
alphawith:JamesStein: the centered mean and eigenvalues of the covariance matrix.BayesStein: a Bayesian formula involving the centered mean and inverse covariance.BodnarOkhrinParolya: a Bayesian formula involving the target mean, mean and inverse covariance.
ReturnsResult the shrunk mean vector.
Related
sourcePortfolioOptimisers.AbstractShrunkExpectedReturnsEstimator Type
abstract type AbstractShrunkExpectedReturnsEstimator <: AbstractExpectedReturnsEstimator endAbstract supertype for all shrunk expected returns estimators in PortfolioOptimisers.jl.
All concrete types implementing shrinkage-based expected returns estimation algorithms should subtype AbstractShrunkExpectedReturnsEstimator. This enables a consistent interface for shrinkage estimators throughout the package.
Related
sourcePortfolioOptimisers.AbstractShrunkExpectedReturnsAlgorithm Type
abstract type AbstractShrunkExpectedReturnsAlgorithm <: AbstractExpectedReturnsAlgorithm endAbstract supertype for all shrinkage algorithms for expected returns estimation.
All concrete types implementing specific shrinkage algorithms (e.g., James-Stein, Bayes-Stein) should subtype AbstractShrunkExpectedReturnsAlgorithm. This enables flexible extension and dispatch of shrinkage routines.
Related
sourcePortfolioOptimisers.AbstractShrunkExpectedReturnsTarget Type
abstract type AbstractShrunkExpectedReturnsTarget <: AbstractExpectedReturnsAlgorithm endAbstract 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. This enables modular selection of shrinkage targets in shrinkage algorithms.
Related
sourcePortfolioOptimisers.target_mean Function
target_mean(::AbstractShrunkExpectedReturnsTarget, mu::AbstractArray, sigma::AbstractMatrix;
kwargs...)Compute the shrinkage target vector for expected returns estimation.
target_mean calculates the target vector toward which expected returns are shrunk, based on the specified shrinkage target type. This function is used internally by shrinkage estimators such as James-Stein, Bayes-Stein, and Bodnar-Okhrin-Parolya.
Arguments
target: The shrinkage target type.target::GrandMean: Returns a vector filled with the mean ofmu.target::VolatilityWeighted: Returns a vector filled with the volatility-weighted mean ofmu, using the inverse covariance matrix.target::MeanSquaredError: Returns a vector filled with the trace ofsigmadivided byT.
mu: 1D array of expected returns.sigma: Covariance matrix of asset returns.kwargs...: Additional keyword arguments, such asT(number of observations) orisigma(inverse covariance matrix).
Returns
b::AbstractArray: Target vector for shrinkage estimation.
Related
source