Skip to content
13

Entropy Pooling

PortfolioOptimisers.RhoParsingResult Type
julia
struct RhoParsingResult{__T_vars, __T_coef, __T_op, __T_rhs, __T_eqn, __T_ij} <: AbstractParsingResult

Structured result for correlation view constraint equation parsing.

RhoParsingResult is produced when parsing correlation view constraints, such as those used in entropy pooling prior models. It extends the standard ParsingResult by including an ij field, which stores the tuple of asset pairs (indices) relevant for the correlation view.

Fields

  • vars: Variable names in the parsed constraint expression.

  • coef: Coefficients corresponding to the constraint variables.

  • op: Comparison operator (==, <=, or >=).

  • rhs: Right-hand side value of the constraint.

  • eqn: Formatted string representation of the constraint equation.

  • ij: Pair of asset indices for correlation-based constraints.

Details

  • Produced by correlation view parsing routines, typically when the constraint involves asset pairs (e.g., "(A, B) == 0.5").

  • The ij field enables downstream routines to map parsed correlation views to the appropriate entries in the correlation matrix.

  • Used internally for entropy pooling, Black-Litterman, and other advanced portfolio models that support correlation views.

Related

source
PortfolioOptimisers.H0_EntropyPooling Type
julia
struct H0_EntropyPooling <: AbstractEntropyPoolingAlgorithm

One-shot entropy pooling. It sets and optimises all the constraints simultaneously. This introduces bias in the posterior probabilities, but is faster.

Related

source
PortfolioOptimisers.H1_EntropyPooling Type
julia
struct H1_EntropyPooling <: AbstractEntropyPoolingAlgorithm

Uses the initial probabilities to optimise the posterior probabilities at every step. This reduces bias in the posterior probabilities, but is slower.

Related

source
PortfolioOptimisers.H2_EntropyPooling Type
julia
struct H2_EntropyPooling <: AbstractEntropyPoolingAlgorithm

Uses the previous step's probabilities to optimise the next step's probabilities. This is faster but may introduce bias.

Related

source
PortfolioOptimisers.StagedEP Type
julia
const StagedEP = Union{<:H1_EntropyPooling, <:H2_EntropyPooling}

Alias for a union of staged entropy pooling algorithm types.

Related

source
PortfolioOptimisers.LogEntropyPooling Type
julia
struct LogEntropyPooling <: AbstractEntropyPoolingOptAlgorithm

Logarithmic entropy pooling optimisation algorithm.

LogEntropyPooling is a concrete subtype of AbstractEntropyPoolingOptAlgorithm representing the logarithmic entropy pooling optimisation algorithm. This algorithm solves for posterior probabilities by minimising the Kullback-Leibler divergence between the prior and posterior weights, subject to moment and view constraints, using a logarithmic objective.

Related

source
PortfolioOptimisers.ExpEntropyPooling Type
julia
struct ExpEntropyPooling <: AbstractEntropyPoolingOptAlgorithm

Exponential entropy pooling optimisation algorithm.

ExpEntropyPooling is a concrete subtype of AbstractEntropyPoolingOptAlgorithm representing the exponential entropy pooling optimisation algorithm. This algorithm solves for posterior probabilities by minimising the exponential divergence between the prior and posterior weights, subject to moment and view constraints, using an exponential objective.

Related

source
PortfolioOptimisers.CVaREntropyPooling Type
julia
struct CVaREntropyPooling{__T_args, __T_kwargs} <: AbstractEntropyPoolingOptimiser

Conditional Value-at-Risk (CVaR) entropy pooling optimiser.

CVaREntropyPooling is a concrete subtype of AbstractEntropyPoolingOptimiser that uses root-finding algorithms from Roots.jl to solve entropy pooling problems with CVaR (Conditional Value-at-Risk) view constraints. This optimiser is designed for scenarios where CVaR views are specified and requires robust numerical methods to find the solution.

Fields

  • args: Additional positional arguments passed to the optimisation function.

  • kwargs: Additional keyword arguments passed to the optimisation function.

Constructors

julia
CVaREntropyPooling(;
    args::Tuple = (Roots.Brent(),),
    kwargs::NamedTuple = (;)
) -> CVaREntropyPooling

Keywords correspond to the struct's fields.

Examples

julia
julia> CVaREntropyPooling()
CVaREntropyPooling
    args ┼ Tuple{Roots.Brent}: (Roots.Brent(),)
  kwargs ┴ @NamedTuple{}: NamedTuple()

Related

source
PortfolioOptimisers.OptimEntropyPooling Type
julia
struct OptimEntropyPooling{__T_args, __T_kwargs, __T_sc1, __T_sc2, __T_alg} <: AbstractEntropyPoolingOptimiser

Optim.jl-based entropy pooling optimiser.

OptimEntropyPooling is a concrete subtype of AbstractEntropyPoolingOptimiser that uses Optim.jl to solve entropy pooling problems. This optimiser supports both logarithmic and exponential entropy pooling objectives, and allows for flexible configuration of solver arguments, scaling parameters, and algorithm selection.

Fields

  • args: Additional positional arguments passed to the optimisation function.

  • kwargs: Additional keyword arguments passed to the optimisation function.

  • sc1: Scaling parameter for the objective function.

  • sc2: Scaling parameter for constraint penalties.

  • alg: Entropy pooling optimisation algorithm.

Constructors

julia
OptimEntropyPooling(;
    args::Tuple = (),
    kwargs::NamedTuple = (;),
    sc1::Number = 1,
    sc2::Number = 1e3,
    alg::AbstractEntropyPoolingOptAlgorithm = ExpEntropyPooling()
) -> OptimEntropyPooling

Keywords correspond to the struct's fields.

Validation

  • sc1 >= 0

  • sc2 >= 0

Examples

julia
julia> OptimEntropyPooling()
OptimEntropyPooling
    args ┼ Tuple{}: ()
  kwargs ┼ @NamedTuple{}: NamedTuple()
     sc1 ┼ Int64: 1
     sc2 ┼ Float64: 1000.0
     alg ┴ ExpEntropyPooling()

Related

source
PortfolioOptimisers.JuMPEntropyPooling Type
julia
struct JuMPEntropyPooling{__T_slv, __T_sc1, __T_sc2, __T_so, __T_alg} <: AbstractEntropyPoolingOptimiser

JuMP.jl-based entropy pooling optimiser.

