Meucci entropy pooling Prior: private API

Types

PortfolioOptimisers.VecMeucciEP — Type
const VecMeucciEP = AbstractVector{<:MeucciEntropyPoolingPrior}

Groups the vector forms of MeucciEntropyPoolingPrior that a method can dispatch on.

A caller that pools opinions holds many estimators, and a method that takes such a collection needs one type in its signature. The opinion pooling of the library uses the wider VecEP, which also admits EntropyPoolingPrior. VecMeucciEP is the narrower name for a method that takes only the recursive CVaR route.

Related

source
PortfolioOptimisers.CvarViewSearch — Type
struct CvarViewSearch{__T_X, __T_B, __T_alphas, __T_d_opt, __T_edge}

The search data of the conditional value at risk views of a Meucci entropy pooling estimator.

This type is an implementation detail and is not intended for direct use. ep_cvar_views_setup makes it. ep_cvar_views_solve! reads it.

Fields

  • X: X: The loss columns of the assets that the searched views name.
  • B: B: The target of each searched view.
  • alphas: alphas: The significance level of each searched view.
  • d_opt: d_opt: The optimiser of the search, or nothing when no view needs a search.
  • edge: edge: The (lhs, rhs) block of the views whose target is the worst loss of their asset on the support, or nothing when no view has such a target. Each row states -sum(p[W]) <= -alpha, where W holds the scenarios of that loss.

Related

source

Functions

PortfolioOptimisers.ep_cvar_views_setup — Function
ep_cvar_views_setup(cvar_views::Nothing, args...; kwargs...)

Return nothing when the estimator has no conditional value at risk view.

Arguments

  • cvar_views::Nothing: Shows that the estimator has no CVaR view.
  • args...: More positional arguments, which the method does not read.
  • kwargs...: More keyword arguments, which the method does not read.

Returns

Related

source
ep_cvar_views_setup(cvar_views::CVV_VecCVV, pr::AbstractPriorResult,
                    sets::UniverseSets, w::ScenarioProbabilities,
                    ds_opt::Option{<:ConditionalValueatRiskEntropyPooling},
                    dm_opt::Option{<:OptimEntropyPooling}; strict::Bool = false,
                    ledger::Option{<:AbstractVector} = nothing) ->
    Option{<:CvarViewSearch}

Resolve the conditional value at risk views once, into the data of one search.

ep_cvar_views_setup parses and checks the CVaR view groups, and it resolves every prior(...) reference against pr under w. It puts the groups into one loss matrix, one target vector and one level vector. It also selects the search that the targets need. ep_cvar_views_solve! reads this result and adds nothing to it.

The staged route of ep_prior searches up to three times, once for each stage, and each stage must read the same reference value. So ep_prior calls this function once, before the first solve. The call reads the first fit of the wrapped estimator and the prior probabilities of that fit. A later stage holds a refit pr whose weights are the posterior of the stage before. A reference resolved there gives a different target at each stage, and the view that the caller wrote changes. One call also keeps the parse out of the search, so the search does not parse again at each stage.

Mathematical definition

The conditional value at risk of a loss is never larger than the worst loss $L_{w}$ on the support. It equals that loss when, and only when, the posterior puts at least $\alpha$ on the scenarios of that loss. So a view at that target is one linear row:

\[\begin{align} \mathrm{CVaR}_{\alpha}(X) = L_{w} \iff \sum_{t \in W} p_{t} \geq \alpha\,, \qquad W = \left\{t : q_{t} > 0,\; -x_{t,\,i} = L_{w}\right\}. \end{align}\]

When the prior mass $\sum_{t \in W} q_{t}$ is at least $\alpha$, the prior meets the row, and the row adds no divergence. The search of ep_cvar_views_solve! cannot write such a view. Its row at every candidate value at risk below $L_{w}$ forces $\sum_{t \in W} p_{t} = \alpha$, so its residual is zero only up to rounding.

Where:

  • $\boldsymbol{p}$: $T \times 1$ posterior probabilities of the observations, summing to one. They are the unknown of the entropy pooling problem.
  • $\boldsymbol{q}$: $T \times 1$ prior probabilities of the observations, summing to one.
  • $x_{t,\,i}$: Return of asset $i$ at observation $t$.
  • $\alpha$: Significance level (left tail probability), $\alpha \in (0, 1)$.
  • $L_{w}$: Worst loss of asset $i$ on the support of the prior.
  • $W$: Scenarios of the support at the loss $L_{w}$.

