Factor Black-Litterman Prior
PortfolioOptimisers.FactorBlackLittermanPrior Type
struct FactorBlackLittermanPrior{T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13} <:
AbstractLowOrderPriorEstimator_F
pe::T1
f_mp::T2
mp::T3
re::T4
ve::T5
views::T6
sets::T7
views_conf::T8
w::T9
rf::T10
l::T11
tau::T12
rsd::T13
endFactor 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: Asset prior estimator.f_mp: Matrix post-processing estimator for the factor prior.mp: Matrix post-processing estimator for the posterior.re: Regression estimator for factor loadings.ve: Variance estimator for residuals.views: Views estimator or views object.sets: Asset sets.views_conf: View confidence(s).w: Optional weights for assets.rf: Risk-free rate.l: Optional leverage parameter.tau: Blending parameter. When computing the prior, ifnothing, defaults to1/TwhereTis the number of observations.rsd: Boolean flag to include residual variance in posterior covariance.
Constructor
FactorBlackLittermanPrior(; pe::AbstractLowOrderPriorEstimator_A_AF = EmpiricalPrior(),
f_mp::AbstractMatrixProcessingEstimator = DefaultMatrixProcessing(),
mp::AbstractMatrixProcessingEstimator = DefaultMatrixProcessing(),
re::AbstractRegressionEstimator = StepwiseRegression(),
ve::AbstractVarianceEstimator = SimpleVariance(),
views::Union{<:LinearConstraintEstimator, <:BlackLittermanViews},
sets::Union{Nothing, <:AssetSets} = nothing,
views_conf::Union{Nothing, <:Real, <:AbstractVector} = nothing,
w::Union{Nothing, <:AbstractWeights} = nothing, rf::Real = 0.0,
l::Union{Nothing, <:Real} = nothing,
tau::Union{Nothing, <:Real} = nothing, rsd::Bool = true)Keyword arguments correspond to the fields above.
Validation
If
viewsis aLinearConstraintEstimator,!isnothing(sets).If
views_confis notnothing,views_confis validated withassert_bl_views_conf.If
tauis notnothing,tau > 0.If
wis provided,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 ┼ DefaultMatrixProcessing
│ │ │ pdm ┼ Posdef
│ │ │ │ alg ┴ UnionAll: NearestCorrelationMatrix.Newton
│ │ │ denoise ┼ nothing
│ │ │ detone ┼ nothing
│ │ │ alg ┴ nothing
│ me ┼ SimpleExpectedReturns
│ │ w ┴ nothing
│ horizon ┴ nothing
f_mp ┼ DefaultMatrixProcessing
│ pdm ┼ Posdef
│ │ alg ┴ UnionAll: NearestCorrelationMatrix.Newton
│ denoise ┼ nothing
│ detone ┼ nothing
│ alg ┴ nothing
mp ┼ DefaultMatrixProcessing
│ pdm ┼ Posdef
│ │ alg ┴ UnionAll: NearestCorrelationMatrix.Newton
│ denoise ┼ nothing
│ detone ┼ nothing
│ alg ┴ nothing
re ┼ StepwiseRegression
│ crit ┼ PValue
│ │ threshold ┴ Float64: 0.05
│ alg ┼ Forward()
│ target ┼ 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"]
sets ┼ AssetSets
│ key ┼ String: "nx"
│ 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.prior Method
prior(pe::FactorBlackLittermanPrior, X::AbstractMatrix, F::AbstractMatrix; 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.
Arguments
pe: Factor Black-Litterman prior estimator.X: Asset returns matrix (observations × assets).F: Factor matrix (observations × factors).dims: Dimension along which to compute moments (1= columns/assets,2= rows). Default is1.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 provided,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
source