JuMPEntropyPooling is a concrete subtype of AbstractEntropyPoolingOptimiser that uses JuMP.jl to solve entropy pooling problems. This optimiser supports both logarithmic and exponential entropy pooling objectives, and allows for flexible configuration of solver arguments, scaling parameters, and algorithm selection.

Fields

  • slv: Solver or vector of solvers.

  • sc1: Scaling parameter for the objective function.

  • sc2: Scaling parameter for constraint penalties.

  • so: Objective scale factor.

  • alg: Entropy pooling optimisation algorithm.

Constructors

julia
JuMPEntropyPooling(;
    slv::Slv_VecSlv,
    sc1::Number = 1,
    sc2::Number = 1e5,
    so::Number = 1,
    alg::AbstractEntropyPoolingOptAlgorithm = ExpEntropyPooling()
) -> JuMPEntropyPooling

Keywords correspond to the struct's fields.

Validation

  • If slv is a vector, !isempty(slv).

  • sc1 >= 0

  • sc2 >= 0

  • so >= 0

Examples

julia
julia> JuMPEntropyPooling(; slv = Solver(; name = :fake_solver, solver = :MySolver))
JuMPEntropyPooling
  slv ┼ Solver
      │          name ┼ Symbol: :fake_solver
      │        solver ┼ Symbol: :MySolver
      │      settings ┼ nothing
      │     check_sol ┼ @NamedTuple{}: NamedTuple()
      │   add_bridges ┴ Bool: true
  sc1 ┼ Int64: 1
  sc2 ┼ Float64: 100000.0
   so ┼ Int64: 1
  alg ┴ ExpEntropyPooling()

Related

source
PortfolioOptimisers.NonCVaREP Type
julia
const NonCVaREP = Union{<:OptimEntropyPooling, <:JuMPEntropyPooling}

Alias for a union of non-CVaR entropy pooling algorithm types.

Related

source
PortfolioOptimisers.EntropyPoolingPrior Type
julia
struct EntropyPoolingPrior{__T_pe, __T_mu_views, __T_var_views, __T_cvar_views, __T_sigma_views, __T_sk_views, __T_kt_views, __T_cov_views, __T_rho_views, __T_var_alpha, __T_cvar_alpha, __T_sets, __T_ds_opt, __T_dm_opt, __T_opt, __T_w, __T_alg} <: AbstractLowOrderPriorEstimator_AF

Entropy pooling prior estimator for asset returns.

EntropyPoolingPrior is a low order prior estimator that computes the mean and covariance of asset returns using entropy pooling. It supports moment and view constraints (mean, variance, CVaR, covariance, skewness, kurtosis, correlation), flexible confidence specification, and composable optimisation algorithms. The estimator integrates asset sets, view constraints, and multiple entropy pooling algorithms (Optim.jl, JuMP.jl, CVaR root-finding), and allows for custom prior weights and solver configuration.

Fields

  • pe: Prior estimator.

  • mu_views: Expected returns views estimator or result.

  • var_views: Variance views estimator or result.

  • cvar_views: Conditional value-at-risk views estimator or result.

  • sigma_views: Covariance views estimator or result.

  • sk_views: Coskewness views estimator or result.

  • kt_views: Cokurtosis views estimator or result.

  • cov_views: Covariance views estimator or result.

  • rho_views: Correlation views estimator or result.

  • var_alpha: Quantile level for variance views.

  • cvar_alpha: Quantile level for conditional value-at-risk views.

  • sets: Sets used to map estimator values to features.

  • ds_opt: Dual sigma optimisation estimator.

  • dm_opt: Dual mean optimisation estimator.

  • opt: Entropy pooling optimisation estimator.

  • w: Prior observation probability weights. If nothing, uniform weights are used.

  • alg: Entropy pooling algorithm.

Constructors

julia
EntropyPoolingPrior(;
    pe::AbstractLowOrderPriorEstimator_A_F_AF = EmpiricalPrior(),
    mu_views::Option{<:LinearConstraintEstimator} = nothing,
    var_views::Option{<:LinearConstraintEstimator} = nothing,
    cvar_views::Option{<:LinearConstraintEstimator} = nothing,
    sigma_views::Option{<:LinearConstraintEstimator} = nothing,
    sk_views::Option{<:LinearConstraintEstimator} = nothing,
    kt_views::Option{<:LinearConstraintEstimator} = nothing,
    cov_views::Option{<:LinearConstraintEstimator} = nothing,
    rho_views::Option{<:LinearConstraintEstimator} = nothing,
    var_alpha::Number = 0.05,
    cvar_alpha::Number = 0.05,
    sets::Option{<:AssetSets} = nothing,
    ds_opt::Option{<:CVaREntropyPooling} = nothing,
    dm_opt::Option{<:OptimEntropyPooling} = nothing,
    opt::NonCVaREP = OptimEntropyPooling(),
    w::Option{<:StatsBase.ProbabilityWeights} = nothing,
    alg::AbstractEntropyPoolingAlgorithm = H1_EntropyPooling()
) -> EntropyPoolingPrior

Keywords correspond to the struct's fields.

Validation

  • If any view constraint is not nothing, sets must not be nothing.

  • If not nothing, 0 < var_alpha < 1.

  • If not nothing, 0 < cvar_alpha < 1.

  • If w is not nothing, it must be non-empty and match the number of observations.

Details

  • If w is not nothing, it is normalised to sum to 1; otherwise, uniform weights are used when prior is called.

  • If var_views is not nothing without var_alpha, defaults to 0.05.

  • If cvar_views is not nothing without cvar_alpha, defaults to 0.05.

Examples

julia
julia> EntropyPoolingPrior(; sets = AssetSets(; key = "nx", dict = Dict("nx" => ["A", "B", "C"])),
                           mu_views = LinearConstraintEstimator(;
                                                                val = ["A == 0.03",
                                                                       "B + C == 0.04"]))
EntropyPoolingPrior
           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
     mu_views ┼ LinearConstraintEstimator
              │   val ┼ Vector{String}: ["A == 0.03", "B + C == 0.04"]
              │   key ┴ nothing
    var_views ┼ nothing
   cvar_views ┼ nothing
  sigma_views ┼ nothing
     sk_views ┼ nothing
     kt_views ┼ nothing
    cov_views ┼ nothing
    rho_views ┼ nothing
    var_alpha ┼ nothing
   cvar_alpha ┼ nothing
         sets ┼ AssetSets
              │    key ┼ String: "nx"
              │   ukey ┼ String: "ux"
              │   dict ┴ Dict{String, Vector{String}}: Dict("nx" => ["A", "B", "C"])
       ds_opt ┼ nothing
       dm_opt ┼ nothing
          opt ┼ OptimEntropyPooling
              │     args ┼ Tuple{}: ()
              │   kwargs ┼ @NamedTuple{}: NamedTuple()
              │      sc1 ┼ Int64: 1
              │      sc2 ┼ Float64: 1000.0
              │      alg ┴ ExpEntropyPooling()
            w ┼ nothing
          alg ┴ H1_EntropyPooling()

