Skip to content
18

High Order Factor Prior

PortfolioOptimisers.AbstractHighOrderPriorEstimator_F Type
julia
abstract type AbstractHighOrderPriorEstimator_F <: AbstractHighOrderPriorEstimator

High order prior estimator using factor returns.

AbstractHighOrderPriorEstimator_F is the base type for estimators that compute high order moments (such as coskewness and cokurtosis) requiring both asset and factor returns data. All concrete factor-based high order prior estimators should subtype this type.

Related

source
PortfolioOptimisers.AbstractHiLoOrderPriorEstimator_F Type
julia
const AbstractHiLoOrderPriorEstimator_F = Union{<:AbstractLowOrderPriorEstimator_F,
                                                <:AbstractHighOrderPriorEstimator_F}

Alias for a union of low-order and high-order factor prior estimator types.

Related

source
PortfolioOptimisers.HighOrderFactorPriorEstimator Type
julia
struct HighOrderFactorPriorEstimator{__T_pe, __T_kte, __T_ske, __T_ex, __T_rsd} <: AbstractHighOrderPriorEstimator_F

Represents the High Order Factor Prior Estimator.

HighOrderFactorPriorEstimator extends a low-order factor prior with coskewness and cokurtosis moments estimated from a factor model. It supports error correction of higher-order moments using residuals from the factor regression.

Fields

  • pe: Prior estimator.

  • kte: Cokurtosis estimator.

  • ske: Coskewness estimator.

  • ex: Parallel execution strategy.

  • rsd: Whether to include residual variance in the posterior covariance.

Constructors

julia
HighOrderFactorPriorEstimator(;
    pe::AbstractLowOrderPriorEstimator_F_AF = FactorPrior(),
    kte::Option{<:CokurtosisEstimator} = Cokurtosis(; alg = FullMoment()),
    ske::Option{<:CoskewnessEstimator} = Coskewness(; alg = FullMoment()),
    ex::FLoops.Transducers.Executor = FLoops.ThreadedEx(),
    rsd::Bool = true
) -> HighOrderFactorPriorEstimator

Keywords correspond to the struct's fields.

Examples

julia
julia> HighOrderFactorPriorEstimator()
HighOrderFactorPriorEstimator
   pe ┼ FactorPrior
      │    pe ┼ EmpiricalPrior
      │       │        ce ┼ PortfolioOptimisersCovariance
      │       │           │   ce ┼ Covariance
      │       │           │      │    me ┼ SimpleExpectedReturns
      │       │           │      │       │   w ┴ nothing
      │       │           │      │    ce ┼ GeneralCovariance
      │       │           │      │       │   ce ┼ StatsBase.SimpleCovariance: StatsBase.SimpleCovariance(true)
      │       │           │      │       │    w ┴ nothing
      │       │           │      │   alg ┴ FullMoment()
      │       │           │   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
      │    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)
      │    re ┼ StepwiseRegression
      │       │   crit ┼ PValue
      │       │        │   t ┴ Float64: 0.05
      │       │    alg ┼ ForwardSelection()
      │       │    tgt ┼ LinearModel
      │       │        │   kwargs ┴ @NamedTuple{}: NamedTuple()
      │    ve ┼ SimpleVariance
      │       │          me ┼ SimpleExpectedReturns
      │       │             │   w ┴ nothing
      │       │           w ┼ nothing
      │       │   corrected ┴ Bool: true
      │   rsd ┴ Bool: true
  kte ┼ Cokurtosis
      │    me ┼ SimpleExpectedReturns
      │       │   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)
      │   alg ┼ FullMoment()
      │     w ┴ nothing
  ske ┼ Coskewness
      │    me ┼ SimpleExpectedReturns
      │       │   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)
      │   alg ┼ FullMoment()
      │     w ┴ nothing
   ex ┼ Transducers.ThreadedEx{@NamedTuple{}}: Transducers.ThreadedEx()
  rsd ┴ Bool: true

Related

source
PortfolioOptimisers.coskewness_residuals Function
julia
coskewness_residuals(X, me)

Compute the coskewness residuals from asset return data.

Internal helper that demeans X using the expected returns from me and returns the residual return matrix used in coskewness estimation.

Arguments

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

  • me: Expected returns estimator.

Returns

  • Residual return matrix.

Related

source
PortfolioOptimisers.cokurtosis_residuals Function
julia
cokurtosis_residuals(sigma, X, me)

Compute the cokurtosis residuals from the covariance matrix and return data.

Internal helper that standardises X using the covariance matrix sigma and expected returns from me, returning the standardised residual matrix used in cokurtosis estimation.

Arguments

  • sigma: Covariance matrix.

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

  • me: Expected returns estimator.

Returns

  • Standardised residual matrix.

Related

source
PortfolioOptimisers.prior Method
julia
prior(pe::HighOrderFactorPriorEstimator, X::MatNum, F::MatNum; dims::Int = 1,
      kwargs...)

Compute high order factor prior moments for asset returns using a factor model.

prior estimates the mean, covariance, coskewness, and cokurtosis of asset returns using a factor model with residual error correction. It first computes low order moments via the embedded factor prior, then maps factor higher-order moments to asset space via the Kronecker product of the factor loadings, optionally adding residual corrections.

Mathematical definition

Factor cokurtosis and coskewness are mapped to asset space via the loadings matrix B (with Kronecker product ):

K^=(BB)K^f(BB)+K^ε.S^=BS^f(BB)+S^ε.

Where:

  • K^: N2×N2 asset cokurtosis matrix.

  • S^: N×N2 asset coskewness matrix.

  • B: N×K factor loadings matrix.

  • K^f: K2×K2 factor cokurtosis matrix.

  • S^f: K×K2 factor coskewness matrix.

  • K^ε: Residual cokurtosis correction (when rsd = true).

  • S^ε: Residual coskewness correction (when rsd = true).

  • : Kronecker product.

Arguments

  • pe: High order factor prior estimator.

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

  • F: Factor returns matrix (observations × factors).

  • dims: Dimension along which to perform the computation.

  • kwargs...: Additional keyword arguments passed to underlying estimators.

Returns

  • pr::HighOrderPrior: Result object containing asset returns, mean, covariance, coskewness tensor, cokurtosis tensor, and factor moments.

Validation

  • dims in (1, 2).

Related

source