Black-Litterman Prior

PortfolioOptimisers.BlackLittermanPrior — Type
struct BlackLittermanPrior{__T_pe, __T_mp, __T_views, __T_sets, __T_views_conf, __T_rf, __T_tau, __T_x_src} <: AbstractLowOrderPriorEstimator_AF

Black-Litterman prior estimator for asset returns.

BlackLittermanPrior is a low order prior estimator. It fits the wrapped prior pe, and it updates the asset mean and covariance of that prior with views on the assets. The views are view equations in a LinearConstraintEstimator, or a precomputed BlackLittermanViews. views_conf sets the confidence of the views, tau scales the uncertainty of the prior mean, and rf shifts the posterior mean. mp processes the posterior covariance.

Black and Litterman [59] state the posterior mean as the precision-weighted blend of the prior and the views. The library computes the equivalent update form of Walters [152]. Black and Litterman [59] give no posterior covariance. The library returns the prior covariance plus the posterior covariance of the mean, which is the convention of Walters [152]. He and Litterman [153] set the view uncertainty to $\tau\,\mathrm{Diag}(\mathbf{P}\mathbf{\Sigma}\mathbf{P}^\intercal)$. The library does the same when views_conf is nothing. Cajas [12] sets tau to 1/T, which is the library default. A confidence v in views_conf scales that uncertainty by 1/v - 1. This is the closed form of Walters [152] for the method of Idzorek [154], which finds the uncertainty of each view by a numerical search for the weight tilt that the confidence asks for. Idzorek [154] also gives the meaning of the confidence: the fraction of the full tilt towards the view.

Fields

  • pe: Prior estimator.
  • mp: Matrix processing estimator.
  • sets: Sets used to map estimator values to assets.
  • views_conf: The confidence of the views, in (0, 1), or nothing. A number is one confidence for all the views, and a vector holds one confidence for each view that the caller wrote. If nothing, the view uncertainty has no confidence scale, see calc_omega.
  • rf: Risk-free rate. The Black-Litterman update compares the prior mean with the view returns, so it uses the total-return scale of the views. A mean from a wrapped prior estimator has that scale. An equilibrium mean is only a risk premium, and the rate converts it before the update. A member with no equilibrium branch has no mean to convert, and it adds the rate to the posterior asset expected returns. In both cases the estimator adds the rate once. It does not change the wrapped prior estimators, so a risk-free rate that one of them applied stays in its mean.
  • tau: The scale of the uncertainty of the prior mean, tau > 0. If nothing, the estimator uses 1/T, where T is the number of observations.
  • x_src: The source of the returns that the prior fits on, nothing or an AbstractReturnsSource. nothing and DataSource read the asset returns rd.X. ExcessSource reads the returns in excess of the benchmark, rd.X - rd.B, the Excess Frame, and refuses returns data with no benchmark. nothing means that the caller stated no source, so an optimiser that holds a reader of the Excess Frame warns about a prior at nothing, and not about a prior at DataSource(). A prior reads no prior, so it refuses PriorSource. A prior inside another estimator, such as the pe of a FactorPrior, keeps nothing, and the outer estimator states the source.

Constructors

BlackLittermanPrior(;    pe::Onl{<:AbstractLowOrderPriorEstimator_A_F_AF} = EmpiricalPrior(;        me = EquilibriumExpectedReturns()    ),    mp::AbstractMatrixProcessingEstimator = MatrixProcessing(),    views::Lc_BLV,    sets::Option{<:UniverseSets} = nothing,    views_conf::Option{<:Num_VecNum} = nothing,    rf::Number = 0.0,    tau::Option{<:Number} = nothing,    x_src::Option{<:AbstractReturnsSource} = nothing) -> BlackLittermanPrior

Keywords correspond to the struct's fields.

Composition: what this estimator forwards

The views update the assets. The estimator forwards the full result of the wrapped prior, with three changes. mu and sigma become the posterior. The estimator drops chol, because the posterior covariance replaces the covariance that chol factorises. Black-Litterman does not change the observation axis, so w, ens, kld and ow still describe the axis that the wrapped prior fitted them over. rr and the factor block fpr are structural: they come from data that the views do not change.

Warning

mu and sigma of the result are the Black-Litterman posterior, but w holds the observation weights of the wrapped prior, with no change. Black-Litterman makes no posterior over the observations, so no other weights agree with the update. Without w, a reader uses the unweighted empirical distribution, which is further from the intent of the caller than the weights that the caller computed. Thus pr.w, pr.ens, pr.kld and pr.ow describe the prior, not the posterior.

Warning

When the wrapped prior has a factor block, pr.fpr describes the prior factor distribution, but pr.mu is a posterior asset mean, so pr.mu != pr.rr.M * pr.fpr.mu + pr.rr.b. The block is still true as a structure, because the regression uses data that Black-Litterman does not change. But as a distribution it does not agree with the asset block. The estimator has no better block to report: the views update the assets, so the estimator does not compute a posterior factor distribution.