Related

source
PortfolioOptimisers.factory Method
julia
factory(
    pe::EntropyPoolingPrior,
    w::Union{DynamicAbstractWeights, AbstractWeights}
) -> EntropyPoolingPrior{_A, _B, _C, _D, _E, _F, _G, _H, _I, _J, _K, _L, _M, _N, _O, ProbabilityWeights{S, T, V}, <:AbstractEntropyPoolingAlgorithm} where {_A, _B, _C, _D, _E, _F, _G, _H, _I, _J, _K, _L, _M, _N, _O, S<:Real, T<:Real, V<:AbstractVector{T}}

Return a new EntropyPoolingPrior estimator with observation weights w applied to the underlying prior estimator and stored as the entropy pooling weights.

Related

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

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

source
PortfolioOptimisers.VecEP Type
julia
abstract type AbstractArray{var"#s869"<:EntropyPoolingPrior, 1}

Alias for an abstract vector of EntropyPoolingPrior elements.

Related

source
PortfolioOptimisers.prior Function
julia
prior(pe::EntropyPoolingPrior{<:Any, <:Any, <:Any, <:Any, <:Any, <:Any, <:Any, <:Any, <:Any,
                              <:Any, <:Any, <:Any, <:Any, <:Any, <:Any,
                              <:StagedEP},
      X::MatNum; F::Option{<:MatNum} = nothing, dims::Int = 1,
      strict::Bool = false, kwargs...)

Compute entropy pooling prior moments for asset returns with iterative constraint enforcement.

prior estimates the mean and covariance of asset returns using the entropy pooling framework, supporting iterative constraint enforcement via the H1_EntropyPooling and H2_EntropyPooling algorithms. It integrates moment and view constraints (mean, variance, CVaR, skewness, kurtosis, correlation), flexible confidence specification, and composable optimisation algorithms. The method iteratively applies constraints, updating prior weights and moments at each step, and ensures that higher moment views do not inadvertently alter lower moments.

Mathematical definition

Entropy pooling finds posterior weights p by minimising the Kullback-Leibler divergence from the prior q:

minpt=1Tptlnptqts.t.Aeqp=beq,Aineqpbineq,p0,1p=1.

Where:

  • p: T×1 posterior weight vector.

  • q: T×1 prior weight vector.

  • Aeq, beq: Equality constraint matrix and vector.

  • Aineq, bineq: Inequality constraint matrix and vector.

  • T: Number of observations.

Posterior moments are then computed as probability-weighted sample statistics using p.

Arguments

  • pe: Entropy pooling prior estimator with iterative algorithm .

  • X: Asset returns matrix (observations × assets).

  • F: Optional factor matrix (default: nothing).

  • dims: Dimension along which to perform the computation.

  • If true, throws error for missing assets; otherwise, issue warnings.

  • kwargs...: Additional keyword arguments passed to underlying estimators and solvers.

Returns

  • pr::LowOrderPrior: Result object containing asset returns, posterior mean vector, posterior covariance matrix, weights, effective number of scenarios, Kullback-Leibler divergence, and optional factor moments.

Validation

  • dims in (1, 2).

  • If any view constraint is not nothing, !isnothing(sets).

  • If prior weights pe.w are provided, length(pe.w) == T, where T is the number of observations.

Details

  • If isnothing(pe.w), prior weights are initialised to 1/T where T is the number of observations; otherwise, provided weights are normalised.

  • Constraints are enforced iteratively, from lower to higher moments.

  • Moment and view constraints are parsed and added to the constraint dictionary.

  • The initial weights for each stage is selected according to pe.alg.

  • At each stage, the prior weights are updated by solving the entropy pooling optimisation with the current set of constraints. If present, the CVaR views are also enforced at every stage.

  • Lower moments are fixed as needed to prevent distortion by higher moment views. If asset i has a view enforced on moment N that uses moments n < N to compute, then all moments n for asset i are fixed.

  • The final result includes the effective number of scenarios and Kullback-Leibler divergence between prior and posterior weights.

Related

source
PortfolioOptimisers.prior Function
julia
prior(pe::EntropyPoolingPrior{<:Any, <:Any, <:Any, <:Any, <:Any, <:Any, <:Any, <:Any, <:Any,
                              <:Any, <:Any, <:Any, <:Any, <:Any, <:Any,
                              <:H0_EntropyPooling}, X::MatNum;
      F::Option{<:MatNum} = nothing, dims::Int = 1, strict::Bool = false,
      kwargs...)

Compute entropy pooling prior moments for asset returns with single-shot constraint enforcement.

prior estimates the mean and covariance of asset returns using the entropy pooling framework, enforcing all moment and view constraints in a single optimisation step via the H0_EntropyPooling algorithm. This approach is fast but may distort lower moments when higher moment views are present, as all constraints are applied simultaneously.

Mathematical definition

Entropy pooling finds posterior weights p by minimising the Kullback-Leibler divergence from the prior q subject to all constraints simultaneously:

minpt=1Tptlnptqts.t.Aeqp=beq,Aineqpbineq,p0,1p=1.

Where:

  • p: T×1 posterior weight vector.

  • q: T×1 prior weight vector.

  • Aeq, beq: Equality constraint matrix and vector.

  • Aineq, bineq: Inequality constraint matrix and vector.

  • T: Number of observations.

Arguments

  • pe: Entropy pooling prior estimator with single-shot algorithm.

  • X: Asset returns matrix (observations × assets).

  • F: Optional factor matrix.

  • dims: Dimension along which to perform the computation.

  • strict: If true, throws error for missing assets; otherwise, issues warnings.

  • kwargs...: Additional keyword arguments passed to underlying estimators and solvers.

Returns

  • pr::LowOrderPrior: Result object containing asset returns, posterior mean vector, posterior covariance matrix, weights, effective number of scenarios, Kullback-Leibler divergence, and optional factor moments.

