Skip to content
5

Empirical Prior

PortfolioOptimisers.EmpiricalPrior Type
julia
struct EmpiricalPrior{T1, T2, T3} <: AbstractLowOrderPriorEstimator_A
    ce::T1
    me::T2
    horizon::T3
end

Empirical prior estimator for asset returns.

EmpiricalPrior is a low order prior estimator that computes the mean and covariance of asset returns using empirical (sample-based) statistics. It supports custom expected returns and covariance estimators, as well as an optional investment horizon for log-normalisation and scaling.

Fields

  • ce: Covariance estimator.

  • me: Expected returns estimator.

  • horizon: Optional investment horizon.

Constructor

julia
EmpiricalPrior(; ce::StatsBase.CovarianceEstimator = PortfolioOptimisersCovariance(),
               me::AbstractExpectedReturnsEstimator = SimpleExpectedReturns(),
               horizon::Union{Nothing, <:Real} = nothing)

Keyword arguments correspond to the fields above.

Validation

  • If horizon is not nothing, horizon > 0.

Examples

julia
julia> EmpiricalPrior()
EmpiricalPrior
       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
       me ┼ SimpleExpectedReturns
          │   w ┴ nothing
  horizon ┴ nothing

Related

source
PortfolioOptimisers.prior Method
julia
prior(pe::EmpiricalPrior{<:Any, <:Any, Nothing}, X::AbstractMatrix, args...; dims::Int = 1,
      kwargs...)

Compute empirical prior moments for asset returns (no horizon adjustment).

prior estimates the mean and covariance of asset returns using the specified empirical prior estimator, without log-normalisation or scaling for investment horizon. The mean and covariance are computed using the estimators stored in pe, and returned in a LowOrderPrior result.

Arguments

  • pe: Empirical prior estimator.

  • X: Asset returns matrix (observations × assets).

  • args...: Additional positional arguments (ignored).

  • dims: Dimension along which to compute moments.

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

Returns

  • pr::LowOrderPrior: Result object containing asset returns, mean vector, and covariance matrix.

Validation

  • dims in (1, 2).

Related

source
PortfolioOptimisers.prior Method
julia
prior(pe::EmpiricalPrior{<:Any, <:Any, <:Real}, X::AbstractMatrix, args...; dims::Int = 1,
      kwargs...)

Compute empirical prior moments for asset returns with investment horizon adjustment.

prior estimates the mean and covariance of asset returns using the specified empirical prior estimator, applying log-normalisation and scaling for the investment horizon. The asset returns are log-transformed, moments are computed using the estimators stored in pe, and then rescaled according to the investment horizon. The final mean and covariance are transformed back to arithmetic returns and returned in a LowOrderPrior result.

Arguments

  • pe: Empirical prior estimator.

  • X: Asset returns matrix (observations × assets).

  • args...: Additional positional arguments (ignored).

  • dims: Dimension along which to compute moments.

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

Returns

  • pr::LowOrderPrior: Result object containing asset returns, mean vector, and covariance matrix.

Validation

  • dims in (1, 2).

Related

source