Augmented Black-Litterman Prior
PortfolioOptimisers.AugmentedBlackLittermanPrior — Type
struct AugmentedBlackLittermanPrior{__T_a_pe, __T_f_pe, __T_mp, __T_re, __T_a_views, __T_f_views, __T_sets, __T_a_views_conf, __T_f_views_conf, __T_w, __T_rf, __T_l, __T_tau, __T_cache, __T_x_src} <: AbstractLowOrderPriorEstimator_FAugmented Black-Litterman prior estimator for asset returns.
AugmentedBlackLittermanPrior is a low order prior estimator. It stacks an asset prior and a factor prior into one joint prior. It applies asset views and factor views to the joint prior with the Black-Litterman master equations. The result is the asset half and the factor half of the posterior.
Mathematical definition
The regression of the assets on the factors gives the factor model:
\[\begin{align} \mathbf{X} &\approx \mathbf{F}\mathbf{M}^{\intercal} + \mathbf{1}\boldsymbol{b}^{\intercal}\,. \end{align}\]
The augmented prior moments stack the asset prior and the factor prior:
\[\begin{align} \boldsymbol{\mu}_{aug} &= \begin{pmatrix}\boldsymbol{\mu}_a \\ \boldsymbol{\mu}_f\end{pmatrix} \quad\text{or}\quad \lambda\begin{pmatrix}\boldsymbol{\Sigma}_a \\ \boldsymbol{\Sigma}_f\mathbf{M}^{\intercal}\end{pmatrix}\boldsymbol{w} + \begin{pmatrix}\boldsymbol{b} \\ \mathbf{0}\end{pmatrix} + r_{f}\,, \\ \boldsymbol{\Sigma}_{aug} &= \begin{pmatrix}\boldsymbol{\Sigma}_a & \mathbf{M}\boldsymbol{\Sigma}_f \\ \boldsymbol{\Sigma}_f\mathbf{M}^{\intercal} & \boldsymbol{\Sigma}_f\end{pmatrix}\,. \end{align}\]
The left prior mean stacks the two wrapped means, and the estimator uses it when pe.l === nothing. The right prior mean is the equilibrium mean that pe.l selects. It adds two levels that the wrapped means contain already: the intercept $\boldsymbol{b}$ on the asset half, and the risk-free rate. Both levels must be in $\boldsymbol{\mu}_{aug}$ before the update, because the update blends this mean against $\boldsymbol{q}_{aug}$ through the residual $\boldsymbol{q}_{aug} - \mathbf{P}_{aug}\boldsymbol{\mu}_{aug}$.
The off-diagonal blocks are the cross-covariance of the factor model, $\mathrm{cov}(\mathbf{X}, \mathbf{F}) = \mathbf{M}\boldsymbol{\Sigma}_f$. The estimator builds them from the factor covariance, not from the asset covariance. So they hold only factor variance, but the first diagonal block holds factor and residual variance. This difference opens the gap of the second warning below.
The estimator stacks the views block-diagonally, each set over its own axis:
\[\begin{align} \mathbf{P}_{aug} &= \begin{pmatrix}\mathbf{P} & \mathbf{0} \\ \mathbf{0} & \mathbf{P}_f\end{pmatrix}\,, \quad \boldsymbol{q}_{aug} = \begin{pmatrix}\boldsymbol{q} \\ \boldsymbol{q}_f\end{pmatrix}\,, \quad \boldsymbol{\Omega}_{aug} = \begin{pmatrix}\boldsymbol{\Omega} & \mathbf{0} \\ \mathbf{0} & \boldsymbol{\Omega}_f\end{pmatrix}\,. \end{align}\]
The master equations give the Black-Litterman posterior on the augmented space:
\[\begin{align} \boldsymbol{\mu}_{post} &= \boldsymbol{\mu}_{aug} + \tau\boldsymbol{\Sigma}_{aug}\mathbf{P}_{aug}^{\intercal}\left(\tau\mathbf{P}_{aug}\boldsymbol{\Sigma}_{aug}\mathbf{P}_{aug}^{\intercal} + \boldsymbol{\Omega}_{aug}\right)^{-1}\!\left(\boldsymbol{q}_{aug} - \mathbf{P}_{aug}\boldsymbol{\mu}_{aug}\right)\,, \\ \boldsymbol{\Sigma}_{post} &= \boldsymbol{\Sigma}_{aug} + \tau\boldsymbol{\Sigma}_{aug} - \tau\boldsymbol{\Sigma}_{aug}\mathbf{P}_{aug}^{\intercal}\left(\tau\mathbf{P}_{aug}\boldsymbol{\Sigma}_{aug}\mathbf{P}_{aug}^{\intercal} + \boldsymbol{\Omega}_{aug}\right)^{-1}\!\mathbf{P}_{aug}\tau\boldsymbol{\Sigma}_{aug}\,. \end{align}\]
Truncation then gives the two halves, with no other change. The intercept and the risk-free rate are already in $\boldsymbol{\mu}_{aug}$ above, where the update blends the views against them:
\[\begin{align} \hat{\boldsymbol{\mu}} &= \left(\boldsymbol{\mu}_{post}\right)_{1:N}\,, \quad \hat{\mathbf{\Sigma}} = \left(\boldsymbol{\Sigma}_{post}\right)_{1:N,\,1:N}\,, \\ \hat{\boldsymbol{\mu}}_f &= \left(\boldsymbol{\mu}_{post}\right)_{N+1:N+K}\,, \quad \hat{\mathbf{\Sigma}}_f = \left(\boldsymbol{\Sigma}_{post}\right)_{N+1:N+K,\,N+1:N+K}\,. \end{align}\]
Where:
- $T$, $N$, $K$: The number of observations, of assets, and of factors.
- $\mathbf{X}$: $T \times N$ asset returns matrix.
- $\mathbf{F}$: $T \times K$ factor returns matrix.
- $\mathbf{M}$: $N \times K$ factor loadings, the regression coefficients,
pr.rr.M. - $\boldsymbol{b}$: $N \times 1$ regression intercept vector,
pr.rr.b. - $\boldsymbol{\mu}_a$, $\boldsymbol{\Sigma}_a$: $N \times 1$ and $N \times N$ asset prior mean and covariance, from
a_pe. - $\boldsymbol{\mu}_f$, $\boldsymbol{\Sigma}_f$: $K \times 1$ and $K \times K$ factor prior mean and covariance, from
f_pe. - $\boldsymbol{\mu}_{aug}$, $\boldsymbol{\Sigma}_{aug}$: Augmented prior moments over the joint axis of assets and factors, of length and order $N + K$.
- $\boldsymbol{\mu}_{post}$, $\boldsymbol{\Sigma}_{post}$: Augmented posterior moments, of the same shape.
- $\tau$: Scaling parameter for the prior uncertainty,
1/Tby default. - $\mathbf{P}$, $\boldsymbol{q}$, $\boldsymbol{\Omega}$: Asset views matrix, returns vector and uncertainty matrix, over the asset axis.
- $\mathbf{P}_f$, $\boldsymbol{q}_f$, $\boldsymbol{\Omega}_f$: The same three over the factor axis.
- $\mathbf{P}_{aug}$, $\boldsymbol{q}_{aug}$, $\boldsymbol{\Omega}_{aug}$: The same three stacked over the augmented axis, the asset rows above the factor rows.
- $\hat{\boldsymbol{\mu}}$, $\hat{\mathbf{\Sigma}}$: $N \times 1$ and $N \times N$ posterior asset moments,
pr.muandpr.sigma. - $\hat{\boldsymbol{\mu}}_f$, $\hat{\mathbf{\Sigma}}_f$: $K \times 1$ and $K \times K$ posterior factor moments,
pr.fpr.muandpr.fpr.sigma. - $\lambda$, $\boldsymbol{w}$: The risk-aversion coefficient
pe.land the equilibrium weightspe.w.equilibrium_mureads them, and only whenpe.lis set. - $r_{f}$: Risk-free rate.
apply_rfadds it once, to the equilibrium mean. It is absent whenpe.lisnothing, because the wrapped means are total returns already.
The stacked inputs and the master equations follow Cajas [12], who follows Cheung [156]. Cajas [12] builds the equilibrium mean as $\delta\,(\boldsymbol{\Sigma};\ \boldsymbol{\Sigma}_f\mathbf{M}^{\intercal})\,\boldsymbol{w}$ with no intercept, and adds $r_f$ to the posterior. The library adds the intercept and $r_f$ to the equilibrium mean before the update, as the text above states. Cajas [12] does not state the diagonal blocks of $\boldsymbol{\Omega}_{aug}$. The library sets each block to $\tau\,\mathrm{Diag}(\mathbf{P}\mathbf{\Sigma}\mathbf{P}^\intercal)$ over the covariance of its own axis.
Fields
a_pe: Asset prior estimator.
f_pe: Factor prior estimator.
mp: Matrix processing estimator.
re: Regression estimator.
a_views: Asset views estimator or result.
f_views: Factor views estimator or result.
sets: Universe sets. This estimator reads two declared axes.a_viewsresolves againstsets.dict[sets.xkey], which must name the columns ofXin order.f_viewsresolves against the time-series factor axissets.dict[sets.tfkey], which must name the columns ofFin order. ALinearConstraintEstimatorneeds only the axis that it resolves names against. Views in aBlackLittermanViewsresult carry their own matrix and need no universe. A view slices the asset axis and keeps the factor entries, so this field is@vprop.
a_views_conf: Asset views confidence estimator or result.
f_views_conf: Factor views confidence estimator or result.
w: Optional equilibrium weights vectorassets × 1. Ifnothing,equilibrium_muuses equal weights.
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.
l: Risk aversion parameter.
tau: The scale of the uncertainty of the prior mean,tau > 0. Ifnothing, the estimator uses1/T, whereTis the number of observations.
cache: Optional partial-fit state. It isnothinguntilpartial_fit!writes one. When the caller gives no data matrix, the batch verb of the estimator reads it. Each propagation channel does one thing with it.factorykeeps it unchanged, because a factory call resolves the configuration, not the sample.port_opt_viewcopies the entries of the selected assets into a new state, so the viewed estimator holds the state of those assets alone.obs_weights_viewremoves it, because a state has no slice on the observation axis. Only a type with an observation-weights field has that channel. A type with no such field falls through to the identity method, so it keeps its state. A family whose state has no exact asset slice removes it on both axes and names the reason.
x_src: The source of the returns that the prior fits on,nothingor anAbstractReturnsSource.nothingandDataSourceread the asset returnsrd.X.ExcessSourcereads the returns in excess of the benchmark,rd.X - rd.B, the Excess Frame, and refuses returns data with no benchmark.nothingmeans that the caller stated no source, so an optimiser that holds a reader of the Excess Frame warns about a prior atnothing, and not about a prior atDataSource(). A prior reads no prior, so it refusesPriorSource. A prior inside another estimator, such as thepeof aFactorPrior, keepsnothing, and the outer estimator states the source.
Constructors
AugmentedBlackLittermanPrior(; a_pe::AbstractLowOrderPriorEstimator_A_AF = EmpiricalPrior(), f_pe::AbstractLowOrderPriorEstimator_A_AF = EmpiricalPrior(), mp::AbstractMatrixProcessingEstimator = MatrixProcessing(), re::AbstractTimeSeriesRegressionEstimator = StepwiseRegression(), a_views::Lc_BLV, f_views::Lc_BLV, sets::Option{<:UniverseSets} = nothing, a_views_conf::Option{<:Num_VecNum} = nothing, f_views_conf::Option{<:Num_VecNum} = nothing, w::Option{<:VecNum} = nothing, rf::Number = 0.0, l::Option{<:Number} = nothing, tau::Option{<:Number} = nothing, cache::Option{<:AbstractPartialFitState} = nothing, x_src::Option{<:AbstractReturnsSource} = nothing) -> AugmentedBlackLittermanPriorKeywords correspond to the struct's fields.
Composition: what this estimator forwards
This estimator merges two priors and builds its prior result directly. It does not forward one prior along its own axis. A posterior field still replaces the prior field of the same name, and a structural field still forwards whole. The estimator solves one augmented Black-Litterman system over [assets; factors], and it gives both halves:
muandsigmaare the asset half of the augmented posterior. The factor blockfpris the factor half, so both blocks are posterior. The estimator dropscholon both blocks, because the posterior covariances replace the covariances thatcholfactorises.w,ens,kldandowcome from the asset prior. The same fields offprcome from the factor prior. Two priors with different observation weights are a valid configuration, and the nested block keeps the two weightings apart.pc, the cache of an opinion pool, comes from the asset prior only. The cache of the factor prior holds factor returns, and it does not describe the asset axis.
The returned mu and sigma are the augmented posterior, but w is the observation weighting of the asset prior, forwarded with no change. fpr.w is the weighting of the factor prior. Black-Litterman gives no posterior over the observations, so no weighting that agrees with the posterior exists. If the estimator drops w, the unweighted empirical distribution takes its place, and that is further from the weights that the caller computed. So pr.w, pr.ens, pr.kld and pr.ow describe the asset prior, not the posterior. With an entropy pooling prior on each axis, these four fields equal those of the asset prior. pr.fpr.w equals the weighting of the factor prior, and it differs from pr.w.
pr.mu != pr.rr.M * pr.fpr.mu + pr.rr.b, but both blocks are posterior. The update opens the gap in two ways.
Idiosyncratic variance, on every branch. The augmented covariance stacks the full asset covariance sigma_a against the cross-covariance M * sigma_f. sigma_a holds factor and residual variance, but M * sigma_f holds factor variance alone. So the update moves the asset half by tau * sigma_a * P'(…) and the factor half by tau * sigma_f * M' * P'(…). The two halves stay related by M only if sigma_a == M * sigma_f * M', and that holds only on an exact factor model. This part grows with the residual variance, and both view sets add to it.
The intercept is not a third cause. On an exact factor model with a non-zero intercept, the gap is 1.8e-15. But with a residual, the intercept changes the size of the first part. On a 250 × 5 sample over three factors, the gap is 7.1e-5. When the intercept is removed from X, with no other change, the gap is 1.2e-4.
A non-zero rf, on the l branch alone. apply_rf adds the rate to the whole equilibrium stack, so the asset half gets rf and the factor half gets rf too. The identity carries the factor half through the loadings, and this turns that rf into rf * s for the row sums s of M. On an exact factor model, the gap is rf * (1 - s), to 1.5e-14 at rf = 0.03. With a residual, the rate also goes through the first part, and the gap is not rf * (1 - s). On the same sample at rf = 0.03, the part of the gap that the rate adds differs from rf * (1 - s) by up to 5.9e-4. This part is zero at the default rf = 0.0. When pe.l is nothing, no step reads the field.
Before the update, the two priors satisfy the identity only when both means are the plain sample mean. Least squares with an intercept sets the unweighted residual mean to zero. One shared non-uniform weighting is not enough, because the weighted residual mean is not zero. Two different weightings make the gap larger. On an exact factor model, a shared non-uniform weighting satisfies the identity, because no residual exists.
FactorBlackLittermanPrior and BayesianBlackLittermanPrior satisfy the identity exactly. They update the factor distribution alone, and they project it onto the assets. They do not update an asset block next to it. BlackLittermanPrior takes asset views only, and it computes no posterior factor distribution. When it wraps a prior with no factor block, pr.fpr is nothing, and the right side of the identity does not exist. When it wraps a FactorPrior, pr.fpr is the prior factor block, and the gap on the same sample is 1.7e-3.
One sets, two axes
This is the only estimator with views on both distributions. It needs two axes, and UniverseSets declares both. a_views resolves against sets.dict[sets.xkey], and f_views resolves against sets.dict[sets.tfkey]. The field is @vprop. port_opt_view slices the asset entries, and the factor entries come back with no change. The data, and not a hand-written exemption, keeps the factor universe whole.
The views that resolve names against an axis are the only views that need that axis. A BlackLittermanViews result carries its own P and needs no universe. With one sets, a mandate can have asset views only or factor views only. A pair of precomputed view sets needs no sets, and it gives the same result as the same pair with sets. port_opt_view over a selection of assets keeps the factor axis of sets whole, and it cuts the asset axis and w to the selection.
Validation
- If
wis notnothing,!isempty(w). - If either
a_viewsorf_viewsis aLinearConstraintEstimator,!isnothing(sets). - If
a_views_confis notnothing,assert_bl_views_confchecks it. - If
f_views_confis notnothing,assert_bl_views_confchecks it. - If
tauis notnothing,tau > 0. x_srcisnothing,DataSource()orExcessSource(), seeassert_returns_source.- The
x_srcofa_pe,f_pe,reisnothing, because the prior picks the returns that it reads, seeassert_inner_reader.
The constructor does not check the length of w. The length is a property of the returns matrix, and the constructor does not see that matrix. A wrong length raises a DimensionMismatch from equilibrium_mu in prior, and only when l is set.
Propagated parameters
factory passes its arguments on to these @fprop fields:
a_pe: Recursively updated throughfactory.f_pe: Recursively updated throughfactory.re: Recursively updated throughfactory.cache: Carried unchanged throughfactory.
View parameters
port_opt_view takes the view of these @vprop fields at the selected indices:
a_pe: Recursively viewed throughport_opt_view.re: Recursively viewed throughport_opt_view.sets: Sliced to the selected indices throughport_opt_view.w: Sliced to the selected indices throughport_opt_view.cache: Sliced to the selected assets throughport_opt_view.
Examples
julia> AugmentedBlackLittermanPrior(; sets = UniverseSets(; dict = Dict("nx" => ["A", "B", "C"], "nf" => ["F1", "F2"])), a_views = LinearConstraintEstimator(; val = ["A == 0.03", "B + C == 0.04"]), f_views = LinearConstraintEstimator(; val = ["F1 == 0.01", "F2 == 0.02"]))AugmentedBlackLittermanPrior a_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 ┼ SimpleExpectedReturns │ │ w ┴ nothing │ horizon ┼ nothing │ fill_limit ┼ nothing │ x_src ┴ nothing f_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 ┼ SimpleExpectedReturns │ │ w ┴ nothing │ 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) re ┼ StepwiseRegression │ crit ┼ PValue │ │ t ┴ Float64: 0.05 │ alg ┼ ForwardSelection() │ tgt ┼ LinearModel │ │ kwargs ┴ @NamedTuple{}: NamedTuple() │ choice ┼ BatchChoice() │ included ┼ nothing │ x_src ┴ nothing a_views ┼ LinearConstraintEstimator │ val ┼ Vector{String}: ["A == 0.03", "B + C == 0.04"] │ key ┴ nothing f_views ┼ LinearConstraintEstimator │ val ┼ Vector{String}: ["F1 == 0.01", "F2 == 0.02"] │ 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("nf" => ["F1", "F2"], "nx" => ["A", "B", "C"]) a_views_conf ┼ nothing f_views_conf ┼ nothing w ┼ nothing rf ┼ Float64: 0.0 l ┼ nothing tau ┼ nothing x_src ┴ nothingThe incremental fit
This prior has no exact incremental recursion, and it takes the online step by a refit from a sample buffer. Online seeds cache, and partial_fit! adds each observation to it with no change. The prior method with one argument then runs the batch verb of this estimator over the rows that the buffer kept. The result is the batch fit over those rows, and a max_history on the wrapper sets the window of the whole fit.
cache goes through the three propagation channels as every partial-fit state does. factory carries it with no change, and port_opt_view cuts it to the selected assets. obs_weights_view drops it, because a state has no cut on the observation axis. The show method does not print cache, because a buffer that changes at each step is not part of the configuration.
Related
AbstractLowOrderPriorEstimator_FEmpiricalPriorBlackLittermanViewsUniverseSetsLowOrderPriorpriorfactoryport_opt_view
References
- [156] W. Cheung. The augmented Black-Litterman model: a ranking-free approach to factor-based portfolio construction and beyond. Quantitative Finance 13, 301–316 (2013).
- [12] D. Cajas. Advanced Portfolio Optimization: A Cutting-edge Quantitative Approach (Springer Nature Switzerland, 2025). Section 5.2, Equations 5.17 to 5.19. The original source of this formulation was not found. The formulation follows this work and is not checked against the original.
PortfolioOptimisers.prior — Function
prior(pe::AugmentedBlackLittermanPrior, X::MatNum, F::MatNum,
pnl::Option{<:AssetPanel} = nothing; dims::Int = 1,
strict::Bool = false, cache_reg::Bool = false, kwargs...)Compute augmented Black-Litterman prior moments for asset returns.
prior fits the asset prior and the factor prior, and it stacks them into one joint prior. It applies the asset views and the factor views to the joint prior with the Black-Litterman master equations.
When pe.tau is nothing, the blending parameter is 1/T, where T is the smaller of the effective numbers of observations of the two prior means, from moment_observation_count. It is the number of observations of the oriented X when neither prior states a count. The update gets a total return as its mean, and both halves have that scale. pe.rf reaches the update only when pe.l is set. There it converts the equilibrium risk premium, and it goes on the whole stack. Let $\mathbf{G}$ be the augmented update gain, and let $\mathbf{1}$ be the vector of ones. Against the same estimator at rf = 0, the result moves by rf * (I - G P_aug) * 1 on each half. When pe.l is nothing, no step reads the field, and two fits that differ only in rf are equal on both halves.
Arguments
pe: Augmented Black-Litterman prior estimator.X: Asset returns matrix (observations × assets).F: Factor matrix (observations × factors).pnl: OptionalAssetPanel, 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. It reachespe.a_pe, the prior over the assets. It does not reachpe.f_pe, because the estimator fitspe.f_peon the factors and no panel describes the factor axis.dims: Dimension along which the computation runs.strict: Iftrue, enforce strict validation of views and sets. Default isfalse.cache_reg: Iftrue, a prior stores on its result the cache that its refit under new scenario weights reads: aCrossSectionalFactorPriorthe active mask and the Return Forecast history on its block, and anOpinionPoolingPriorthe rows ofpe1, its pooled weights and the cache ofpe2inpc. The refit of an entropy pooling prior around it then runs no regression and no opinion. Every other prior forwards it to the prior that it wraps. Default isfalse. It reachespe.a_peandpe.f_pe.kwargs...: More keyword arguments, forpe.a_pe. They describe the asset axis, for example an active mask or implied volatilities, so they do not reachpe.f_pe.
Validation
dims in (1, 2).- If
pe.a_viewsis aLinearConstraintEstimator,length(pe.sets.dict[pe.sets.xkey]) == size(X, 2). - If
pe.f_viewsis aLinearConstraintEstimator,haskey(pe.sets.dict, pe.sets.tfkey)andlength(pe.sets.dict[pe.sets.tfkey]) == size(F, 2), both throughfactor_universe.
pe.w has no named check. When pe.l is set, a pe.w with a length other than size(X, 2) raises a bare DimensionMismatch from the product in equilibrium_mu. When pe.l is nothing, no step reads pe.w.
Returns
pr::LowOrderPrior: Result object with the reconstructed asset returns, and with the asset half of the augmented posterior asmuandsigma. It carries the observation weighting of the asset prior, its diagnostics, the cache of its opinion pool, and the regression result. Its factor blockfprholds the factor half of the same posterior.cholisnothingon both blocks.
Algorithm
- Orient
XandFwithdims_oriented, toobservations × assetsandobservations × factors. - When
pe.a_viewsresolves names, check that the declared asset axis has the same length as the width ofX. - When
pe.f_viewsresolves names, check the declared factor axis against the width ofFwithfactor_universe. Only the views that resolve names against an axis check that axis, and a pair of precomputedBlackLittermanViewsneeds nosets. - Fit
pe.a_peonX. The result isa_prior. - Find the Investable Mask and the reduced universe of the asset views with
investable_views. Refuse a precomputed asset view matrix over a universe with gaps, withassert_bl_precomputed_universe. Viewa_priorat the mask withinvestable_prior. From this step on,Nis the reduced count of assets. - Fit
pe.f_peonF, withstrictandcache_regalone. The result isf_prior. - Reduce
Xat the mask withreduce_columns. Regress it onFwithfactor_reconstruction, underpe.reviewed to the same mask withcoverage_regression. The results arerrand the reconstructed returnsposterior_X, both on the reduced asset axis. - Make the asset views with
bl_prerollat the default:xkey, over the reduced asset prior covariance. Make the factor views at:tfkey, over the factor prior covariance. Either half can lose all its rows.bl_view_blockthen gives that half no row, and the stack stays, because the other half still conditions the joint posterior. A departure can empty only the asset half, because a factor axis holds no asset name. When both halves are empty, no view is left, and step 12 takes the joint prior. - Build $\boldsymbol{\Sigma}_{aug}$. Its off-diagonal blocks are the cross-covariance $\mathbf{M}\boldsymbol{\Sigma}_f$ of the factor model and its transpose.
- Stack $\mathbf{P}_{aug}$ block-diagonally, and stack $\boldsymbol{q}_{aug}$ and $\boldsymbol{\Omega}_{aug}$ to match. The asset rows are above the factor rows.
- Put the stacked prior mean on the total-return scale of the views. The result is
aug_prior_mu. Whenpe.lisnothing, it stacks the wrapped means, which are on that scale already. Whenpe.lis set, it is the equilibrium mean ofequilibrium_mu, pluspe.rffromapply_rf, plusrr.bon the asset half. The equilibrium mean is a risk premium, and it readspe.wsliced to the reduced axis byinvestable_weights_view. - Run the master equations with
vanilla_posteriorsover the augmented space. The result is the augmented posterior pair. When neither half has a view row left,vanilla_posteriorsgives back the joint prior. The master equations with an empty $\mathbf{P}_{aug}$ add $\tau\boldsymbol{\Sigma}_{aug}$, and that makes the joint covariance wider with no view to cause it. - Process the augmented posterior covariance in place with
sample_matrix_processing!, underpe.mp,hcat(posterior_X, F)and the smaller of the counts of the two prior covariances. - Truncate the asset half from
1:N. Add nothing to it. The intercept and the rate went into the prior mean at step 11, and the update is affine in that mean. - Let
nbe the smaller of the row counts ofa_prior.Xandf_prior.X. A Scenario Cap in one nested prior keeps only the last rows of its own returns. The two blocks of the result must describe the same observations, so the result keeps the lastnrows. Cut the nested prior with more rows withscenario_tail. It refuses to cut a prior that carries weights, and it gives the count of the moments ineoc. With no cap,nis the count of all observations, and the step cuts nothing. The fit of the moments used every observation, so the cut changes no moment. - Truncate the factor half from
N+1:N+K. Forward the factor block withforward_prior, and dropchol. The factor half gets no intercept, because the intercept belongs to the regression and to the asset axis alone. It gets no rate, because the stack had the rate before the update. It gets no second processing pass, because it is a principal submatrix of the matrix that step 13 processed. Do not expand the block, because the reduction did not change the factor axis. - Announce the departures once with
announce_bl_departures. - Build the prior result directly. It takes
w, its diagnostics andpcfroma_prior. It takes the lastnrows of the reconstruction asXand of the orientedXaso_X, both cut byscenario_window. It writes each block on the asset axis back onto the full universe.expand_momentwrites the moment pair,expand_columnswrites the reconstruction, andexpand_regressionwrites the regression.
Related
References
- [12]
- D. Cajas. Advanced Portfolio Optimization: A Cutting-edge Quantitative Approach (Springer Nature Switzerland, 2025).
- [156]
- W. Cheung. The augmented Black-Litterman model: a ranking-free approach to factor-based portfolio construction and beyond. Quantitative Finance 13, 301–316 (2013).