Validation

  • dims in (1, 2).

  • If any view constraint is not nothing, !isnothing(pe.sets).

  • If prior weights pe.w are provided, length(pe.w) == T, where T is the number of observations

Details

  • If isnothing(pe.w), prior weights are initialised to 1/T where T is the number of observations; otherwise, provided weights are normalised.

  • All constraints are parsed and added to the constraint dictionary at once. This means that lower moments may be distorted by higher moment views, since they cannot be fixed at any point.

  • A single optimisation is performed to solve for the posterior weights, enforcing all constraints at once.

  • The final result includes the effective number of scenarios and Kullback-Leibler divergence between prior and posterior weights.

Related

source
PortfolioOptimisers.port_opt_view Method
julia
port_opt_view(
    pe::EntropyPoolingPrior,
    i,
    args...
) -> EntropyPoolingPrior{_A, _B, _C, _D, _E, _F, _G, _H, _I, _J, _K, _L, _M, _N, _O, _P, <:AbstractEntropyPoolingAlgorithm} where {_A, _B, _C, _D, _E, _F, _G, _H, _I, _J, _K, _L, _M, _N, _O, _P}

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

Related

source
PortfolioOptimisers.AbstractEntropyPoolingOptimiser Type
julia
abstract type AbstractEntropyPoolingOptimiser <: AbstractEstimator

Abstract supertype for entropy pooling optimisers.

AbstractEntropyPoolingOptimiser is the base type for all optimisers that compute entropy pooling weights subject to moment and view constraints. All concrete entropy pooling optimisers should subtype this type to ensure a consistent interface for entropy pooling routines and integration with portfolio optimisation workflows.

Related

source
PortfolioOptimisers.AbstractEntropyPoolingAlgorithm Type
julia
abstract type AbstractEntropyPoolingAlgorithm <: AbstractAlgorithm

Abstract supertype for entropy pooling algorithms.

AbstractEntropyPoolingAlgorithm is the base type for all algorithms used in entropy pooling optimisation routines. All concrete entropy pooling algorithms should subtype this type to ensure a consistent interface for entropy pooling methods and integration with portfolio optimisation workflows.

Related

source
PortfolioOptimisers.AbstractEntropyPoolingOptAlgorithm Type
julia
abstract type AbstractEntropyPoolingOptAlgorithm <: AbstractAlgorithm

Abstract supertype for entropy pooling optimisation algorithms.

AbstractEntropyPoolingOptAlgorithm is the base type for all optimisation algorithms used in entropy pooling routines. All concrete entropy pooling optimisation algorithms should subtype this type to ensure a consistent interface for entropy pooling optimisation and integration with portfolio optimisation workflows.

Related

source
PortfolioOptimisers.add_ep_constraint! Function
julia
add_ep_constraint!(epc::AbstractDict, lhs::MatNum, rhs::VecNum, key::Symbol)

Add an entropy pooling view constraint to the constraint dictionary.

add_ep_constraint! normalises and adds a constraint to the entropy pooling constraint dictionary epc. If a constraint with the same key already exists, it concatenates the new constraint to the existing one. This function is used internally to build the set of linear constraints for entropy pooling optimisation.

Arguments

  • epc: Dictionary of entropy pooling constraints, mapping keys to (lhs, rhs) pairs.

  • lhs: Left-hand side constraint matrix.

  • rhs: Right-hand side constraint vector.

  • key: Constraint type key (:eq, :ineq, :feq, :cvar_eq).

Returns

  • nothing: The function mutates epc in-place.

Related

source
PortfolioOptimisers.replace_prior_views Function
julia
replace_prior_views(res::ParsingResult, pr::AbstractPriorResult, sets::AssetSets,
                    key::Symbol; alpha::Option{<:Number} = nothing,
                    strict::Bool = false)

Replace prior references in view parsing results with their corresponding prior values.

replace_prior_views scans a parsed view constraint ParsingResult for references to prior values (e.g., prior(A)), and replaces them with the actual prior value from the provided prior result object. This ensures that prior-based terms in view constraints are treated as constants and not as variables in the optimisation. If an asset referenced in a prior is not found in the asset set, a warning is issued (or an error if strict=true). If all variables in the view are prior references, an error is thrown.

Arguments

  • res: Parsed view constraint containing variables and coefficients.

  • pr: Prior result object containing prior values.

  • sets: Asset set mapping asset names to indices.

  • key: Moment type key (:mu, :var, :cvar, etc.).

  • alpha: Optional confidence level for VaR/CVaR views.

  • strict: If true, throws error for missing assets; otherwise, issue warnings.

Returns

  • res::ParsingResult: Updated parsing result with prior references replaced by their values.

Details

  • Prior references are matched using the pattern prior(<asset>).

  • The right-hand side of the constraint is adjusted by subtracting the prior value times its coefficient.

  • Variables corresponding to prior references are removed from the constraint.

  • Throws an error if no non-prior variables remain.

Related

source
julia
replace_prior_views(res::VecPR, args...; kwargs...)

Broadcast prior reference replacement across multiple view constraints.

replace_prior_views applies replace_prior_views to each element of a vector of parsed view constraints, replacing prior references with their corresponding prior values.

Arguments

Returns

  • res::Vector{<:ParsingResult}: Vector of updated parsing results with prior references replaced by their values.

Related

source
PortfolioOptimisers.replace_coprior_views Function
julia
replace_coprior_views(res::ParsingResult, pr::AbstractPriorResult, sets::AssetSets, key::Symbol;
                      strict::Bool = false)

Replace correlation prior references in view parsing results with their corresponding prior values.

replace_coprior_views scans a parsed correlation view constraint (ParsingResult) for references to prior values (e.g., prior(A, B)), and replaces them with the actual prior correlation value from the provided prior result object. This ensures that prior-based terms in correlation view constraints are treated as constants and not as variables in the optimisation. If an asset referenced in a prior is not found in the asset set, a warning is issued (or an error if strict=true). If all variables in the view are prior references, an error is thrown.

Arguments

  • res: Parsed correlation view constraint containing variables and coefficients.

  • pr: Prior result object containing prior correlation values.

  • sets: Asset set mapping asset names to indices.

  • key: Symbol representing whether it's a correlation or covariance view.

  • strict: If true, throws error for missing assets; otherwise, issue warnings.

Returns

  • res::RhoParsingResult: Updated parsing result with prior references replaced by their values and correlation indices.