The other members are different. FactorBlackLittermanPrior and BayesianBlackLittermanPrior apply their views to the factors and report the posterior factor block, so mu == rr.M * fpr.mu + rr.b holds exactly for both. AugmentedBlackLittermanPrior also reports a posterior factor block, but its blocks do not agree, for a different reason that its own warning states.

Validation

Propagated parameters

factory passes its arguments on to these @fprop fields:

  • pe: Recursively updated through factory.

View parameters

port_opt_view takes the view of these @vprop fields at the selected indices:

Examples

julia> BlackLittermanPrior(;                           sets = UniverseSets(; xkey = "nx",                                               dict = Dict("nx" => ["A", "B", "C"])),                           views = LinearConstraintEstimator(;                                                             val = ["A == 0.03", "B + C == 0.04"]))BlackLittermanPrior          pe ┼ EmpiricalPrior             │           ce ┼ PortfolioOptimisersCovariance             │              │   ce ┼ Covariance             │              │      │    me ┼ SimpleExpectedReturns             │              │      │       │   w ┴ nothing             │              │      │    ce ┼ GeneralCovariance             │              │      │       │   ce ┼ StatsBase.SimpleCovariance: StatsBase.SimpleCovariance(true)             │              │      │       │    w ┴ nothing             │              │      │   alg ┼ FullMoment()             │              │      │     w ┴ 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)             │           me ┼ EquilibriumExpectedReturns             │              │   ce ┼ PortfolioOptimisersCovariance             │              │      │   ce ┼ Covariance             │              │      │      │    me ┼ SimpleExpectedReturns             │              │      │      │       │   w ┴ nothing             │              │      │      │    ce ┼ GeneralCovariance             │              │      │      │       │   ce ┼ StatsBase.SimpleCovariance: StatsBase.SimpleCovariance(true)             │              │      │      │       │    w ┴ nothing             │              │      │      │   alg ┼ FullMoment()             │              │      │      │     w ┴ 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)             │              │    w ┼ nothing             │              │    l ┴ Int64: 1             │      horizon ┼ nothing             │   fill_limit ┼ nothing             │        x_src ┴ 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)       views ┼ LinearConstraintEstimator             │   val ┼ Vector{String}: ["A == 0.03", "B + C == 0.04"]             │   key ┴ nothing        sets ┼ UniverseSets             │     xkey ┼ String: "nx"             │    uxkey ┼ String: "ux"             │    tfkey ┼ String: "nf"             │   utfkey ┼ String: "uf"             │    cfkey ┼ String: "ncf"             │   ucfkey ┼ String: "ucf"             │    nikey ┼ String: "ni"             │     dict ┴ Dict{String, Vector{String}}: Dict("nx" => ["A", "B", "C"])  views_conf ┼ nothing          rf ┼ Float64: 0.0         tau ┼ nothing       x_src ┴ nothing

Related

References

  • [59] F. Black and R. Litterman. Global asset allocation with equities, bonds, and currencies. Goldman, Sachs & Co., Fixed Income Research (1991). Appendix, items 7 and 8. The original source of this formulation was not found. The formulation follows this work and is not checked against the original.
  • [153] G. He and R. Litterman. The Intuition Behind Black-Litterman Model Portfolios. Technical Report (Goldman Sachs Investment Management Research, 1999). Footnote 6.
  • [152] J. Walters. The Black-Litterman model in detail. SSRN Electronic Journal (2011). Equations 25 to 27, 41 and 44. The original source of this formulation was not found. The formulation follows this work and is not checked against the original.
  • [154] T. Idzorek. A step-by-step guide to the Black-Litterman model: incorporating user-specified confidence levels. In: Forecasting Expected Returns in the Financial Markets (Academic Press, 2007); pp. 17–38. Section 3.2.
  • [12] D. Cajas. Advanced Portfolio Optimization: A Cutting-edge Quantitative Approach (Springer Nature Switzerland, 2025). Section 5.1.3, Equation 5.6, and Section 5.1.2, footnote 1.
source
PortfolioOptimisers.prior — Function
prior(pe::BlackLittermanPrior, X::MatNum, F::Option{<:MatNum} = nothing,
      pnl::Option{<:AssetPanel} = nothing;
      dims::Int = 1, strict::Bool = false, kwargs...)

Fit the Black-Litterman posterior of the asset returns.

When pe.tau is nothing, tau is 1/T, where T is the effective number of observations of the mean of the wrapped prior, eoc[1] of its result. It is the number of rows of X in that result when the result states no count. pe.rf changes the result once, on the posterior asset expected returns. apply_rf states that rule.

Mathematical definition

The Black-Litterman posterior combines the prior $(\boldsymbol{\Pi}, \tau \mathbf{\Sigma})$ with the views $(\mathbf{P}, \boldsymbol{q}, \mathbf{\Omega})$. The equations below are the precision form. vanilla_posteriors computes the inverse-free form, which is algebraically equal:

