Skip to content
13

Factor Black-Litterman Prior

PortfolioOptimisers.FactorBlackLittermanPrior Type
julia
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_F

Factor 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

julia
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
) -> FactorBlackLittermanPrior

Keywords correspond to the struct's fields.

Validation

Examples

julia
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: true

Related

source
PortfolioOptimisers.factory Method
julia
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

source
Base.getproperty Method
julia
getproperty(
    obj::FactorBlackLittermanPrior,
    sym::Symbol
) -> Any

Access properties of FactorBlackLittermanPrior. Exposes :me and :ce from the embedded prior estimator obj.pe for transparent access.

source
PortfolioOptimisers.prior Method
julia
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 (Πf,Σf) via the standard BL equations, then asset posteriors are reconstructed through the loadings matrix:

μ^=Bμ^f,BL+α.Σ^=BΣ^f,BLB+Σε.

Where:

  • μ^: N×1 posterior asset mean vector.

  • Σ^: N×N posterior asset covariance matrix.

  • μ^f,BL: K×1 Black-Litterman posterior factor mean.

  • Σ^f,BL: K×K Black-Litterman posterior factor covariance.

  • B: N×K factor loadings matrix.

  • α: N×1 regression intercept vector.

  • Σε: N×N 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: If true, enforce strict validation of views and sets. Default is false.

  • 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.w is not nothing, length(pe.w) == size(X, 2).

Details

  • If dims == 2, X and F are 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 matrix P and view returns vector Q.

  • tau defaults to 1/T if not specified, where T is the number of observations.

  • The view uncertainty matrix omega is computed using calc_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 rsd is true, 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
PortfolioOptimisers.port_opt_view Method
julia
port_opt_view(pe::FactorBlackLittermanPrior, i, args...)

Return a new FactorBlackLittermanPrior estimator restricted to the assets at index i.

Related

source