Details

  • Prior references are matched using the pattern prior(<asset1>, <asset2>).

  • The right-hand side of the constraint is adjusted by subtracting the prior correlation value times its coefficient.

  • Variables corresponding to prior references are removed from the constraint.

  • Throws an error if no non-prior variables remain.

  • Returns a RhoParsingResult containing the updated variables, coefficients, operator, right-hand side, equation string, and correlation indices.

Related

source
julia
replace_coprior_views(res::VecPR, args...; kwargs...)

Broadcast prior reference replacement across multiple view constraints.

replace_coprior_views applies replace_coprior_views to each element of a vector of parsed view constraints, replacing prior references with their corresponding prior values.

Arguments

Returns

  • res::Vector{<:ParsingResult}: Vector of updated parsing results with prior references replaced by their values.

Related

source
PortfolioOptimisers.get_pr_value Function
julia
get_pr_value(pr::AbstractPriorResult, i::Integer, ::Val{:mu}, args...)

Extract the mean (expected return) for asset i from a prior result.

get_pr_value returns the mean value for the asset indexed by i from the prior result object pr. This method is used internally to replace prior references in view constraints and for moment extraction in entropy pooling and other prior-based routines.

Arguments

  • pr: Prior result containing asset return information.

  • i: Index of the asset.

  • ::Val{:mu}: Dispatch tag for mean extraction.

  • args...: Additional arguments (ignored).

Returns

  • mu::Number: Mean (expected return) for asset i.

Related

source
julia
get_pr_value(pr::AbstractPriorResult, i::Integer, ::Val{:var}, alpha::Number)

Extract the Value-at-Risk (VaR) for asset i from a prior result.

get_pr_value computes the VaR at confidence level alpha for the asset indexed by i from the prior result object pr. This method uses the asset return samples in pr and applies the VaR calculation, typically using the empirical quantile.

Arguments

  • pr: Prior result containing asset return information.

  • i: Index of the asset.

  • ::Val{:var}: Dispatch tag for VaR extraction.

  • alpha: Confidence level (e.g., 0.05 for 5% VaR).

Returns

  • var::Number: Value-at-Risk for asset i at level alpha.

Related

source
julia
get_pr_value(pr::AbstractPriorResult, i::Integer, ::Val{:cvar}, alpha::Number)

Compute the Conditional Value-at-Risk (CVaR) for asset i from a prior result.

get_pr_value extracts the CVaR at confidence level alpha for the asset indexed by i from the prior result object pr. This method assumes the prior result contains the necessary asset return information (mean, covariance, or samples) to compute CVaR, typically under a normality assumption.

Arguments

  • pr: Prior result containing asset return information.

  • i: Index of the asset.

  • ::Val{:cvar}: Dispatch tag for CVaR computation.

  • alpha: Confidence level.

Returns

  • cvar::Number: Conditional Value-at-Risk for asset i at level alpha.

Related

source
julia
get_pr_value(pr::AbstractPriorResult, i::Integer, ::Val{:sigma}, args...)

Extract the variance for asset i from a prior result.

get_pr_value returns the variance (diagonal element of the covariance matrix) for the asset indexed by i from the prior result object pr. This method is used internally to replace prior references in view constraints and for moment extraction in entropy pooling and other prior-based routines.

Arguments

  • pr: Prior result containing asset return information.

  • i: Index of the asset.

  • ::Val{:sigma}: Dispatch tag for variance extraction.

  • args...: Additional arguments (ignored).

Returns

  • sigma::Number: Variance for asset i.

Related

source
julia
get_pr_value(pr::AbstractPriorResult, i::Integer, j::Integer, args...)

Extract the prior correlation value between assets i and j from a prior result.

get_pr_value returns the correlation coefficient between the assets indexed by i and j from the prior result object pr. This method is used internally to replace prior references in correlation view constraints and for moment extraction in entropy pooling and other prior-based routines.

Arguments

  • pr: Prior result containing asset return information.

  • i: Index of the first asset.

  • j: Index of the second asset.

  • args...: Additional arguments (ignored).

Returns

  • rho::Number: Correlation coefficient between assets i and j.

Related

source
julia
get_pr_value(
    pr::AbstractPriorResult,
    i::AbstractVector{<:Integer},
    j::AbstractVector{<:Integer},
    args...
) -> Any

Extract the normalised average correlation between asset groups i and j from a prior result.

get_pr_value returns the Frobenius norm of the correlation sub-matrix divided by the group length for vector index sets i and j. This variant handles grouped asset correlation views.

Arguments

  • pr: Prior result containing asset return information.

  • i: Vector of indices for the first asset group.

  • j: Vector of indices for the second asset group.

  • args...: Additional arguments (ignored).

Returns

  • rho::Number: Normalised average correlation between asset groups i and j.

Related

source
julia
get_pr_value(pr::AbstractPriorResult, i::Integer, ::Val{:skew}, args...)

Extract the skewness for asset i from a prior result.

get_pr_value returns the skewness of the asset indexed by i from the prior result object pr. This method is used internally to replace prior references in view constraints and for higher moment extraction in entropy pooling and other prior-based routines.

Arguments

  • pr: Prior result containing asset return information.

  • i: Index of the asset.

  • ::Val{:skew}: Dispatch tag for skewness extraction.

  • args...: Additional arguments (ignored).

Returns

  • skew::Number: Skewness for asset i.

Related

source
julia
get_pr_value(pr::AbstractPriorResult, i::Integer, ::Val{:kurtosis}, args...)

Extract the kurtosis for asset i from a prior result.

get_pr_value returns the kurtosis of the asset indexed by i from the prior result object pr. This method is used internally to replace prior references in view constraints and for higher moment extraction in entropy pooling and other prior-based routines.

Arguments

  • pr: Prior result containing asset return information.

  • i: Index of the asset.

  • ::Val{:kurtosis}: Dispatch tag for kurtosis extraction.

  • args...: Additional arguments (ignored).

Returns

  • kurtosis::Number: Kurtosis for asset i.

Related

source
PortfolioOptimisers.ep_mu_views! Function
julia
ep_mu_views!(mu_views::Nothing, args...; kwargs...)

No-op pass-through for mean view constraints when none are specified.

ep_mu_views! is an internal API compatibility method that does nothing when mean view constraints (mu_views) are not provided (mu_views = nothing). This allows higher-level entropy pooling routines to uniformly call ep_mu_views! without special-casing the absence of mean views.

