Bayesian Black-Litterman Prior
PortfolioOptimisers.BayesianBlackLittermanPrior Type
struct BayesianBlackLittermanPrior{__T_pe, __T_mp, __T_views, __T_sets, __T_views_conf, __T_rf, __T_tau} <: AbstractLowOrderPriorEstimator_FBayesian Black-Litterman prior estimator for asset returns.
BayesianBlackLittermanPrior is a low order prior estimator that computes the mean and covariance of asset returns using a Bayesian Black-Litterman model. It combines a factor prior estimator, matrix post-processing, user or algorithmic views, asset sets, view confidences, risk-free rate, and a blending parameter tau. This estimator supports both direct and constraint-based views, flexible confidence specification, and matrix processing, and incorporates Bayesian updating for posterior inference.
Fields
pe: Prior estimator.mp: Matrix processing estimator.views: Views estimator or result.sets: Sets used to map estimator values to features.views_conf: Views confidence estimator or result.rf: Risk-free rate.tau: Blending parameter controlling the weight given to the prior relative to the views.
Constructors
BayesianBlackLittermanPrior(;
pe::AbstractLowOrderPriorEstimator_F_AF = FactorPrior(;
pe = EmpiricalPrior(;
me = EquilibriumExpectedReturns()
)
),
mp::AbstractMatrixProcessingEstimator = MatrixProcessing(),
views::Lc_BLV,
sets::Option{<:AssetSets} = nothing,
views_conf::Option{<:Num_VecNum} = nothing,
rf::Number = 0.0,
tau::Option{<:Number} = nothing
) -> BayesianBlackLittermanPriorKeywords 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.
Examples
julia> BayesianBlackLittermanPrior(;
sets = AssetSets(; key = "nx",
dict = Dict("nx" => ["A", "B", "C"])),
views = LinearConstraintEstimator(;
val = ["A == 0.03",
"B + C == 0.04"]))
BayesianBlackLittermanPrior
pe ┼ 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 ┼ EquilibriumExpectedReturns
│ │ │ 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)
│ │ │ w ┼ nothing
│ │ │ l ┴ Int64: 1
│ │ 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: true
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)
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
rf ┼ Float64: 0.0
tau ┴ nothingRelated
sourcePortfolioOptimisers.factory Method
factory(
pe::BayesianBlackLittermanPrior,
w::Union{DynamicAbstractWeights, AbstractWeights}
) -> BayesianBlackLittermanPrior{_A, var"#s179", _B, _C, _D, <:Number} where {_A, var"#s179"<:AbstractMatrixProcessingEstimator, _B, _C, _D}Return a new BayesianBlackLittermanPrior estimator with observation weights w applied to the underlying prior estimator.
Related
sourceBase.getproperty Method
getproperty(
obj::BayesianBlackLittermanPrior,
sym::Symbol
) -> AnyAccess properties of BayesianBlackLittermanPrior. Exposes :me and :ce from the embedded prior estimator obj.pe for transparent access.
PortfolioOptimisers.prior Method
prior(pe::BayesianBlackLittermanPrior, X::MatNum, F::MatNum; dims::Int = 1,
strict::Bool = false, kwargs...)Compute Bayesian Black-Litterman prior moments for asset returns.
prior estimates the mean and covariance of asset returns using the Bayesian Black-Litterman model, combining a factor prior estimator, matrix post-processing, user or algorithmic views, asset sets, view confidences, risk-free rate, and blending parameter tau. This method supports both direct and constraint-based views, flexible confidence specification, and matrix processing, and incorporates Bayesian updating for posterior inference.
Mathematical definition
The Bayesian Black-Litterman model updates the prior
Where:
: Bayesian Black-Litterman posterior mean. : Bayesian Black-Litterman posterior covariance. : prior expected returns. : prior covariance matrix. : Number of observations. : views matrix. : views vector. : view uncertainty matrix.
Arguments
pe: Bayesian 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, and factor prior details.
Validation
dims in (1, 2).length(pe.sets.dict[pe.sets.key]) == size(F, 2).
Details
If
dims == 2,XandFare transposed to ensure assets/factors are in columns.The factor prior is computed using the embedded prior estimator
pe.pe.Views are extracted using
black_litterman_views, which returns the view matrixPand view returns vectorQ.taudefaults to1/Tif not specified, whereTis the number of factor observations.The view uncertainty matrix
f_omegais computed usingcalc_omega.Bayesian posterior mean and covariance are computed via the model's update equations.
Matrix processing is applied to the posterior covariance and asset returns using the embedded matrix processing estimator
pe.mp.The result includes factor prior mean and covariance, and regression details.
Related
sourcePortfolioOptimisers.port_opt_view Method
port_opt_view(
pr::BayesianBlackLittermanPrior,
i,
args...
) -> BayesianBlackLittermanPrior{_A, var"#s179", _B, _C, _D, <:Number} where {_A, var"#s179"<:AbstractMatrixProcessingEstimator, _B, _C, _D}Return a new BayesianBlackLittermanPrior estimator restricted to the assets at index i.
Related
source