Algorithm

  1. Loop over the view groups of cvar_views. One view group iterates as a collection of one element, so one loop reads both forms.
  2. For each view group, check that its alg is nothing, and read its significance level into alpha. Parse its equations, and accept only ==.
  3. Replace every group name by the assets of the group. Replace every prior(...) reference by the prior conditional value at risk at alpha under w, through replace_prior_views.
  4. Turn the parsed views into the equality block lcs. Under strict = false, every row of the group can drop, and lcs is then nothing. The group then states no view, and the loop goes to the next group.
  5. Check that each row of lcs names one asset, and that each target is not negative.
  6. For each row of the block, add the asset that it names to cols, its target to B, its level to alphas and its text to eqns. All the groups go into one search, because each level is only the divisor of the positive part of its own view.
  7. Read the worst realisation of every named asset on the support of w into min_X. Raise an error when a target is larger than it.
  8. Write each view whose target equals min_X as one row of the block edge. The row is -sum(p[W]) <= -alpha, where W holds the scenarios of the support at that loss. Keep the other views for the search.
  9. Select the search d_opt from the number of kept views. No kept view takes nothing. One kept view takes ds_opt, or a default ConditionalValueatRiskEntropyPooling. More than one kept view takes dm_opt, or a default OptimEntropyPooling over Optim.Fminbox.
  10. Return nothing when no group states a view, so the stage uses the plain solve. Otherwise, return the loss columns X, the targets B and the levels alphas of the kept views, the search d_opt and the block edge.

Arguments

  • cvar_views: One CVaR view group, or a vector of groups.
  • pr: Prior result that the prior(...) references read. It is the first fit of the wrapped estimator, not a refit of a later stage.
  • sets: Universe sets that map the asset names to indices.
  • w: Observation weights of the fit of pr. The prior(...) references resolve under these weights.
  • ds_opt: Search for one CVaR view, or nothing for the default.
  • dm_opt: Optimiser for more than one CVaR view, or nothing for the default.
  • strict: If true, raise an error for an asset that the universe does not hold. If false, warn.
  • ledger: The Departure Ledger of the entry of the fit, or nothing when no caller collects the drops. replace_group_by_assets and get_linear_constraints fill it.

Validation

  • No view group declares a view formulation. A group whose alg is not nothing raises an ArgumentError, because this route writes no constraint formulation.
  • Every view names one asset. A view over more than one asset raises an ArgumentError.
  • Every target is not negative. A negative target raises a DomainError.
  • Every target is at most the worst realisation of its asset over the scenarios at a positive weight of w. The CVaR equals that loss when the posterior puts at least the level of the view on the scenarios of that loss, and a posterior that is positive on every scenario does this. A larger target raises a DomainError. The message names every view that is too large, and the largest target that its asset accepts. ep_assert_reachable_view raises the same error type for one view, so one catch reads both.

Returns

  • nothing: No group states a view, because strict is false and every row of every group dropped.
  • cvv::CvarViewSearch: The search data, which holds the loss columns X, the targets B and the levels alphas of the searched views, the search d_opt, and the block edge of the views at the worst loss.

Related

References

  • [159] A. Meucci, D. Ardia and S. Keel. Fully flexible extreme views. The Journal of Risk 14, 39–49 (2011). Section 3, Equations 3.1 to 3.5.
source
PortfolioOptimisers.ep_cvar_views_solve! — Function
ep_cvar_views_solve!(cvv::Nothing, epc::AbstractDict,
                     w::ScenarioProbabilities,
                     opt::AbstractEntropyPoolingOptimiser)

Solve the entropy pooling problem when the estimator has no CVaR view.

ep_cvar_views_setup prepares no search when the estimator has no conditional value at risk view. Then this method solves the entropy pooling problem once, with the prior weights, the constraint dictionary and the optimiser that it gets. Both routes of ep_prior call it, so their code is the same with and without a CVaR view.

Algorithm

  1. Call entropy_pooling with the prior weights w, the constraint dictionary epc and the optimiser opt. The result is the posterior probability weights pw.
  2. Return pw. With no conditional value at risk view, there is no value at risk to search for. So the solve of the stage is the one call of step 1.

Arguments

  • cvv: Shows that ep_cvar_views_setup prepared no search.
  • epc: Dictionary of entropy pooling constraints, which maps each key to an (lhs, rhs) pair.
  • w: Prior probability weights.
  • opt: Entropy pooling optimiser.

