Cross-Sectional Prior Fold (a)
A CrossSectionalFactorPrior that Online does not wrap updates with each new block of observations. Its first partial_fit! creates a PortfolioOptimisers.CrossSectionalCarryState. The state merges with another state and takes a view on its assets as the methods below state.
PortfolioOptimisers.merge_states — Method
merge_states(
_::CrossSectionalCarryState,
_::CrossSectionalCarryState
)
Refuses to merge two CrossSectionalCarryState fitted on disjoint blocks.
The state is not a sufficient statistic of its own block. The first regression of the second block reads the exposures of the last rows of the first block, the Descriptors of its first rows read the panel rows of the first block, and the idiosyncratic variance and the factor prior fold in the order of the observations. So the two blocks fold in sequence.
Arguments
a: The state of the first block.b: The state of the second block.
Validation
- Always throws an
ArgumentError.
Related
PortfolioOptimisers.port_opt_view — Method
port_opt_view(_::CrossSectionalCarryState, i, args...)
Refuses a view of a CrossSectionalCarryState on a subset of the assets.
The regression of each observation reads every asset of its cross-section, so the factor returns of a sub-universe are not a slice of the factor returns that the state carries.
Arguments
x: The state.i: The selected assets.args...: Not read.
Validation
- Always throws an
ArgumentError.
Related
The carry folds its factor prior one row at a time when PortfolioOptimisers.carry_folds answers true for it. A user prior implements that verb to fold on the carry and to pass FoldOnly.
PortfolioOptimisers.carry_folds — Function
carry_folds(pe)
carry_folds(pe::EmpiricalPrior)Answers whether the carry fold of a CrossSectionalFactorPrior folds the factor prior pe one row at a time, at a cost that does not grow with the stream.
This is the verb of a factor prior that folds, and it is public. A prior that answers true keeps the contract of EmpiricalPrior on its carry route. partial_fit! folds the factor returns of the new observations, observations × factors, into a state that the prior holds, and the first call starts from a prior with no state. A step costs the same however many rows the prior folded before. prior(pe; strict) with no data then reads the LowOrderPrior of every folded row, equal to the batch call over them. The carry fold folds such a prior with cross_sectional_fold_factors, and reads it with cross_sectional_factor_prior. It fits any other prior again over every carried factor return at each call with no data, and carry_growing_parts lists that prior.
The verb is not supports_partial_fit. That verb answers false for an EmpiricalPrior, because the prior keeps its rows, and an outer estimator that holds the rows already refits it from them. The carry fold gives the factor prior its rows and reads its state, so it folds the prior.
An EmpiricalPrior on its carry route answers true when me and ce both answer supports_partial_fit. Its fold refits a member that does not fold over every carried row, as fold_member states. Every other prior answers false, an EmpiricalPrior that holds a SampleBufferState included.
Arguments
pe: The factor prior.
Returns
folds::Bool:truewhen the carry fold folds the factor prior.
Related