Skip to content
5

Factor Black-Litterman Prior

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

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: 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, if nothing, defaults to 1/T where T is the number of observations.

  • rsd: Boolean flag to include residual variance in posterior covariance.

Constructor

julia
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

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

Related

source
PortfolioOptimisers.prior Method
julia
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 is 1.

  • 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 provided, 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