Returns

  • pw::ScenarioProbabilities: Posterior probability weights that meet the constraints, in the kind of w.

Related

source
ep_cvar_views_solve!(cvv::CvarViewSearch, epc::AbstractDict,
                     w::ScenarioProbabilities,
                     opt::AbstractEntropyPoolingOptimiser)

Solve the entropy pooling problem with conditional value at risk (CVaR) views.

ep_cvar_views_solve! reads the targets, the levels, the search and the rows that ep_cvar_views_setup resolved. A view whose target is the worst loss of its asset on the support is a linear row, and every solve holds it. For the other views, it finds the posterior probability weights with a root search for one CVaR view, and with an optimisation for more than one. With no other view, it solves once. It parses nothing and resolves nothing, because the staged route calls it once for each stage, and every stage must read the same targets.

The search is over the value at risk levels etas, one for each searched view. A candidate is in [lo, B], where lo is the lowest loss of its asset on the support. A target is not negative, but the value at risk is below zero when the posterior puts less than alpha on the losses above zero. This search is a continuous relaxation of the recursive algorithm, which searches over discrete tail sizes. It gets the same target, and it also takes more than one view.

The bracket for one view stops a small distance inside B, at B * (1 - sqrt(eps)). At B, the constraint needs a posterior tail contribution of exactly zero. No posterior with all its weights above zero has such a contribution, so the problem at B is degenerate and its dual is unbounded. Roots evaluates the two ends of a bracket before it searches, so without the shrink each search for one view solves that problem once. The root is between about a third and two thirds of B, so the shrunk bracket holds it. The bracket starts at zero when the residual at zero is positive. Otherwise the root is at or below zero, and the bracket is [lo, 0]. When every loss of the asset on the support is above zero, lo is above zero, and the bracket starts at lo.

Mathematical definition

The conditional value at risk of asset $i$ is the value of the Rockafellar-Uryasev programme, and the minimiser of that programme is the value at risk. A view that sets it to $\bar{c}$ is a pair of conditions on the posterior. The first condition is linear in $\boldsymbol{p}$ at a fixed $\eta$, and the second condition fixes $\eta$:

\[\begin{align} \mathrm{CVaR}_{\alpha}(X) &= \underset{\eta}{\min}\; \left\{ \eta + \frac{1}{\alpha} \sum_{t=1}^{T} p_{t} \left(-x_{t,\,i} - \eta\right)^{+} \right\}\,, \\ \frac{1}{\alpha} \sum_{t=1}^{T} p_{t} \left(-x_{t,\,i} - \eta\right)^{+} &= \bar{c} - \eta\,, \\ \sum_{t=1}^{T} p_{t} \mathbb{1}\left\{-x_{t,\,i} > \eta\right\} &= \alpha\,. \end{align}\]

The second line is linear in $\boldsymbol{p}$, so one entropy pooling solve meets it at each candidate $\eta$. The third line holds only when that $\eta$ is the value at risk of the posterior of the solve. So the two lines have one common fixed point, and the posterior meets the view only at that point.

Where:

  • $\mathrm{CVaR}_{\alpha}(X)$: Conditional value at risk of the loss series $\boldsymbol{x}$ at level $\alpha$.
  • $\bar{c}$: Target conditional value at risk of the view.
  • $\boldsymbol{p}$: $T \times 1$ posterior probabilities of the observations, summing to one. They are the unknown of the entropy pooling problem.
  • $x_{t,\,i}$: Return of asset $i$ at observation $t$.
  • $\alpha$: Significance level (left tail probability), $\alpha \in (0, 1)$.
  • $T$: Number of observations.
  • $\eta$: Value at risk of asset $i$ at level $\alpha$. It is the minimiser of the first line, and the variable of the outer search.
  • $(\cdot)^{+}$: Positive part, $\max(\cdot,\, 0)$.

