High Order Factor Prior
PortfolioOptimisers.AbstractHighOrderPriorEstimator_F Type
abstract type AbstractHighOrderPriorEstimator_F <: AbstractHighOrderPriorEstimatorHigh 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
PortfolioOptimisers.AbstractHiLoOrderPriorEstimator_F Type
const AbstractHiLoOrderPriorEstimator_F = Union{<:AbstractLowOrderPriorEstimator_F,
<:AbstractHighOrderPriorEstimator_F}Alias for a union of low-order and high-order factor prior estimator types.
Related
sourcePortfolioOptimisers.HighOrderFactorPriorEstimator Type
struct HighOrderFactorPriorEstimator{__T_pe, __T_kte, __T_ske, __T_ex, __T_rsd} <: AbstractHighOrderPriorEstimator_FRepresents 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
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
) -> HighOrderFactorPriorEstimatorKeywords correspond to the struct's fields.
Examples
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: trueRelated
sourcePortfolioOptimisers.coskewness_residuals Function
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
sourcePortfolioOptimisers.cokurtosis_residuals Function
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
sourcePortfolioOptimisers.prior Method
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
Where:
: asset cokurtosis matrix. : asset coskewness matrix. : factor loadings matrix. : factor cokurtosis matrix. : factor coskewness matrix. : Residual cokurtosis correction (when rsd = true).: 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