Factor Prior
PortfolioOptimisers.FactorPrior Type
struct FactorPrior{__T_pe, __T_mp, __T_re, __T_ve, __T_rsd} <: AbstractLowOrderPriorEstimator_FFactor-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: Prior estimator.mp: Matrix processing estimator.re: Regression estimator.ve: Variance estimator.rsd: Whether to include residual variance in the posterior covariance.
Constructors
FactorPrior(;
pe::AbstractLowOrderPriorEstimator_A_AF = EmpiricalPrior(),
mp::AbstractMatrixProcessingEstimator = MatrixProcessing(),
re::AbstractRegressionEstimator = StepwiseRegression(),
ve::AbstractVarianceEstimator = SimpleVariance(),
rsd::Bool = true
) -> FactorPriorKeywords correspond to the struct's fields.
Examples
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 ┼ 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 ┼ Forward()
│ tgt ┼ LinearModel
│ │ kwargs ┴ @NamedTuple{}: NamedTuple()
ve ┼ SimpleVariance
│ me ┼ SimpleExpectedReturns
│ │ w ┴ nothing
│ w ┼ nothing
│ corrected ┴ Bool: true
rsd ┴ Bool: trueRelated
PortfolioOptimisers.factory Method
factory(
pe::FactorPrior,
w::Union{DynamicAbstractWeights, AbstractWeights}
) -> Union{FactorPrior{<:AbstractLowOrderPriorEstimator_A, <:AbstractMatrixProcessingEstimator, <:AbstractRegressionEstimator, <:AbstractVarianceEstimator, Bool}, FactorPrior{<:AbstractLowOrderPriorEstimator_AF, <:AbstractMatrixProcessingEstimator, <:AbstractRegressionEstimator, <:AbstractVarianceEstimator, Bool}}Return a new FactorPrior estimator with observation weights w applied to the underlying prior, regression, and variance estimators.
Related
sourceBase.getproperty Method
getproperty(obj::FactorPrior, sym::Symbol) -> AnyAccess properties of FactorPrior. Exposes :me and :ce from the embedded asset prior estimator obj.pe for transparent access.
PortfolioOptimisers.prior Method
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.
Mathematical definition
The factor model maps factor moments to asset space via the loadings matrix
Where:
: factor loadings matrix. : vector of factor expected returns. : vector of regression intercepts. : factor covariance matrix. : diagonal matrix of residual variances (when rsd = true).
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
sourcePortfolioOptimisers.port_opt_view Method
port_opt_view(
pe::FactorPrior,
i,
args...
) -> Union{FactorPrior{<:AbstractLowOrderPriorEstimator_A, <:AbstractMatrixProcessingEstimator, <:AbstractRegressionEstimator, <:AbstractVarianceEstimator, Bool}, FactorPrior{<:AbstractLowOrderPriorEstimator_AF, <:AbstractMatrixProcessingEstimator, <:AbstractRegressionEstimator, <:AbstractVarianceEstimator, Bool}}Return a new FactorPrior estimator restricted to the assets at index i.
Related
source