Algorithm

  1. Read the loss columns X, the targets B, the levels alphas, the search d_opt and the block edge from cvv.
  2. Delete the key :cvar_ineq from epc, and write edge under it when edge is not nothing. The key holds the rows of the views at the worst loss, the inequality of ep_cvar_views_setup. When no view needs a search, solve epc once with entropy_pooling, and return the result.
  3. Define func(etas). At the candidate etas, it writes the second line above into epc under the key :cvar_eq. It solves the whole constraint set with entropy_pooling into wi, and returns wi and the residual of the third line. For one view, the residual is the posterior tail mass minus alpha. For more than one view, it is the norm_error over the views of the posterior conditional value at risk minus the target.
  4. Search for the value at risk res. For one view, calculate the residual of func at z = max(0, lo). When it is positive, Roots.find_zero finds the root of the residual over [z, B[1] * (1 - sqrt(eps))]. Otherwise it finds the root over [lo, z]. The search reuses the residual at z, and solves no inner problem there again. For more than one view, Optim.optimize minimises the residual over the box [lo, B] from the start 0.5 * (max(lo, 0) + B), which is 0.5 * B when lo is at or below zero. After the start, a trial point at which the inner solve fails, or a trial point outside the box, gets the residual Inf, and the line search rejects that point.
  5. Call func(res) one more time, and return the posterior probability weights that it calculates.

Arguments

  • cvv: Search data from ep_cvar_views_setup.
  • epc: Dictionary of entropy pooling constraints, which maps each key to an (lhs, rhs) pair.
  • w: Prior probability weights that the stage projects.
  • opt: Optimiser of each inner entropy pooling solve.

Validation

  • Every candidate value at risk is in [lo, B]. A candidate outside the box raises a DomainError. With more than one view, the search rejects a trial point outside the box after the start, so that point does not raise.
  • The search must succeed. When Roots.find_zero or Optim.optimize raises an error, this method raises an ErrorException that holds it. An inner entropy_pooling solve that fails at one point of the search for one view is such an error. With more than one view, the search rejects a trial point after the start at which the inner solve fails, so that failure does not raise. A failed inner solve at the start of the box raises. When Optim.converged reports that Optim.optimize failed, this method raises an ErrorException. A failed inner solve at the last call, at the minimiser, raises its own error.
  • The method does not detect an infeasible view set. The residual of this search is the posterior tail mass minus alpha. A posterior with almost all of its mass on one observation has a small residual, but it can miss the view by a large amount. The warning of MeucciEntropyPoolingPrior states how to find such a result.
  • The method does not detect a missed feasible view. The search reads its own residual, not how closely the inner entropy_pooling solve meets the constraint of the view. With more than one view, Optim.converged accepts a solve that stopped on the step in x and not on stationarity. The warning of MeucciEntropyPoolingPrior states the mechanism, the measured sizes, and how to read the result.

Returns

  • pw::ScenarioProbabilities: Posterior probability weights that meet the CVaR views, in the kind of w.

Related

References

  • [159] A. Meucci, D. Ardia and S. Keel. Fully flexible extreme views. The Journal of Risk 14, 39–49 (2011). Section 3, Equations 3.1 to 3.6.
source
PortfolioOptimisers.ep_prior — Function
ep_prior(alg::StagedEP, pe::MeucciEntropyPoolingPrior, X::MatNum,
         F::Option{<:MatNum}, pnl::Option{<:AssetPanel} = nothing;
         strict::Bool = false, kwargs...)

Compute the entropy pooling prior moments of the asset returns, with the views applied in stages.

ep_prior calculates the mean and the covariance of the asset returns with entropy pooling, under the staged algorithms H1_EntropyPooling and H2_EntropyPooling. It takes views on the mean, the value at risk, the conditional value at risk, the variance, the covariance, the skewness, the kurtosis and the correlation. Each stage adds the views of one group of moments, solves, and refits the wrapped estimator under the new weights. A later stage holds the moments of the earlier stages fixed, so a view on a higher moment does not move a lower moment.

Each stage refits the wrapped estimator after its solve, and the next stage parses its views against that refit. So a prior(...) reference in a later stage resolves against the posterior of the stage before, not against the prior of the estimator. Under a mu_views or cvar_views view, a sigma_views target prior(A)*1.3 asks for 1.3 times the variance that stage one leaves, not 1.3 times the empirical variance. When the reference must be the empirical value, write the target as a number.

Mathematical definition

The staged posterior is a chain of Kullback-Leibler projections, not one projection. Stage $k$ holds the constraint set $\mathcal{C}_{k}$, which has the rows of stage $k$ and of every stage before it. It projects a reference $\boldsymbol{r}^{(k)}$ that the algorithm tag fixes:

