Skip to content
13

Shrunk Expected Returns

PortfolioOptimisers.GrandMean Type
julia
struct GrandMean <: AbstractShrunkExpectedReturnsTarget

Shrinkage 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.

Constructors

julia
GrandMean() -> GrandMean

Examples

julia
julia> GrandMean()
GrandMean()

Related

source
PortfolioOptimisers.VolatilityWeighted Type
julia
struct VolatilityWeighted <: AbstractShrunkExpectedReturnsTarget

Shrinkage 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.

Constructors

julia
VolatilityWeighted() -> VolatilityWeighted

Examples

julia
julia> VolatilityWeighted()
VolatilityWeighted()

Related

source
PortfolioOptimisers.MeanSquaredError Type
julia
struct MeanSquaredError <: AbstractShrunkExpectedReturnsTarget

Shrinkage 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.

Constructors

julia
MeanSquaredError() -> MeanSquaredError

Examples

julia
julia> MeanSquaredError()
MeanSquaredError()

Related

source
PortfolioOptimisers.JamesStein Type
julia
struct JamesStein{__T_tgt} <: AbstractShrunkExpectedReturnsAlgorithm

Shrinkage 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

  • tgt: Shrinkage target.

Constructors

julia
JamesStein(;
    tgt::AbstractShrunkExpectedReturnsTarget = GrandMean()
) -> JamesStein

Keywords correspond to the struct's fields.

Examples

julia
julia> JamesStein()
JamesStein
  tgt ┴ GrandMean()

Related

source
PortfolioOptimisers.BayesStein Type
julia
struct BayesStein{__T_tgt} <: AbstractShrunkExpectedReturnsAlgorithm

Shrinkage 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

  • tgt: Shrinkage target.

Constructors

julia
BayesStein(;
    tgt::AbstractShrunkExpectedReturnsTarget = GrandMean()
) -> BayesStein

Keywords correspond to the struct's fields.

Examples

julia
julia> BayesStein()
BayesStein
  tgt ┴ GrandMean()

Related

source
PortfolioOptimisers.BodnarOkhrinParolya Type
julia
struct BodnarOkhrinParolya{__T_tgt} <: AbstractShrunkExpectedReturnsAlgorithm

Shrinkage 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

  • tgt: Shrinkage target.

Constructors

julia
BodnarOkhrinParolya(;
    tgt::AbstractShrunkExpectedReturnsTarget = GrandMean()
) -> BodnarOkhrinParolya

Keywords correspond to the struct's fields.

Examples

julia
julia> BodnarOkhrinParolya()
BodnarOkhrinParolya
  tgt ┴ GrandMean()

Related

source
PortfolioOptimisers.ShrunkExpectedReturns Type
julia
struct ShrunkExpectedReturns{__T_me, __T_ce, __T_alg} <: AbstractShrunkExpectedReturnsEstimator

Container 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.

Fields

  • me: Expected returns estimator.

  • ce: Covariance estimator.

  • alg: Expected returns shrinkage algorithm.

Constructors

julia
ShrunkExpectedReturns(;
    me::AbstractExpectedReturnsEstimator = SimpleExpectedReturns(),
    ce::StatsBase.CovarianceEstimator = PortfolioOptimisersCovariance(),
    alg::AbstractShrunkExpectedReturnsAlgorithm = JamesStein()
) -> ShrunkExpectedReturns

Keywords correspond to the struct's fields.

Propagated parameters

When factory is called on this type, the following @fprop-tagged fields are automatically propagated:

  • me: Recursively updated via factory.

  • ce: Recursively updated via factory.

View parameters

When port_opt_view is called on this type, the following @vprop-tagged fields are automatically subset to the selected indices:

Examples

julia
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 ┼ MatrixProcessing
      │      │     pdm ┼ Posdef
      │      │         │      alg ┼ UnionAll: NearestCorrelationMatrix.Newton
      │      │         │   kwargs ┴ @NamedTuple{}: NamedTuple()
      │      │      dn ┼ nothing
      │      │      dt ┼ nothing
      │      │     alg ┼ nothing
      │      │   order ┴ NTuple{4, Symbol}: (:pdm, :dn, :dt, :alg)
  alg ┼ JamesStein
      │   tgt ┴ GrandMean()

Related

