Power Norm X at Risk: private API

PortfolioOptimisers.PRM — Function
PRM(x::VecNum, slv::Option{<:Slv_VecSlv}, alpha::Number = 0.05, p::Number = 2.0,
    w::Option{<:ObsWeights} = nothing) -> Number

Compute the Power Norm Value-at-Risk of the returns x with a power cone programme.

PowerNormValueatRisk states the measure, its programme and the condition under which it is the largest loss. Under that condition the function returns the largest loss and builds no model. Otherwise every call builds a new JuMP model. The model holds the rows of the observations of positive weight only. An observation of weight zero does not change the optimum, but the rows of a large loss can stop the solver away from the optimum.

Algorithm

  1. Check w against x with checked_observation_weights.
  2. Check that slv is a solver, and not empty when it is a vector, with checked_kernel_solver. The check comes before step 3, so the function refuses slv = nothing also when it needs no model.
  3. When power_norm_is_worst_loss holds, return the largest loss among the observations of positive weight, with worst_positive_weight_loss. This step builds no model.
  4. Build and solve the power cone programme that PRM_model states.
  5. When a solver solves the model, return its objective value. Otherwise, return NaN.

Arguments

  • x: Vector of portfolio returns.
  • slv: Solver or vector of solvers.
  • alpha: Significance level, $\alpha \in (0, 1)$.
  • p: Order of the power norm, $p > 1$.
  • w: Observation weights, or nothing for equal weights.

Validation

The function does not check alpha or p. The constructors of the measures check them.

Returns

  • The Power Norm Value-at-Risk of x, or NaN when step 6 does not return and no solver of slv solves the programme.

Related

References

  • [205] P. A. Krokhmal. Higher moment coherent risk measures. Quantitative Finance 7, 373–387 (2007). Equation 32.
  • [206] P. R. Chares. Cones and interior-point algorithms for structured convex optimization involving powers and exponentials. Ph.D. Thesis, Université catholique de Louvain, Louvain-la-Neuve, Belgium (2009). Section 4.1, Equations 4.4 and 4.5.
source
PortfolioOptimisers.PRM_worst_case — Function
PRM_worst_case(x::VecNum, slv::Option{<:Slv_VecSlv}, alpha::Number = 0.05, p::Number = 2.0,
               w::Option{<:ObsWeights} = nothing) -> Option{<:VecNum}

Compute the Worst-Case Distribution of the Power Norm Value-at-Risk of the returns x, from the dual of the programme of PRM_model.

The Power Norm Value-at-Risk is a coherent measure, so it is the largest expected loss over a set of distributions, and the Worst-Case Distribution $\boldsymbol{q}$ is the distribution in the set that reaches it. So the expected loss under $\boldsymbol{q}$ equals the value of PRM, to the tolerance of the solver, and $-\boldsymbol{q}$ is the gradient of that value with respect to x. risk_contribution and risk_gradient read it through worst_case_distribution. PRM does not compute it, so a call of expected_risk does not pay for it.

Algorithm

  1. Check w against x with checked_observation_weights.
  2. Check that slv is a solver, and not empty when it is a vector, with checked_kernel_solver. The check comes before step 3, so the function refuses slv = nothing also when it needs no model.
  3. When power_norm_is_worst_loss holds, return the distribution of the largest loss, with worst_loss_distribution. This step builds no model.
  4. Build and solve the programme with PRM_model.
  5. When no solver solves the model, or the solver gives no dual, return nothing.
  6. Otherwise, take the dual of each row of prm_loss, and expand it to T entries with expand_positive_weight_rows.

Arguments

  • x: Vector of portfolio returns.
  • slv: Solver or vector of solvers.
  • alpha: Significance level, $\alpha \in (0, 1)$.
  • p: Order of the power norm, $p > 1$.
  • w: Observation weights, or nothing for equal weights.

Validation

Returns

  • q::VecNum: The Worst-Case Distribution, one entry for each observation. An observation of weight zero has the entry zero.
  • nothing: When no solver of slv solves the programme, or the solver gives no dual.

Related

source
PortfolioOptimisers.power_norm_is_worst_loss — Function
power_norm_is_worst_loss(x::VecNum, alpha::Number, p::Number, w::Option{<:VecNum})
    -> Bool

Return whether the Power Norm Value-at-Risk of x is the largest loss among the observations of positive weight.

PowerNormValueatRisk states the condition: alpha is at most the probability of the largest loss to the power 1/p. PRM and PRM_worst_case read it, and build no model when it holds.

Algorithm

  1. Find l, the largest loss among the observations of positive weight, with worst_positive_weight_loss.
  2. Find pl, the probability of the observations at the loss l. It is their number divided by the number of observations without w, and their share of the sum of w with it.
  3. Return whether alpha is at most pl to the power 1/p.