\[\begin{align} \boldsymbol{p}^{(k)} &= \underset{\boldsymbol{p} \in \mathcal{C}_{k}}{\arg\min} \sum_{t=1}^{T} p_{t} \ln\!\frac{p_{t}}{r_{t}^{(k)}}\,, \\ \mathcal{C}_{k} &= \left\{ \boldsymbol{p} : \mathbf{A}_{k} \boldsymbol{p} = \boldsymbol{B}_{k},\; \boldsymbol{p} \geq \boldsymbol{0},\; \boldsymbol{1}^\intercal \boldsymbol{p} = 1 \right\}\,, \\ \mathcal{C}_{1} &\supseteq \mathcal{C}_{2} \supseteq \mathcal{C}_{3}\,, \\ \boldsymbol{r}^{(k)} &= \begin{cases} \boldsymbol{q} & \text{under } \texttt{H1\_EntropyPooling} \\ \boldsymbol{p}^{(k-1)} & \text{under } \texttt{H2\_EntropyPooling} \end{cases}\,, \\ \boldsymbol{p}^{*} &= \boldsymbol{p}^{(K)}\,. \end{align}\]

The first stage holds the mean and value at risk views. The second stage holds the variance and covariance views, and the third stage holds the correlation, skewness and kurtosis views. The sets nest, so the posterior of the last stage meets every view. The two references differ only in the start point of the chain. $\texttt{H1\_EntropyPooling}$ gives the projection of the prior onto the whole view set, and $\texttt{H2\_EntropyPooling}$ gives the projection of each stage onto the next. A conditional value at risk view is not a row of $\mathbf{A}_{k}$. It enters every stage as the fixed point of ep_cvar_views_solve!, whose section states it.

Where:

  • $\boldsymbol{p}$: $T \times 1$ posterior probabilities of the observations, summing to one. They are the unknown of the entropy pooling problem.
  • $\boldsymbol{q}$: $T \times 1$ prior probabilities of the observations, summing to one.
  • $T$: Number of observations.
  • $\boldsymbol{p}^{(k)}$: Posterior probabilities of stage $k$. $\boldsymbol{p}^{*}$ is the posterior of the last stage $K$.
  • $\boldsymbol{r}^{(k)}$: Reference probabilities that stage $k$ projects.
  • $\mathcal{C}_{k}$: Constraint set of stage $k$, which holds the rows of every stage up to stage $k$.
  • $\mathbf{A}_{k}$, $\boldsymbol{B}_{k}$: Rows and right-hand side of $\mathcal{C}_{k}$.

The posterior moments are the sample statistics under the weights $\boldsymbol{p}^{*}$.

Algorithm

  1. Fit the wrapped prior estimator with ep_wrapped_prior. The result is pr and the prior probabilities w0 on its rows. The fit sets the observation axis. T is size(pr.X, 1), which is smaller than size(X, 1) when a nested prior drops rows. The probabilities are pe.w when the caller gives one, pr.w when the fit returns one, and the uniform 1/T otherwise. prior_probability_factory puts the pe.w of the caller on the rows that each weighted field of the wrapped estimator reads, and the fit of pr uses it. Before that fit, scenario_count reads T with only the steps that drop rows, so most wrapped priors need no fit for it. When the fit under pe.w returns its own pr.w, a nested prior solved its views from pe.w. Then w0 is pr.w, the posterior of the nested prior.
  2. Pin each choice of pe.pe under a PinnedChoice at this fit with pin_prior_choice, so every refit reads the choice that the views read. Every refit goes through scenario_prior, which holds the model of this fit, with its regression and its residual block. So the refit reads the scenarios that the views read.
  3. Get the Investable Mask of the fit and the universe of the views with investable_views. Every view row uses only the investable columns, and the mask is the same at each stage.
  4. Make the empty constraint dictionary epc, the matrix fixed of the pinned moments, and the Departure Ledger. Resolve the cvar_views against that fit one time, through ep_cvar_views_setup into cvv. Every stage searches the same targets, so a prior(...) reference gives one number for the whole chain.
  5. Stage one, the mean and the value at risk. Write the mu_views and var_views rows into epc. When epc holds a row or cvv holds a search, solve from w0 through ep_cvar_views_solve! into w1, and refit pr under w1.
  6. Stage two, the variance and the covariance. Write the sigma_views and cov_views rows into epc. Pin the mean of every asset that those rows read with fix_mu!, so the stage cannot move a moment that an earlier stage set. Under the same test, solve into w1, and refit pr under w1.
  7. Stage three, the correlation, the skewness and the kurtosis. Write the sk_views, kt_views and rho_views rows into epc. Pin the mean and the variance of every asset that those rows read with fix_mu! and fix_sigma!. Under the same test, solve into w1, and refit pr under w1.
  8. Steps 6 and 7 solve from w0 under H1_EntropyPooling, and from the w1 of the stage before under H2_EntropyPooling.
  9. Report the departed assets and the views that they removed, with announce_ep_departures.
  10. Calculate the effective number of scenarios ens, the exponential of the entropy of w1. Calculate kld, the Kullback-Leibler divergence of w1 from w0.
  11. Return a LowOrderPrior that holds the moments of the last refit, w1, ens and kld. The factor block fpr comes from that refit with no change.

