Factor Black-Litterman Prior
PortfolioOptimisers.FactorBlackLittermanPrior Type
struct FactorBlackLittermanPrior{__T_pe, __T_f_mp, __T_mp, __T_re, __T_ve, __T_views, __T_sets, __T_views_conf, __T_w, __T_rf, __T_l, __T_tau, __T_rsd} <: AbstractLowOrderPriorEstimator_FFactor Black-Litterman prior estimator for asset returns.
FactorBlackLittermanPrior is a low order prior estimator that computes the mean and covariance of asset returns using a factor-based Black-Litterman model. It combines an asset prior estimator, matrix post-processing for factors and assets, regression and variance estimators, user or algorithmic views, asset sets, view confidences, weights, risk-free rate, leverage, blending parameter tau, and a residual variance flag. This estimator supports both direct and constraint-based views, flexible confidence specification, and matrix processing, and incorporates factor regression and residual adjustment for posterior inference.
Fields
pe: Prior estimator.f_mp: Factor matrix processing estimator.mp: Matrix processing estimator.re: Regression estimator.ve: Variance estimator.views: Views estimator or result.sets: Sets used to map estimator values to features.views_conf: Views confidence estimator or result.w: Optional portfolio weights.rf: Risk-free rate.l: Risk aversion parameter.tau: Blending parameter controlling the weight given to the prior relative to the views.rsd: Whether to include residual variance in the posterior covariance.
Constructors
FactorBlackLittermanPrior(;
pe::AbstractLowOrderPriorEstimator_A_AF = EmpiricalPrior(),
f_mp::AbstractMatrixProcessingEstimator = MatrixProcessing(),
mp::AbstractMatrixProcessingEstimator = MatrixProcessing(),
re::AbstractRegressionEstimator = StepwiseRegression(),
ve::AbstractVarianceEstimator = SimpleVariance(),
views::Lc_BLV,
sets::Option{<:AssetSets} = nothing,
views_conf::Option{<:Num_VecNum} = nothing,
w::Option{<:ObsWeights} = nothing,
rf::Number = 0.0,
l::Option{<:Number} = nothing,
tau::Option{<:Number} = nothing,
rsd::Bool = true
) -> FactorBlackLittermanPriorKeywords correspond to the struct's fields.
Validation
If
viewsis aLinearConstraintEstimator,!isnothing(sets).If
views_confis notnothing,views_confis validated withassert_bl_views_conf.If
tauis notnothing,tau > 0.If
wis notnothing,length(w) == size(X, 2).
Examples
julia> FactorBlackLittermanPrior(;
sets = AssetSets(; key = "nx",
dict = Dict("nx" => ["A", "B", "C"])),
views = LinearConstraintEstimator(;
val = ["A == 0.03",
"B + C == 0.04"]))
FactorBlackLittermanPrior
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
f_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)
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
views ┼ LinearConstraintEstimator
│ val ┼ Vector{String}: ["A == 0.03", "B + C == 0.04"]
│ key ┴ nothing
sets ┼ AssetSets
│ key ┼ String: "nx"
│ ukey ┼ String: "ux"
│ dict ┴ Dict{String, Vector{String}}: Dict("nx" => ["A", "B", "C"])
views_conf ┼ nothing
w ┼ nothing
rf ┼ Float64: 0.0
l ┼ nothing
tau ┼ nothing
rsd ┴ Bool: trueRelated
sourcePortfolioOptimisers.factory Method
factory(
pe::FactorBlackLittermanPrior,
w::Union{DynamicAbstractWeights, AbstractWeights}
) -> FactorBlackLittermanPrior{_A, var"#s179", var"#s1791", var"#s1792", var"#s1793", _B, _C, _D, _E, var"#s1794", _F, _G, Bool} where {_A, var"#s179"<:AbstractMatrixProcessingEstimator, var"#s1791"<:AbstractMatrixProcessingEstimator, var"#s1792"<:AbstractRegressionEstimator, var"#s1793"<:AbstractVarianceEstimator, _B, _C, _D, _E, var"#s1794"<:Number, _F, _G}Return a new FactorBlackLittermanPrior estimator with observation weights w applied to the underlying prior, regression, and variance estimators.
Related
sourceBase.getproperty Method
getproperty(
obj::FactorBlackLittermanPrior,
sym::Symbol
) -> AnyAccess properties of FactorBlackLittermanPrior. Exposes :me and :ce from the embedded prior estimator obj.pe for transparent access.
PortfolioOptimisers.prior Method
prior(pe::FactorBlackLittermanPrior, X::MatNum, F::MatNum; dims::Int = 1,
strict::Bool = false, kwargs...)Compute factor Black-Litterman prior moments for asset returns.
prior estimates the mean and covariance of asset returns using the factor-based Black-Litterman model, combining an asset prior estimator, matrix post-processing for factors and assets, regression and variance estimators, user or algorithmic views, asset sets, view confidences, weights, risk-free rate, leverage, blending parameter tau, and a residual variance flag. This method supports both direct and constraint-based views, flexible confidence specification, and matrix processing, and incorporates factor regression and residual adjustment for posterior inference.
Mathematical definition
Black-Litterman views are applied directly to the factor space, updating factor moments
Where:
: posterior asset mean vector. : posterior asset covariance matrix. : Black-Litterman posterior factor mean. : Black-Litterman posterior factor covariance. : factor loadings matrix. : regression intercept vector. : diagonal residual variance matrix (when rsd = true).
Arguments
pe: Factor Black-Litterman prior estimator.X: Asset returns matrix (observations × assets).F: Factor matrix (observations × factors).dims: Dimension along which to perform the computation.strict: Iftrue, enforce strict validation of views and sets. Default isfalse.kwargs...: Additional keyword arguments passed to underlying estimators and matrix processing.
Returns
pr::LowOrderPrior: Result object containing asset returns, posterior mean vector, posterior covariance matrix, Cholesky factor, weights, regression result, and factor prior details.
Validation
dims in (1, 2).length(pe.sets.dict[pe.sets.key]) == size(F, 2).If
pe.wis notnothing,length(pe.w) == size(X, 2).
Details
If
dims == 2,XandFare transposed to ensure assets/factors are in columns.The factor prior is computed using the embedded asset prior estimator
pe.pe.Factor regression is performed using the regression estimator
pe.re.Views are extracted using
black_litterman_views, which returns the view matrixPand view returns vectorQ.taudefaults to1/Tif not specified, whereTis the number of observations.The view uncertainty matrix
omegais computed usingcalc_omega.If leverage is specified, the prior mean is adjusted accordingly.
The Black-Litterman posterior mean and covariance for factors are computed using
vanilla_posteriors.Matrix processing is applied to the factor and asset posterior covariance matrices.
The asset posterior mean and covariance are reconstructed using the factor loadings.
If
rsdistrue, residual variance is added to the posterior covariance and Cholesky factor.The result includes asset returns, posterior mean, posterior covariance, Cholesky factor, weights, regression result, and factor prior details.
Related
sourcePortfolioOptimisers.port_opt_view Method
port_opt_view(pe::FactorBlackLittermanPrior, i, args...)Return a new FactorBlackLittermanPrior estimator restricted to the assets at index i.
Related
source