source
Statistics.mean Method
julia
Statistics.mean(me::ShrunkExpectedReturns, X::MatNum; 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.

Mathematical definition

James-Stein shrinkage of sample expected returns toward target b:

μ^JS=(1α)μ^+αb.

Where:

  • μ^JS: James-Stein shrunk expected returns.

  • μ^: N×1 sample expected returns.

  • b: N×1 shrinkage target vector.

  • α: Shrinkage intensity.

The shrinkage intensity is:

α=Nλ¯2λmaxTμ^b22.

Where:

  • λ¯: Mean eigenvalue of the covariance matrix.

  • λmax: Maximum eigenvalue of the covariance matrix.

  • T: Number of observations.

  • N: Number of assets.

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 perform the computation.

  • kwargs...: Additional keyword arguments passed to the mean and covariance estimators.

Returns

  • mu::ArrNum: Shrunk expected returns vector.

Details

  • Computes the sample mean and covariance.

  • Computes the shrinkage target using target_mean.

  • Computes the shrinkage intensity alpha with:

    • 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.

  • Returns the shrunk mean vector.

Related

source
Statistics.mean Method
julia
mean(
    me::ShrunkExpectedReturns{<:Any, <:Any, <:BayesStein},
    X::AbstractMatrix{<:Union{var"#s20", var"#s19"} where {var"#s20"<:Number, var"#s19"<:AbstractJuMPScalar}};
    dims,
    kwargs...
) -> Any

BayesStein overload of mean(me::ShrunkExpectedReturns, X::MatNum; dims::Int = 1, kwargs...). Shrinks sample returns toward the target using a Bayesian formula with inverse covariance weighting.

Mathematical definition

Bayes-Stein shrinkage intensity:

α=N+2(N+2)+T(μ^b)Σ^1(μ^b),μ^BS=(1α)μ^+αb.

Where:

  • α: Bayes-Stein shrinkage intensity.

  • μ^BS: Bayes-Stein shrunk expected returns.

  • μ^: N×1 sample expected returns.

  • b: N×1 shrinkage target vector.

  • Σ^: N×N sample covariance matrix.

  • T: Number of observations.

  • N: Number of assets.

source
Statistics.mean Method
julia
mean(
    me::ShrunkExpectedReturns{<:Any, <:Any, <:BodnarOkhrinParolya},
    X::AbstractMatrix{<:Union{var"#s20", var"#s19"} where {var"#s20"<:Number, var"#s19"<:AbstractJuMPScalar}};
    dims,
    kwargs...
) -> Any

BodnarOkhrinParolya overload of mean(me::ShrunkExpectedReturns, X::MatNum; dims::Int = 1, kwargs...). Shrinks sample returns toward the target using the Bodnar-Okhrin-Parolya formula, designed for robust high-dimensional estimation.

Mathematical definition

Define scalars:

u=μ^Σ^1μ^,v=bΣ^1b,w=μ^Σ^1b.

Where:

  • u, v, w: Inverse-covariance-weighted quadratic forms.

  • μ^: N×1 sample expected returns.

  • b: N×1 shrinkage target vector.

  • Σ^: N×N sample covariance matrix.

α=(uN/(TN))vw2uvw2,β=(1α)wu.

Where:

  • α, β: Shrinkage coefficients.

  • T: Number of observations.

  • N: Number of assets.

μ^BOP=αμ^+βb.

Where:

  • μ^BOP: Bodnar-Okhrin-Parolya shrunk expected returns.
source
PortfolioOptimisers.AbstractShrunkExpectedReturnsEstimator Type
julia
abstract type AbstractShrunkExpectedReturnsEstimator <: AbstractExpectedReturnsEstimator

Abstract supertype for all shrunk expected returns estimators in PortfolioOptimisers.jl.

All concrete and/or abstract types implementing shrinkage-based expected returns estimation algorithms should be subtypes of AbstractShrunkExpectedReturnsEstimator.

Related

source
PortfolioOptimisers.AbstractShrunkExpectedReturnsAlgorithm Type
julia
abstract type AbstractShrunkExpectedReturnsAlgorithm <: AbstractExpectedReturnsAlgorithm

Abstract 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

source
PortfolioOptimisers.AbstractShrunkExpectedReturnsTarget Type
julia
abstract type AbstractShrunkExpectedReturnsTarget <: AbstractExpectedReturnsAlgorithm

Abstract 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

source
PortfolioOptimisers.target_mean Function
julia
target_mean(::AbstractShrunkExpectedReturnsTarget, mu::ArrNum, sigma::MatNum, args...;
            kwargs...)

Compute the shrinkage target vector for expected returns estimation.

target_mean computes 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.

Mathematical definition

GrandMean: each target element is the grand mean of sample expected returns:

bj=μ¯=1Ni=1Nμ^i,j=1,,N.

Where:

  • bj: j-th element of the shrinkage target vector.

  • μ^: N×1 vector of sample expected returns.

  • N: Number of assets.

VolatilityWeighted: each target element is the inverse-covariance-weighted mean:

bj=μ¯vol=1Σ^1μ^1Σ^11,j=1,,N.

Where:

  • bj: j-th element of the shrinkage target vector.

  • Σ^: N×N sample covariance matrix.

  • μ^: N×1 sample expected returns vector.

  • 1: N×1 vector of ones.

MeanSquaredError: each target element is the scaled matrix trace:

bj=tr(Σ^)T,j=1,,N.

Where:

  • bj: j-th element of the shrinkage target vector.

  • tr(): Matrix trace operator.

  • Σ^: N×N sample covariance matrix.

  • T: Number of observations.

Arguments

  • tgt: The shrinkage target type.

    • tgt::GrandMean: Returns a vector filled with the mean of mu.

    • tgt::VolatilityWeighted: Returns a vector filled with the volatility-weighted mean of mu, using the inverse covariance matrix.

    • tgt::MeanSquaredError: Returns a vector filled with the trace of sigma divided by T.

  • mu: 1D array of expected returns.

  • sigma: Covariance matrix of asset returns.

  • kwargs...: Additional keyword arguments, such as T (number of observations) or isigma (inverse covariance matrix).

Returns

  • b::ArrNum: Target vector for shrinkage estimation.

Related

source