\[\begin{align} \hat{\boldsymbol{\mu}}_{BL} &= \left[(\tau\mathbf{\Sigma})^{-1} + \mathbf{P}^\intercal \mathbf{\Omega}^{-1} \mathbf{P}\right]^{-1} \left[(\tau\mathbf{\Sigma})^{-1} \boldsymbol{\Pi} + \mathbf{P}^\intercal \mathbf{\Omega}^{-1} \boldsymbol{q}\right]\,. \end{align}\]

\[\begin{align} \hat{\mathbf{\Sigma}}_{BL} &= \mathbf{\Sigma} + \left[(\tau\mathbf{\Sigma})^{-1} + \mathbf{P}^\intercal \mathbf{\Omega}^{-1} \mathbf{P}\right]^{-1}\,. \end{align}\]

Where:

  • $\boldsymbol{\Pi}$: N × 1 prior (equilibrium) expected returns.
  • $\mathbf{\Sigma}$: N × N prior covariance matrix.
  • $\tau$: Scaling parameter for the uncertainty in the prior.
  • $\mathbf{P}$: K × N views matrix (each row is one view).
  • $\boldsymbol{q}$: K × 1 views vector.
  • $\mathbf{\Omega}$: K × K views uncertainty matrix.

Algorithm

  1. Orient X and F with dims_oriented, to observations × assets and observations × factors.
  2. When pe.views resolves names, check that the length of the asset universe is equal to the number of columns of X, with assert_bl_views_axis. A precomputed BlackLittermanViews resolves no name, so this step does not check it. bl_preroll checks its width in step 6.
  3. Fit the wrapped prior pe.pe on (X, F). The result is prior_model.
  4. Derive the Investable Mask and the reduced view universe with investable_views. Refuse a precomputed view matrix over a universe with a departed asset, with assert_bl_precomputed_universe.
  5. View the fitted prior at the mask with investable_prior, and read posterior_X, prior_mu and prior_sigma from that result.
  6. Assemble the views and their uncertainty with bl_preroll, over the reduced prior_sigma, with T equal to the number of rows of prior_model.X. The result is P, Q, tau and omega, or nothing when no view is left. The axis keeps its default, :xkey, because these views update the assets.
  7. Run the master equations with vanilla_posteriors. The result is posterior_mu and posterior_sigma over the investable assets.
  8. Add pe.rf to posterior_mu with apply_rf. This is the one site that adds it.
  9. Process posterior_sigma in place with sample_matrix_processing!, under pe.mp, posterior_X and the count of the covariance of the wrapped prior from moment_observation_count. Do this before the expansion, because a factorisation exists only for the reduced block.
  10. Report the departures once with announce_bl_departures.
  11. Write both posteriors back onto the full asset universe with expand_moment, so a non-investable asset carries NaN in mu and on the diagonal of sigma.
  12. Forward the whole of prior_model with forward_prior, replacing mu and sigma by the expanded pair and dropping chol.

Arguments

  • pe: Black-Litterman prior estimator.
  • X: Asset returns matrix (observations × assets).
  • F: Optional factor matrix.
  • pnl: Optional AssetPanel, the panel that the returns data held. A wrapping prior forwards it unchanged, so that it can compose an estimator that is fitted on a panel. An estimator that reads no panel ignores it.
  • dims: Dimension along which the computation runs.
  • strict: If true, a view name that does not resolve raises an error. If false, it warns. The method also passes strict to the wrapped prior.
  • kwargs...: More keyword arguments, for the wrapped prior and for the matrix processing.

Validation

  • dims in (1, 2).
  • If pe.views is a LinearConstraintEstimator, length(pe.sets.dict[pe.sets.xkey]) == size(X, 2). Raises a DimensionMismatch.
  • If pe.sets is nothing, each asset of the result of the wrapped prior is investable, see assert_bl_precomputed_universe.
  • The number of columns of a precomputed P is equal to the number of investable assets, see bl_preroll.

Returns

  • pr::LowOrderPrior: The result of the wrapped prior, with the posterior mean in mu, the posterior covariance in sigma, and chol = nothing.

Related

source

References

[12]
D. Cajas. Advanced Portfolio Optimization: A Cutting-edge Quantitative Approach (Springer Nature Switzerland, 2025).
[59]
F. Black and R. Litterman. Global asset allocation with equities, bonds, and currencies (Goldman, Sachs & Co., Fixed Income Research, Oct 1991).
[152]
J. Walters. The Black-Litterman model in detail. SSRN Electronic Journal (2011).
[153]
G. He and R. Litterman. The Intuition Behind Black-Litterman Model Portfolios (Goldman Sachs Investment Management Research, 1999).
[154]
T. Idzorek. A step-by-step guide to the Black-Litterman model: incorporating user-specified confidence levels. In: Forecasting Expected Returns in the Financial Markets (Academic Press, 2007); pp. 17–38.