Arguments

  • alg: Staged entropy pooling algorithm, which prior reads from pe.alg.
  • pe: Entropy pooling prior estimator.
  • X: Asset returns matrix, with one observation in each row, as prior orients it.
  • F: Optional factor returns matrix, with one observation in each row, as prior orients it.
  • pnl: Optional AssetPanel, the panel that the returns data held. A wrapping prior forwards it unchanged, so that it can compose an estimator that is fitted on a panel. An estimator that reads no panel ignores it.
  • strict: If true, raise an error for an asset that the universe does not hold. If false, warn.
  • kwargs...: More keyword arguments, which go to the wrapped prior estimator.

Validation

  • If a view field is not nothing, pe.sets must not be nothing.
  • If the caller gives prior weights pe.w, length(pe.w) == size(pr.X, 1) must hold, where size(pr.X, 1) is the number of observations that the wrapped estimator returns. A different length raises a DimensionMismatch. The message names that number, the number of observations that the estimator got, and the rule.
  • Every view equation has a comparison operator that its family accepts. An unsupported operator raises a Meta.ParseError that names the operators of that family.

Returns

  • pr::LowOrderPrior: Prior result that holds the asset returns, the posterior mean and covariance, the posterior probability weights, the effective number of scenarios, the Kullback-Leibler divergence and the factor block of the last refit.

Related

source
PortfolioOptimisers.ep_prior — Function
ep_prior(alg::H0_EntropyPooling, pe::MeucciEntropyPoolingPrior, X::MatNum,
         F::Option{<:MatNum}, pnl::Option{<:AssetPanel} = nothing;
         strict::Bool = false, kwargs...)

Compute the entropy pooling prior moments of the asset returns, with every view applied in one solve.

ep_prior calculates the mean and the covariance of the asset returns with entropy pooling, under the H0_EntropyPooling algorithm. It applies every view in one optimisation. This route solves the entropy pooling problem one time. But a view on a higher moment can move a lower moment, because no stage holds the lower moments fixed.

Mathematical definition

The single-shot posterior is one Kullback-Leibler projection of the prior onto the intersection of the constraint sets of all the views. It is the staged chain of ep_prior with one stage:

\[\begin{align} \boldsymbol{p}^{*} &= \underset{\boldsymbol{p} \in \mathcal{C}}{\arg\min} \sum_{t=1}^{T} p_{t} \ln\!\frac{p_{t}}{q_{t}}\,, \\ \mathcal{C} &= \mathcal{C}_{1} \cap \mathcal{C}_{2} \cap \mathcal{C}_{3}\,. \end{align}\]

One reference and one feasible set hold every view, so no stage can pin a moment. A view on a higher moment can move a lower moment of the same asset. That is the only difference from the staged chain, whose sets $\mathcal{C}_{k}$ this set $\mathcal{C}$ intersects. A conditional value at risk view is not a row of $\mathcal{C}$. It enters as the fixed point of ep_cvar_views_solve!, whose section states it.

Where:

  • $\boldsymbol{p}$: $T \times 1$ posterior probabilities of the observations, summing to one. They are the unknown of the entropy pooling problem.
  • $\boldsymbol{q}$: $T \times 1$ prior probabilities of the observations, summing to one.
  • $T$: Number of observations.
  • $\boldsymbol{p}^{*}$: Posterior probabilities of the one solve.
  • $\mathcal{C}$, $\mathcal{C}_{k}$: Feasible set of the one solve, and the stage sets that it intersects.

The posterior moments are the sample statistics under the weights $\boldsymbol{p}^{*}$.

