Entropy pooling Prior (b)
A new tail view formulation adds a method of the lowering function of each measure that it serves. AbstractEntropyPoolingViewFormulation states the contract. The private page documents the other names of this topic.
PortfolioOptimisers.ep_add_cvar_view! — Function
ep_add_cvar_view!(tvs::AbstractVector, alg::CVaRVF,
x::AbstractVector{<:VecNum}, coef::VecNum, op::Symbol, rhs::Number,
alpha::Number, w::VecNum, pv::Number, eqn::AbstractString)Lower one conditional value-at-risk view into the tail view constraint that its formulation needs.
Algorithm
LinearConditionalValueatRiskViewchecks the three conditions of theValidationsection. Then it appends oneLinearConditionalValueatRiskViewConstraintthat holdsx,coef,alphaandrhs.IntegerConditionalValueatRiskViewsorts the loss series of each asset that the view names. The result is the ascending ordero. It finds the lengthsbof the tail window of that asset withep_sbar.- It keeps the last
sbpositions ofoasord[k], and the losses at those positions asxw[k]. - It appends one
IntegerConditionalValueatRiskViewConstraintthat holds those windows,coef,alpha,opandrhs. SequentialTailVieworients the view and splits its assets withep_sequential_sides. It builds aSequentialConditionalValueatRiskViewConstraintwith an empty surrogate row. It reads the first row at the priorwwithep_sequential_start, and appends the constraint.
Arguments
tvs: The vector of tail view constraints, to which the function appends.alg: The formulation of the view.x: The loss series of each asset that the view names.coef: The coefficient that the view gives the CVaR of each asset.op: The comparison operator of the view.rhs: The target value of the view.alpha: The significance level of the view.w: The prior probability weights.pv: The prior value of the left hand side of the view.eqn: The equation of the view, for the error messages.
Validation
LinearConditionalValueatRiskViewneeds coefficients of one sign, an operator other than<=, and, for an equality, a target at or above the prior value of the left hand side.
Returns
nothing: The function mutatestvsin-place.
Related
PortfolioOptimisers.ep_add_evar_view! — Function
ep_add_evar_view!(epc::AbstractDict, tvs::AbstractVector,
alg::EVaRVF,
x::AbstractVector{<:VecNum}, coef::VecNum, alpha::Number, op::Symbol,
rhs::Number, w::VecNum, zstar::VecNum, pv::Number, eqn::AbstractString;
args::Tuple = (), kwargs::NamedTuple = (;),
zlo_frac::Option{<:Number} = nothing)Lower one entropic value-at-risk view into the constraints that its formulation needs.
ConicEntropicValueatRiskView and SequentialTailView each make one tail view constraint. GridTailView makes linear rows on the posterior probabilities for the lower-bound half of the view, and a tail view constraint for the upper-bound half. So an equality view gets both.
Algorithm
ConicEntropicValueatRiskViewchecks the three conditions of theValidationsection. Then it appends oneConicEntropicValueatRiskViewConstraintthat holdsx,coef,alphaandrhs.GridTailViewchecks that the view names one asset. It normaliseswto sum to one, which giveswi.- It builds the grid
zof dual variables withep_evar_grid. - It keeps the points whose row is finite, as
keep, and raises an error ifkeepis empty. For the upper-bound half, it keeps only the points whose bound is positive, and raises an error if no point has a positive bound. - For the lower-bound half of the view, it builds the row of each kept point with
ep_evar_grid_row. It multiplies the row by minus one, so that the row has the<=sense of the key:ineq, and adds the row toepcunder that key withadd_ep_constraint!. - For the upper-bound half of the view, it appends one
GridEntropicValueatRiskViewConstraintthat holdsx, the kept grid,alpha,rhsand the big-M multiplierM. SequentialTailVieworients the view and splits its assets withep_sequential_sides. It builds aSequentialEntropicValueatRiskViewConstraintwith an empty surrogate row. It reads the first row at the priorwwithep_sequential_start, and appends the constraint.
Arguments
epc: The dictionary of entropy pooling constraints, from keys to(lhs, rhs)pairs.tvs: The vector of tail view constraints, to which the function appends.alg: The formulation of the view. A grid formulation also holds the number of steps and the tolerance of the anchor. A sequential formulation also holds the number of re-solves and their tolerance.x: The loss series of each asset that the view names.coef: The coefficient that the view gives the EVaR of each asset.alpha: The significance level of the view.op: The comparison operator of the view.rhs: The target value of the view.w: The prior probability weights. The search for the centre of the grid starts from them. A sequential view reads its first surrogate row at them.zstar: The dual variable that attains the prior EVaR of each asset.pv: The prior value of the left hand side of the view.eqn: The equation of the view, for the error messages.args: Additional positional arguments passed to the optimisation function.kwargs: Additional keyword arguments passed to the optimisation function.zlo_frac: The lower end of the bracket of the dual variable, as a fraction of the upper end, which goes toep_evar.
Validation
ConicEntropicValueatRiskViewneeds coefficients of one sign, an operator other than<=, and, for an equality, a target at or above the prior value of the left hand side.GridTailViewneeds one asset. It also needs at least one grid point whose row is finite and, if the view has an upper-bound half, whose bound is positive.ep_evar_grid_rowoverflows at a dual variable near zero, and its bound underflows to zero there. Part of the grid is near zero whenpctgoes near one. All of the grid is near zero whenalpha * Tis less than one, because the minimiser ofep_evaris then at the end of its bracket. The function drops these points, and raises an error if it keeps no point.
Returns
nothing: The function mutatesepcandtvsin-place.
Related
PortfolioOptimisers.ep_add_rlvar_view! — Function
ep_add_rlvar_view!(epc::AbstractDict, tvs::AbstractVector,
alg::RLVaRVF,
x::AbstractVector{<:VecNum}, coef::VecNum, alpha::Number,
kappa::Number, op::Symbol, rhs::Number, w::VecNum, zstar::VecNum,
pv::Number, eqn::AbstractString; args::Tuple = (),
kwargs::NamedTuple = (;),
bracket::Option{<:RelativisticValueatRiskViewBracket} = nothing)Lower one relativistic value-at-risk view into the constraints that its formulation needs.
ConicRelativisticValueatRiskView and SequentialTailView each make one tail view constraint. GridTailView makes linear rows on the posterior probabilities for the lower-bound half of the view, and a tail view constraint for the upper-bound half. So an equality view gets both.
Algorithm
ConicRelativisticValueatRiskViewchecks the three conditions of theValidationsection. Then it appends oneConicRelativisticValueatRiskViewConstraintthat holdsx,coef,alpha,kappaandrhs.GridTailViewchecks that the view names one asset. It normaliseswto sum to one, which giveswi.- It builds the grid
t,zof primal points withep_rlvar_grid. - It keeps the points whose row is finite, as
keep, and raises an error ifkeepis empty. For the upper-bound half, it keeps only the points whose bound is positive, and raises an error if no point has a positive bound. - For the lower-bound half of the view, it builds the row of each kept point with
ep_rlvar_grid_row. It multiplies the row by minus one, so that the row has the<=sense of the key:ineq, and adds the row toepcunder that key withadd_ep_constraint!. - For the upper-bound half of the view, it appends one
GridRelativisticValueatRiskViewConstraintthat holdsx, the kept grid,alpha,kappa,rhsand the big-M multiplierM. SequentialTailVieworients the view and splits its assets withep_sequential_sides. It builds aSequentialRelativisticValueatRiskViewConstraintwith an empty surrogate row. It reads the first row at the priorwwithep_sequential_start, and appends the constraint.
Arguments
epc: The dictionary of entropy pooling constraints, from keys to(lhs, rhs)pairs.tvs: The vector of tail view constraints, to which the function appends.alg: The formulation of the view. A grid formulation also holds the number of steps and the tolerance of the anchor. A sequential formulation also holds the number of re-solves and their tolerance.x: The loss series of each asset that the view names.coef: The coefficient that the view gives the RLVaR of each asset.alpha: The significance level of the view.kappa: The deformation parameter of the view.op: The comparison operator of the view.rhs: The target value of the view.w: The prior probability weights. The search for the centre of the grid starts from them. If that search does not converge, they set the shift of each grid point. A sequential view reads its first surrogate row at them.zstar: The dual variable that attains the prior RLVaR of each asset.pv: The prior value of the left hand side of the view. Withrhs, it sets the translation of a grid that has its centre at the prior.eqn: The equation of the view, for the error messages.args: Additional positional arguments passed to the optimisation function.kwargs: Additional keyword arguments passed to the optimisation function.bracket: The spans of the searches, which go toep_rlvarandep_rlvar_shift.
Validation
ConicRelativisticValueatRiskViewneeds coefficients of one sign, an operator other than<=, and, for an equality, a target at or above the prior value of the left hand side.GridTailViewneeds one asset. It also needs at least one grid point whose row is finite and, if the view has an upper-bound half, whose bound is positive.ep_rlvar_tailoverflows at a dual variable near zero, and the grid is near zero whenkappagoes near one. The boundrhs - t - z * ln_kappa(1 / (alpha * T))of a point is at or below zero when the target is below the value that the point can reach. The function drops these points, and raises an error if it keeps no point.
Returns
nothing: The function mutatesepcandtvsin-place.
Related