Arguments

  • mu_views::Nothing: Indicates that no mean view constraints are specified.

  • args...: Additional positional arguments (ignored).

  • kwargs...: Additional keyword arguments (ignored).

Returns

  • nothing.

Related

source
julia
ep_mu_views!(mu_views::LinearConstraintEstimator, epc::AbstractDict,
             pr::AbstractPriorResult, sets::AssetSets; strict::Bool = false)

Parse and add mean (expected return) view constraints to the entropy pooling constraint dictionary.

ep_mu_views! parses mean view equations from a LinearConstraintEstimator, replaces any prior references with their actual values, and constructs the corresponding linear constraints for entropy pooling. The constraints are then added to the entropy pooling constraint dictionary epc. This method is used internally by entropy pooling routines to enforce mean views in the optimisation.

Arguments

  • mu_views: Mean view constraints.

  • epc: Dictionary of entropy pooling constraints, mapping keys to (lhs, rhs) pairs.

  • pr: Prior result containing asset return information.

  • sets: Asset set mapping asset names to indices.

  • strict: If true, throws error for missing assets; otherwise, issue warnings.

Returns

  • nothing: The function mutates epc in-place.

Details

  • Parses view equations and replaces groupings by assets.

  • Replaces prior references in views with their actual prior values.

  • Converts parsed views to linear constraints and adds them to epc.

  • Supports both equality and fixed equality constraints.

Related

source
PortfolioOptimisers.fix_mu! Function
julia
fix_mu!(epc::AbstractDict, fixed::BitVector, to_fix::BitVector,
        pr::AbstractPriorResult)

Add constraints to fix the mean of specified assets in entropy pooling.

fix_mu! identifies assets in to_fix that are not yet fixed (i.e., not present in fixed), and adds constraints to the entropy pooling constraint dictionary epc to fix their mean to the prior value. This ensures that higher moment views (e.g., variance, skewness, kurtosis, correlation) do not inadvertently alter the mean of these assets. The function updates fixed in-place to reflect the newly fixed assets.

Arguments

  • epc: Dictionary of entropy pooling constraints, mapping keys to (lhs, rhs) pairs.

  • fixed: Boolean vector indicating which assets have their mean fixed.

  • to_fix: Boolean vector indicating which assets should have their mean fixed.

  • pr: Prior result containing asset return information.

Returns

  • nothing: The function mutates epc and fixed in-place.

Details

  • Adds a fixed equality constraint (:feq) for each asset in to_fix that is not yet fixed.

  • Uses the prior mean values from pr.mu for the constraint right-hand side.

Related

source
PortfolioOptimisers.ep_var_views! Function
julia
ep_var_views!(var_views::Nothing, args...; kwargs...)

No-op pass-through for variance view constraints when none are specified.

ep_var_views! is an internal API compatibility method that does nothing when variance view constraints (var_views) are not provided (var_views = nothing). This allows higher-level entropy pooling routines to uniformly call ep_var_views! without special-casing the absence of variance views.

Arguments

  • var_views::Nothing: Indicates that no variance view constraints are specified.

  • args...: Additional positional arguments (ignored).

  • kwargs...: Additional keyword arguments (ignored).

Returns

  • nothing.

Related

source
julia
ep_var_views!(var_views::LinearConstraintEstimator, epc::AbstractDict,
              pr::AbstractPriorResult, sets::AssetSets, alpha::Number; strict::Bool = false)

Parse and add variance (VaR) view constraints to the entropy pooling constraint dictionary.

ep_var_views! parses variance (VaR) view equations from a LinearConstraintEstimator, replaces any prior references with their actual values, and constructs the corresponding linear constraints for entropy pooling. The constraints are then added to the entropy pooling constraint dictionary epc. This method validates that only single-asset, non-negative, and unit-coefficient views are allowed, and throws informative errors for invalid or extreme views.

Arguments

  • var_views: Variance (VaR) view constraints.

  • epc: Dictionary of entropy pooling constraints, mapping keys to (lhs, rhs) pairs.

  • pr: Prior result containing asset return information.

  • sets: Asset set mapping asset names to indices.

  • alpha: Confidence level for VaR.

  • strict: If true, throws error for missing assets; otherwise, issue warnings.

Returns

  • nothing: The function mutates epc in-place.

Details

  • Parses view equations and replaces groupings by assets.

  • Replaces prior references in views with their actual prior values.

  • Converts parsed views to linear constraints and adds them to epc.

  • Validates that only equality and inequality constraints with unit coefficients are present.

  • Throws errors for negative or multi-asset views, or if the view is more extreme than the worst realisation.

Related

source
PortfolioOptimisers.entropy_pooling Function
julia
entropy_pooling(w::VecNum, epc::AbstractDict, opt::OptimEntropyPooling)

Solve the dual of the exponential entropy pooling formulation using Optim.jl.

entropy_pooling computes posterior probabilities by minimising the exponential divergence between prior and posterior weights, subject to moment and view constraints. The optimisation is performed using Optim.jl, supporting box constraints and slack variables for relaxed equality constraints. This method is used internally by EntropyPoolingPrior when the optimiser is an OptimEntropyPooling.

Mathematical definition

The dual of the entropy pooling KL divergence problem is solved for Lagrange multipliers x. The dual objective (for ExpEntropyPooling) is:

minxxb+t=1Tqtexp(xAt1).

The optimal posterior weights recover as:

pt=qtexp(xAt1).

Where:

  • x: Lagrange multipliers (dual variables).

  • b: Right-hand side constraint vector.

  • At: t-th column of the constraint matrix A.

  • qt: Prior weight for scenario t.

  • pt: Optimal posterior weight for scenario t.

  • T: Number of observations.