Arguments

  • x: Vector of portfolio returns.
  • alpha: Significance level, $\alpha \in (0, 1)$.
  • p: Order of the power norm, $p > 1$.
  • w: Checked observation weights, or nothing for equal weights.

Returns

  • Bool: Whether the measure is the largest loss.

Related

source
PortfolioOptimisers.PRM_model — Function
PRM_model(x::VecNum, slv::Slv_VecSlv, alpha::Number, p::Number, w::Option{<:VecNum})
    -> Option{JuMP.Model}

Build the power cone programme of PRM in a new model, and solve it.

PRM reads the objective value of the solved model, and PRM_worst_case reads the dual of its rows prm_loss. The callers check w and slv first, and they answer the case of power_norm_is_worst_loss without a model.

Algorithm

  1. Find rows, the indices of the observations of positive weight, and N, their number. Without w, rows holds every observation.
  2. Build the programme below in a new model. Its objective reads iaT, which is the inverse of alpha times the number of observations to the power 1/p without w, and the inverse of alpha times the sum of w to the power 1/p with it. The rows read xr, the entries of x in rows.
  3. Solve the model with the solvers of slv in turn.
  4. When a solver solves the model, return the model. Otherwise, return nothing.

JuMP formulation

Variables

  • pvar_eta: free scalar $\eta$.
  • pvar_t: free scalar $t$.
  • pvar_w: $N \times 1$ vector $\boldsymbol{w}$, bounded below by zero, with one entry for each observation in $\mathcal{I}$.
  • pvar_v: free $N \times 1$ vector $\boldsymbol{v}$, with one entry for each observation in $\mathcal{I}$.

Constraints

No row carries a string name. The model registers these rows:

  • $\sum_{i \in \mathcal{I}} v_i - t \leq 0$ without observation weights, and $\sum_{i \in \mathcal{I}} q_i v_i - t \leq 0$ with them.
  • prm_loss: $x_i + w_i + \eta \geq 0$, one row for each $i \in \mathcal{I}$.
  • $(v_i,\, t,\, w_i) \in \mathcal{K}_{\mathrm{pow}}(1/p)$, one row for each $i \in \mathcal{I}$.

The cone rows give $v_i \geq w_i^{p} / t^{p-1}$, so the first row gives $t \geq \left(\sum_{i \in \mathcal{I}} w_i^{p}\right)^{1/p}$ without observation weights. At the optimum $w_i = \max(L_i - \eta, 0)$, so the objective is the minimum of PowerNormValueatRisk over $\eta$. An observation of weight zero has $p_i = 0$, so it adds no term to that minimum.

The dual of the row of observation $i$ in prm_loss is the entry of that observation in the Worst-Case Distribution of the measure, the distribution whose expected loss is the value of the measure. PRM_worst_case reads it.

Objective

  • The model minimises $\eta + t / (\alpha T^{1/p})$ without observation weights, and $\eta + t / (\alpha W_{T}^{1/p})$ with them.

Where:

  • $\boldsymbol{x}$: Portfolio returns vector $T \times 1$.
  • $T$: Number of observations.
  • $\alpha$: Significance level (left tail probability), $\alpha \in (0, 1)$.
  • $p > 1$: Order of the power norm.
  • $L_i = -x_i$: Loss at observation $i$.
  • $\mathcal{I}$: Set of the observations of positive weight. Without observation weights, it holds all $T$ observations.
  • $q_i$: Observation weight of observation $i$.
  • $W_{T} = \sum_{t=1}^{T} q_t$: Total observation weight.
  • $p_i$: Probability of observation $i$. It is $1/T$ without observation weights, and the $i$-th observation weight divided by the sum of the weights with them.
  • $\eta$: Threshold of the losses.
  • $t$: Power norm bound on $\boldsymbol{w}$.
  • $w_i$: Excess loss of observation $i$ above the threshold $\eta$.
  • $v_i$: Power term bound of observation $i$, a bound on $w_i^{p} / t^{p-1}$.
  • $\mathcal{K}_{\mathrm{pow}}(p) = \{(a,b,c) : a^{p} b^{1-p} \geq |c|,\, a \geq 0,\, b \geq 0\}$: Power cone.

Arguments

  • x: Vector of portfolio returns.
  • slv: Solver or vector of solvers.
  • alpha: Significance level, $\alpha \in (0, 1)$.
  • p: Order of the power norm, $p > 1$.
  • w: Checked observation weights, or nothing for equal weights.

Returns

  • model::JuMP.Model: The solved model.
  • nothing: When no solver of slv solves the programme.

Related

source

References

[205]
P. A. Krokhmal. Higher moment coherent risk measures. Quantitative Finance 7, 373–387 (2007).
[206]
P. R. Chares. Cones and Interior-Point Algorithms for Structured Convex Optimization Involving Powers and Exponentials. Ph.D. Thesis, Université catholique de Louvain (Louvain-la-Neuve, Belgium, 2009).