Algorithm

  1. Fit the wrapped prior estimator with ep_wrapped_prior. The result is pr and the prior probabilities w0 on its rows. The fit sets the observation axis. T is size(pr.X, 1), which is smaller than size(X, 1) when a nested prior drops rows. The probabilities are pe.w when the caller gives one, pr.w when the fit returns one, and the uniform 1/T otherwise. prior_probability_factory puts the pe.w of the caller on the rows that each weighted field of the wrapped estimator reads, and the fit of pr uses it. Before that fit, scenario_count reads T with only the steps that drop rows, so most wrapped priors need no fit for it. When the fit under pe.w returns its own pr.w, a nested prior solved its views from pe.w. Then w0 is pr.w, the posterior of the nested prior.
  2. Pin each choice of pe.pe under a PinnedChoice at this fit with pin_prior_choice, so every refit reads the choice that the views read. Every refit goes through scenario_prior, which holds the model of this fit, with its regression and its residual block. So the refit reads the scenarios that the views read.
  3. Get the Investable Mask of the fit and the universe of the views with investable_views. Every view row uses only the investable columns.
  4. Make the empty constraint dictionary epc and the Departure Ledger. Resolve the cvar_views against that fit one time, through ep_cvar_views_setup into cvv.
  5. Write the mu_views and var_views rows into epc.
  6. Write the sigma_views and cov_views rows into epc. This route pins no moment, so it does not call fix_mu! or fix_sigma!.
  7. Write the sk_views, kt_views and rho_views rows into epc.
  8. Report the departed assets and the views that they removed, with announce_ep_departures.
  9. When epc holds a row or cvv holds a search, solve the whole set one time through ep_cvar_views_solve! into w1, and refit pr under w1. Under strict = false, every row of every family can drop, and the view set then states no view. Then w1 is w0, kld is zero, and no refit runs.
  10. Calculate the effective number of scenarios ens, the exponential of the entropy of w1. Calculate kld, the Kullback-Leibler divergence of w1 from w0.
  11. Return a LowOrderPrior that holds the moments of the refit, w1, ens and kld. The factor block fpr comes from that refit with no change.

Arguments

  • alg: Single-shot entropy pooling algorithm, which prior reads from pe.alg.
  • pe: Entropy pooling prior estimator.
  • X: Asset returns matrix, with one observation in each row, as prior orients it.
  • F: Optional factor returns matrix, with one observation in each row, as prior orients it.
  • pnl: Optional AssetPanel, the panel that the returns data held. A wrapping prior forwards it unchanged, so that it can compose an estimator that is fitted on a panel. An estimator that reads no panel ignores it.
  • strict: If true, raise an error for an asset that the universe does not hold. If false, warn.
  • kwargs...: More keyword arguments, which go to the wrapped prior estimator.

Validation

  • If a view field is not nothing, pe.sets must not be nothing.
  • If the caller gives prior weights pe.w, length(pe.w) == size(pr.X, 1) must hold, where size(pr.X, 1) is the number of observations that the wrapped estimator returns. A different length raises a DimensionMismatch. The message names that number, the number of observations that the estimator got, and the rule.
  • Every view equation has a comparison operator that its family accepts. An unsupported operator raises a Meta.ParseError that names the operators of that family.

Returns

  • pr::LowOrderPrior: Prior result that holds the asset returns, the posterior mean and covariance, the posterior probability weights, the effective number of scenarios, the Kullback-Leibler divergence and the factor block of the refit.

Related

source
PortfolioOptimisers.show_fields — Method
show_fields(
    _::MeucciEntropyPoolingPrior
) -> NTuple{17, Symbol}

Give every field of a MeucciEntropyPoolingPrior to print, except cache.

The state in cache changes at each step of an incremental fit, and it is not part of the configuration. Each site that prints the estimator also prints this state, unless this method leaves it out. Set set_show_nothing_fields!(:MeucciEntropyPoolingPrior, true) to print it.

Arguments

  • ::MeucciEntropyPoolingPrior: Prior estimator, read for its type alone.

Returns

  • fields::Tuple: The field names to render, which is (:pe, :mu_views, :var_views, :cvar_views, :sigma_views, :sk_views, :kt_views, :cov_views, :rho_views, :sets, :ds_opt, :dm_opt, :opt, :diagnose, :w, :alg, :x_src).

Related

source

References

[159]
A. Meucci, D. Ardia and S. Keel. Fully flexible extreme views. The Journal of Risk 14, 39–49 (2011).