Skip to content
13

Factor Prior

PortfolioOptimisers.FactorPrior Type
julia
struct FactorPrior{__T_pe, __T_mp, __T_re, __T_ve, __T_rsd} <: AbstractLowOrderPriorEstimator_F

Factor-based prior estimator for asset returns.

FactorPrior is a low order prior estimator that computes the mean and covariance of asset returns using a factor model. It combines a factor prior estimator, matrix post-processing, regression, and variance estimation to produce posterior moments. Optionally, it can add residual variance to the posterior covariance for robust estimation.

Fields

  • pe: Factor prior estimator.

  • mp: Matrix post-processing estimator.

  • re: Regression estimator.

  • ve: Variance estimator for residuals.

  • rsd: Boolean flag to add residual variance to posterior covariance.

Constructors

julia
FactorPrior(;
    pe::AbstractLowOrderPriorEstimator_A_AF = EmpiricalPrior(),
    mp::AbstractMatrixProcessingEstimator = DenoiseDetoneAlgMatrixProcessing(),
    re::AbstractRegressionEstimator = StepwiseRegression(),
    ve::AbstractVarianceEstimator = SimpleVariance(),
    rsd::Bool = true
) -> FactorPrior

Keywords correspond to the struct's fields.

Examples

julia
julia> FactorPrior()
FactorPrior
   pe ┼ EmpiricalPrior
      │        ce ┼ PortfolioOptimisersCovariance
      │           │   ce ┼ Covariance
      │           │      │    me ┼ SimpleExpectedReturns
      │           │      │       │   w ┴ nothing
      │           │      │    ce ┼ GeneralCovariance
      │           │      │       │   ce ┼ StatsBase.SimpleCovariance: StatsBase.SimpleCovariance(true)
      │           │      │       │    w ┴ nothing
      │           │      │   alg ┴ Full()
      │           │   mp ┼ DenoiseDetoneAlgMatrixProcessing
      │           │      │     pdm ┼ Posdef
      │           │      │         │      alg ┼ UnionAll: NearestCorrelationMatrix.Newton
      │           │      │         │   kwargs ┴ @NamedTuple{}: NamedTuple()
      │           │      │      dn ┼ nothing
      │           │      │      dt ┼ nothing
      │           │      │     alg ┼ nothing
      │           │      │   order ┴ DenoiseDetoneAlg()
      │        me ┼ SimpleExpectedReturns
      │           │   w ┴ nothing
      │   horizon ┴ nothing
   mp ┼ DenoiseDetoneAlgMatrixProcessing
      │     pdm ┼ Posdef
      │         │      alg ┼ UnionAll: NearestCorrelationMatrix.Newton
      │         │   kwargs ┴ @NamedTuple{}: NamedTuple()
      │      dn ┼ nothing
      │      dt ┼ nothing
      │     alg ┼ nothing
      │   order ┴ DenoiseDetoneAlg()
   re ┼ StepwiseRegression
      │   crit ┼ PValue
      │        │   t ┴ Float64: 0.05
      │    alg ┼ Forward()
      │    tgt ┼ LinearModel
      │        │   kwargs ┴ @NamedTuple{}: NamedTuple()
   ve ┼ SimpleVariance
      │          me ┼ SimpleExpectedReturns
      │             │   w ┴ nothing
      │           w ┼ nothing
      │   corrected ┴ Bool: true
  rsd ┴ Bool: true

Related

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

Compute factor-based prior moments for asset returns using a factor model.

prior estimates the mean and covariance of asset returns using the specified factor prior estimator, regression, and matrix post-processing. The factor returns matrix F is used to compute factor moments, which are then mapped to asset space via regression. Optionally, residual variance is added to the posterior covariance for robust estimation. The result is returned as a LowOrderPrior object.

Arguments

  • pe: 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 matrix processing and estimators.

Returns

  • pr::LowOrderPrior: Result object containing posterior asset returns, mean vector, covariance matrix, Cholesky factor, regression result, and factor moments.

Validation

  • dims in (1, 2).

Related

source