Factor risk contribution
PortfolioOptimisers.FactorRiskContributionResult Type
struct FactorRiskContributionResult{__T_jr, __T_rr, __T_frc_plr, __T_fb} <: RiskJuMPOptimisationResultResult type for Factor Risk Contribution portfolio optimisation.
Fields
jr: Shared JuMP result core, seeJuMPOptimisationResult.rr: Regression result.frc_plr: Factor risk contribution placeholder result.fb: Fallback result or estimator.
Property access delegates to the embedded JuMPOptimisationResult; unknown properties forward into rr first, then through jr (including the virtual :w and the pa fall-through).
Related
sourcePortfolioOptimisers.factory Method
factory(a::Union{Nothing, <:AbstractEstimator, <:AbstractAlgorithm,
<:AbstractResult}, args...; kwargs...) -> aNo-op factory function for constructing objects with a uniform interface.
Defining methods which dispatch on the first argument allows for a consistent factory interface across different types.
Arguments
a: Indicates no object should be constructed.args...: Arbitrary positional arguments (ignored).kwargs...: Arbitrary keyword arguments (ignored).
Returns
a: The input unchanged.
Examples
julia> factory(nothing, 1, 2; x = 3)
julia> factory(MeanValue())
MeanValue
w ┴ nothingRelated
sourcefactory(res::NonFiniteAllocationOptimisationResult, fb::Option{<:OptE_Opt})Rebuild a continuous optimisation result with an updated fallback optimiser fb.
Every optimisation result carries fb as its last field, so the generic rebuild copies all fields unchanged except the trailing fb. Concrete result types may override this method when rebuilding requires more than swapping fb.
Related
sourcefactory(
opt::Union{NonFiniteAllocationOptimisationEstimator, NonFiniteAllocationOptimisationResult},
_
) -> RandomWeighted{_A, var"#s179", _B, _C, _D, var"#s1791", _E, Bool} where {_A, var"#s179"<:AbstractRNG, _B, _C, _D, var"#s1791"<:WeightFinaliser, _E}Return opt unchanged.
Default pass-through factory for optimisation estimators and results. Overridden for estimators that carry parameters requiring update at each optimisation step.
Related
sourceBase.getproperty Method
getproperty(
r::FactorRiskContributionResult,
sym::Symbol
) -> AnyAccess properties of FactorRiskContributionResult. Unique fields rr/frc_plr resolve directly; unknown properties forward into rr first, then delegate to the embedded JuMPOptimisationResult jr (the virtual :w and pa fall-through).
PortfolioOptimisers.FactorRiskContribution Type
struct FactorRiskContribution{__T_opt, __T_re, __T_r, __T_obj, __T_frc_ple, __T_sets, __T_wi, __T_flag, __T_fb} <: RiskJuMPOptimisationEstimatorFactor Risk Contribution (FRC) portfolio optimiser.
FactorRiskContribution allocates portfolio weights so that each factor (and the idiosyncratic component) contributes a target proportion to the total portfolio risk. It combines factor regression with a JuMP-based risk budgeting optimisation.
Mathematical definition
Factor model:
Factor risk contribution for factor
Where:
: Return vector of asset . : Intercept (idiosyncratic return) for asset . : Factor returns matrix. : Factor loading vector for asset . : Idiosyncratic residual for asset . : Risk contribution of factor . : Portfolio-level exposure to factor . : Portfolio risk measure. : Portfolio weight vector.
Fields
opt:JuMPoptimiser configuration.re: Regression estimator.r: Risk measure or vector of risk measures.obj: Portfolio objective function.frc_ple: Factor risk contribution placeholder constraints.sets: Sets used to map estimator values to features.wi: Initial portfolio weights for warm-starting the solver.flag: Algorithm selection flag.fb: Fallback result or estimator.
Constructors
FactorRiskContribution(;
opt::JuMPOptimiser = JuMPOptimiser(),
re::RegE_Reg = StepwiseRegression(),
r::RM_VecRM = Variance(),
obj::ObjectiveFunction = MinimumRisk(),
frc_ple::Option{<:PlCE_PhC_VecPlCE_PlC} = nothing,
sets::Option{<:AssetSets} = nothing,
wi::Option{<:VecNum} = nothing,
flag::Bool = false,
fb::Option{<:OptE_Opt} = nothing
) -> FactorRiskContributionKeywords correspond to the struct's fields.
Validation
If
ris a vector:!isempty(r).If
wiis provided:!isempty(wi).
Propagated parameters
When factory is called on this type, the following @fprop-tagged fields are automatically propagated:
opt: Recursively updated viafactory.r: Recursively updated viafactory.fb: Recursively updated viafactory.
Related
sourcePortfolioOptimisers.needs_previous_weights Method
needs_previous_weights(opt::FactorRiskContribution) -> AnyReturn true if any sub-estimator of opt requires previous portfolio weights (JuMP optimiser, risk measure, or fallback).
PortfolioOptimisers.port_opt_view Method
port_opt_view(
frc::FactorRiskContribution,
i,
X::AbstractMatrix{<:Union{var"#s20", var"#s19"} where {var"#s20"<:Number, var"#s19"<:AbstractJuMPScalar}},
args...
) -> FactorRiskContribution{JuMPOptimiser{__T_pe, __T_slv, __T_wb, __T_bgt, __T_sbgt, __T_lt, __T_st, __T_lcse, __T_cte, __T_gcarde, __T_sgcarde, __T_smtx, __T_sgmtx, __T_slt, __T_sst, __T_sglt, __T_sgst, __T_tn, __T_fees, __T_sets, __T_tr, __T_ple, __T_ret, __T_sca, __T_ccnt, __T_cobj, __T_sc, __T_so, __T_ss, __T_card, __T_scard, __T_nea, __T_l1, __T_l2, __T_linf, __T_lp, __T_brt, __T_cle_pr, __T_strict}, _A, _B, var"#s179", _C, _D, _E, Bool} where {__T_pe, __T_slv, __T_wb, __T_bgt, __T_sbgt, __T_lt, __T_st, __T_lcse, __T_cte, __T_gcarde, __T_sgcarde, __T_smtx, __T_sgmtx, __T_slt, __T_sst, __T_sglt, __T_sgst, __T_tn, __T_fees, __T_sets, __T_tr, __T_ple, __T_ret, __T_sca, __T_ccnt, __T_cobj, __T_sc, __T_so, __T_ss, __T_card, __T_scard, __T_nea, __T_l1, __T_l2, __T_linf, __T_lp, __T_brt, __T_cle_pr, __T_strict, _A, _B, var"#s179"<:ObjectiveFunction, _C, _D, _E}Return a cluster-sliced copy of FactorRiskContribution for asset index set i and returns matrix X.
PortfolioOptimisers.set_factor_risk_contribution_constraints! Method
set_factor_risk_contribution_constraints!(model, re, ...)Add factor risk contribution constraints to the JuMP model.
Sets up the factor-level risk budgeting constraints in the optimisation model, using the regression result or estimator re to specify factor loadings.
Arguments
model: JuMP model.re: Regression result or estimator (RegE_Reg).Additional risk and budget parameters.
Returns
nothing.
Related
sourcePortfolioOptimisers.optimise Function
optimise(frc::FactorRiskContribution{<:Any, <:Any, <:Any, <:Any, <:Any, <:Any,
<:Any, <:Any, Nothing
},
rd::ReturnsResult = ReturnsResult(); dims::Int = 1,
str_names::Bool = false, save::Bool = true, kwargs...) -> FactorRiskContributionResultRun the Factor Risk Contribution portfolio optimisation.
Arguments
frc: The factor risk contribution optimiser to use.rd: The returns result to use. Ifisa(frc.opt.pe, AbstractPriorResult),rdis not necessary if doing a standalone optimisation, but may be required/desired by fallbacks and/or clusterisation.dims: The dimension along which observations advance in time.str_names: Whether to use string names for the assets in the optimisation.save: Whether to save the JuMP model in the optimisation result.kwargs: Additional keyword arguments passed to the optimisation function.
Related
source