Arguments

  • w: Prior weights (length = number of observations).

  • epc: Dictionary of entropy pooling constraints, mapping keys to (lhs, rhs) pairs.

  • `opt: Optim.jl-based entropy pooling optimiser with exponential objective.

    • ::OptimEntropyPooling{<:Any, <:Any, <:Any, <:Any, <:ExpEntropyPooling}: Use the exponential formulation.

    • ::OptimEntropyPooling{<:Any, <:Any, <:Any, <:Any, <:LogEntropyPooling}: Use the logarithmic formulation.

Returns

  • pw::StatsBase.ProbabilityWeights: Posterior probability weights satisfying the constraints.

Details

  • Constructs the constraint matrix and bounds from epc.

  • Relaxes fixed equality constraints via slack variables to make the problem more tractable.

  • Throws an error if optimisation fails.

Related

source
julia
entropy_pooling(w::VecNum, epc::AbstractDict, opt::JuMPEntropyPooling)

Solve the primal of the exponential entropy pooling formulation using JuMP.jl.

entropy_pooling computes posterior probabilities by minimising the exponential divergence between prior and posterior weights, subject to moment and view constraints. The optimisation is performed using JuMP.jl, supporting relative entropy cones and slack variables for relaxed equality constraints. This method is used internally by EntropyPoolingPrior when the optimiser is a JuMPEntropyPooling.

Arguments

  • w: Prior weights (length = number of observations).

  • epc: Dictionary of entropy pooling constraints, mapping keys to (lhs, rhs) pairs.

  • opt: JuMP.jl-based entropy pooling optimiser with exponential objective.

    • ::JuMPEntropyPooling{<:Any, <:Any, <:Any, <:Any, <:ExpEntropyPooling}: Use the exponential formulation.

    • ::JuMPEntropyPooling{<:Any, <:Any, <:Any, <:Any, <:LogEntropyPooling}: Use the logarithmic formulation.

Returns

  • pw::StatsBase.ProbabilityWeights: Posterior probability weights satisfying the constraints.

Details

  • Constructs the JuMP model with exponential objective and constraints from epc.

  • Relaxes fixed equality constraints by adding norm one cone bounded slack variables to make the problem more tractable.

  • Throws an error if optimisation fails.

Related

source
PortfolioOptimisers.ep_cvar_views_solve! Function
julia
ep_cvar_views_solve!(cvar_views::Nothing, epc::AbstractDict, ::Any, ::Any, ::Number,
                     w::StatsBase.ProbabilityWeights, opt::AbstractEntropyPoolingOptimiser, ::Any, ::Any;
                     kwargs...)

Solve entropy pooling views when no CVaR views are specified.

ep_cvar_views_solve! is an internal API compatibility method that solves the entropy pooling problem when no Conditional Value-at-Risk (CVaR) view constraints are present (cvar_views = nothing). It simply delegates to the main entropy pooling solver using the provided prior weights, constraint dictionary, and optimiser.

Arguments

  • cvar_views: Indicates that no CVaR view constraints are specified.

  • epc: Dictionary of entropy pooling constraints, mapping keys to (lhs, rhs) pairs.

  • w: Prior probability weights.

  • opt: Entropy pooling optimiser.

  • kwargs...: Additional keyword arguments forwarded to the solver.

Returns

  • pw::StatsBase.ProbabilityWeights: Posterior probability weights satisfying the constraints.

Details

  • This method is used for API compatibility when CVaR views are not present.

  • Calls entropy_pooling with the provided arguments.

Related

source
julia
ep_cvar_views_solve!(cvar_views::LinearConstraintEstimator, epc::AbstractDict,
                     pr::AbstractPriorResult, sets::AssetSets, alpha::Number,
                     w::StatsBase.ProbabilityWeights, opt::AbstractEntropyPoolingOptimiser,
                     ds_opt::Option{<:CVaREntropyPooling},
                     dm_opt::Option{<:OptimEntropyPooling}; strict::Bool = false)

Solve the entropy pooling problem with Conditional Value-at-Risk (CVaR) view constraints.

ep_cvar_views_solve! parses and validates CVaR view constraints, replaces prior references, and constructs the corresponding entropy pooling constraint system. It then solves for posterior probability weights using either root-finding (for single CVaR view) or optimisation (for multiple views), depending on the number of constraints and the provided optimiser. Throws informative errors if views are infeasible or too extreme.

Arguments

  • cvar_views: CVaR view constraints.

  • epc: Dictionary of entropy pooling constraints, mapping keys to (lhs, rhs) pairs.

  • pr: Prior result containing asset return information.

  • sets: Asset set mapping asset names to indices.

  • alpha: Confidence level for CVaR.

  • w: Prior probability weights.

  • opt: Main entropy pooling optimiser.

  • ds_opt: CVaR-specific optimiser (for single view).

  • dm_opt: General optimiser (for multiple views).

  • strict: If true, throws error for missing assets; otherwise, issue warnings.

Returns

  • pw::StatsBase.ProbabilityWeights: Posterior probability weights satisfying CVaR view constraints.

Details

  • Parses CVaR view equations and replaces prior references.

  • Validates that only equality constraints are present and that each view targets a single asset.

  • Checks that views are not too extreme i.e. not greater than the worst realisation.

  • For a single CVaR view, uses root-finding via CVaREntropyPooling.

  • For multiple CVaR views, uses optimisation via OptimEntropyPooling.

  • Throws errors if optimisation fails or views are infeasible.

Related

source
PortfolioOptimisers.ep_sigma_views! Function
julia
ep_sigma_views!(sigma_views::LinearConstraintEstimator, epc::AbstractDict,
                pr::AbstractPriorResult, sets::AssetSets; strict::Bool = false)

Parse and add variance (sigma) view constraints to the entropy pooling constraint dictionary.

ep_sigma_views! parses variance view equations from a LinearConstraintEstimator, replaces any prior references with their actual values, and constructs the corresponding quadratic constraints for entropy pooling. The constraints are then added to the entropy pooling constraint dictionary epc. This method returns a boolean vector indicating which assets require their mean to be fixed to the prior value, ensuring that variance views do not inadvertently alter the mean.

Arguments

  • sigma_views: Variance view constraints.

  • epc: Dictionary of entropy pooling constraints, mapping keys to (lhs, rhs) pairs.

  • pr: Prior result containing asset return information.

  • sets: Asset set mapping asset names to indices.

  • strict: If true, throws error for missing assets; otherwise, issue warnings.

Returns

  • to_fix::BitVector: Boolean vector indicating which assets require their mean to be fixed.

Details

  • Parses view equations and replaces groupings by assets.

  • Replaces prior references in views with their actual prior values.

  • Converts parsed views to quadratic constraints and adds them to epc.

  • Returns a boolean vector for assets that need their mean fixed due to variance constraints.

Related

source
PortfolioOptimisers.fix_sigma! Function
julia
fix_sigma!(epc::AbstractDict, fixed::BitVector, to_fix::BitVector,
           pr::AbstractPriorResult)

Add constraints to fix the variance of specified assets in entropy pooling.

fix_sigma! identifies assets in to_fix that are not yet fixed (i.e., not present in fixed), and adds constraints to the entropy pooling constraint dictionary epc to fix their variance to the prior value. This ensures that higher moment views (e.g., skewness, kurtosis, correlation) do not inadvertently alter the variance of these assets. The function updates fixed in-place to reflect the newly fixed assets.

Arguments

  • epc: Dictionary of entropy pooling constraints, mapping keys to (lhs, rhs) pairs.

  • fixed: Boolean vector indicating which assets have their variance fixed.

  • to_fix: Boolean vector indicating which assets should have their variance fixed.

  • pr: Prior result containing asset return information.

Returns

  • nothing: The function mutates epc and fixed in-place.

Details

  • Adds a fixed equality constraint (:feq) for each asset in to_fix that is not yet fixed.

  • Uses the prior variance values from LinearAlgebra.diag(pr.sigma) for the constraint right-hand side.

Related

source
PortfolioOptimisers.ep_cov_views! Function
julia
ep_cov_views!(cov_views::LinearConstraintEstimator, epc::AbstractDict,
              pr::AbstractPriorResult, sets::AssetSets; strict::Bool = false)

Parse and add correlation view constraints to the entropy pooling constraint dictionary.

ep_cov_views! parses correlation view equations from a LinearConstraintEstimator, replaces any prior references with their actual values, and constructs the corresponding linear constraints for entropy pooling. The constraints are then added to the entropy pooling constraint dictionary epc. This method returns a boolean vector indicating which assets require their mean and variance to be fixed to the prior value, ensuring that correlation views do not inadvertently alter lower moments.

Arguments

  • cov_views: Correlation view constraints.

  • epc: Dictionary of entropy pooling constraints, mapping keys to (lhs, rhs) pairs.

  • pr: Prior result containing asset return information.

  • sets: Asset set mapping asset names to indices.

  • strict: If true, throws error for missing assets; otherwise, issue warnings.

Returns

  • to_fix::BitVector: Boolean vector indicating which assets require their mean and variance to be fixed.

Details

  • Parses view equations and replaces groupings by assets.

  • Replaces prior references in views with their actual prior correlation values.

  • Converts parsed views to linear constraints and adds them to epc.

  • Returns a boolean vector for assets that need their mean and variance fixed due to correlation constraints.

Related

source
PortfolioOptimisers.ep_rho_views! Function
julia
ep_rho_views!(rho_views::LinearConstraintEstimator, epc::AbstractDict,
              pr::AbstractPriorResult, sets::AssetSets; strict::Bool = false)

Parse and add correlation view constraints to the entropy pooling constraint dictionary.

ep_rho_views! parses correlation view equations from a LinearConstraintEstimator, replaces any prior references with their actual values, and constructs the corresponding linear constraints for entropy pooling. The constraints are then added to the entropy pooling constraint dictionary epc. This method returns a boolean vector indicating which assets require their mean and variance to be fixed to the prior value, ensuring that correlation views do not inadvertently alter lower moments.

Arguments

  • rho_views: Correlation view constraints.

  • epc: Dictionary of entropy pooling constraints, mapping keys to (lhs, rhs) pairs.

  • pr: Prior result containing asset return information.

  • sets: Asset set mapping asset names to indices.

  • strict: If true, throws error for missing assets; otherwise, issue warnings.

Returns

  • to_fix::BitVector: Boolean vector indicating which assets require their mean and variance to be fixed.

Details

  • Parses view equations and replaces groupings by assets.

  • Replaces prior references in views with their actual prior correlation values.

  • Converts parsed views to linear constraints and adds them to epc.

  • Returns a boolean vector for assets that need their mean and variance fixed due to correlation constraints.

Related

source
PortfolioOptimisers.ep_sk_views! Function
julia
ep_sk_views!(skew_views::LinearConstraintEstimator, epc::AbstractDict,
             pr::AbstractPriorResult, sets::AssetSets; strict::Bool = false)

Parse and add skewness view constraints to the entropy pooling constraint dictionary.

ep_sk_views! parses skewness view equations from a LinearConstraintEstimator, replaces any prior references with their actual values, and constructs the corresponding linear constraints for entropy pooling. The constraints are then added to the entropy pooling constraint dictionary epc. This method returns a boolean vector indicating which assets require their mean and variance to be fixed to the prior value, ensuring that skewness views do not inadvertently alter lower moments.

Arguments

  • skew_views: Skewness view constraints.

  • epc: Dictionary of entropy pooling constraints, mapping keys to (lhs, rhs) pairs.

  • pr: Prior result containing asset return information.

  • sets: Asset set mapping asset names to indices.

  • strict: If true, throws error for missing assets; otherwise, issue warnings.

Returns

  • to_fix::BitVector: Boolean vector indicating which assets require their mean and variance to be fixed.

Details

  • Parses view equations and replaces groupings by assets.

  • Replaces prior references in views with their actual prior skewness values.

  • Converts parsed views to linear constraints and adds them to epc.

  • Returns a boolean vector for assets that need their mean and variance fixed due to skewness constraints.

Related

source
PortfolioOptimisers.ep_kt_views! Function
julia
ep_kt_views!(kurtosis_views::LinearConstraintEstimator, epc::AbstractDict,
             pr::AbstractPriorResult, sets::AssetSets; strict::Bool = false)

Parse and add kurtosis view constraints to the entropy pooling constraint dictionary.

ep_kt_views! parses kurtosis view equations from a LinearConstraintEstimator, replaces any prior references with their actual values, and constructs the corresponding linear constraints for entropy pooling. The constraints are then added to the entropy pooling constraint dictionary epc. This method returns a boolean vector indicating which assets require their mean and variance to be fixed to the prior value, ensuring that kurtosis views do not inadvertently alter lower moments.

Arguments

  • kurtosis_views: Kurtosis view constraints.

  • epc: Dictionary of entropy pooling constraints, mapping keys to (lhs, rhs) pairs.

  • pr: Prior result containing asset return information.

  • sets: Asset set mapping asset names to indices.

  • strict: If true, throws error for missing assets; otherwise, issue warnings.

Returns

  • to_fix::BitVector: Boolean vector indicating which assets require their mean and variance to be fixed.

Details

  • Parses view equations and replaces groupings by assets.

  • Replaces prior references in views with their actual prior kurtosis values.

  • Converts parsed views to linear constraints and adds them to epc.

  • Returns a boolean vector for assets that need their mean and variance fixed due to kurtosis constraints.

Related

source