Prior Scenarios
A prior result carries its scenarios in X. A prior that reweights observations, such as an entropy pooling prior, states its prior probabilities on the scenarios of the prior that it wraps. keeps_observations tells it when the wrapped prior answers one scenario for each observation, so that it reads the count of the scenarios with no fit. A new prior implements a method of it when no configuration and no data makes its result drop a row. The other names of this topic are private, and the private page documents them.
PortfolioOptimisers.keeps_observations — Method
keeps_observations(pe::AbstractPriorEstimator) -> false
keeps_observations(pe::EmpiricalPrior) -> Bool
keeps_observations(pe::Union{<:FactorPrior, <:FactorBlackLittermanPrior,
<:BlackLittermanPrior, <:BayesianBlackLittermanPrior,
<:EntropyPoolingPrior, <:MeucciEntropyPoolingPrior,
<:HighOrderPriorEstimator,
<:HighOrderFactorPriorEstimator}) -> Bool
keeps_observations(pe::AugmentedBlackLittermanPrior) -> Bool
keeps_observations(pe::OpinionPoolingPrior) -> Bool
keeps_observations(pe::Online{<:AbstractPriorEstimator}) -> falseReturn true when the result of a prior estimator carries one scenario for each observation that it receives.
A prior that reweights observations, such as EntropyPoolingPrior, states its prior probabilities on the scenarios of the prior that it wraps. A wrapped prior can carry fewer scenarios than it receives, so the reweighting prior reads the count with scenario_count before it fits the wrapped prior under the probabilities. A wrapped prior that keeps the observations carries the count that it receives, so the count needs no fit.
The fallback returns false, which makes no promise, and scenario_count then fits a prior that has no method of its own to read the count. A wrong true makes the reweighting prior check the probabilities against the wrong count. So a prior returns true only when no configuration and no data makes its result carry fewer scenarios than the observations that it receives. A CrossSectionalFactorPrior keeps the fallback, because it drops the observations that its Descriptors warm up over and the observations that its exposure lag uses. The answer reads the configuration alone. A Scenario Cap at or above the number of observations drops no row, but its prior still returns false.
Algorithm
The method that Julia selects is the algorithm.
- Any other prior: return
false. - An
EmpiricalPrior: returntruewhen it has no Scenario Cap, that is whenpe.max_scenariosisnothing. - A prior whose result carries the scenarios of the prior in its
pefield: apply this function tope.pe. A factor prior cuts its asset rows to the rows of its factor prior, and the other priors forward the rows of their wrapped prior. - An
AugmentedBlackLittermanPrior: returntruewhen this function returnstruefor bothpe.a_peandpe.f_pe, because the result keeps the rows that both nested priors keep. - An
OpinionPoolingPrior: returntruewhenpe.pe1isnothing, or when this function returnstrueforpe.pe1. The pool works on the rows ofpe.pe1, and it refuses an opinion or ape.pe2that answers on fewer rows. - An
Onlinewrapper of a prior: returnfalse. A batch fit does not fit the wrapper, and the online flow replaces it with the prior that it wraps before the fit, so the wrapper makes no promise.
Arguments
pe: Prior estimator.
Returns
flag::Bool:truewhen the result carries one scenario for each observation, in order, andfalsewhen the prior makes no such promise.
Examples
julia> PortfolioOptimisers.keeps_observations(EmpiricalPrior())truejulia> PortfolioOptimisers.keeps_observations(EmpiricalPrior(; max_scenarios = 50))falsejulia> PortfolioOptimisers.keeps_observations(EntropyPoolingPrior(; pe = FactorPrior()))trueRelated