Cross-Sectional Prior Fold (b)
Each update of a CrossSectionalFactorPrior after its first partial_fit! computes the exposures, the regression and the idiosyncratic variance of the new observations alone, from the last panel rows that its descriptors read. Then prior(pe) builds the result with the code of the batch fit.
PortfolioOptimisers.prior — Method
prior(
pe::CrossSectionalFactorPrior,
st::CrossSectionalCarryState;
strict,
cache_reg,
kwargs...
) -> LowOrderPrior
Reads a Cross-Sectional Factor Prior out of its carry fold, with no data.
The call with no data builds the Prior Result with cross_sectional_assemble, the code of the batch fit, from the histories that the state carries and the factor prior that it folded. The idiosyncratic correlation reads the ce that the state folded, or refits there from the carried rows when ce does not fold. The Return Forecast refits there too, unless the state carries its rows, as folds_forecast_rows answers. Then the call reads its Result off those rows with return_forecast_result. The standardised idiosyncratic returns are the rows that the state carries, so the call does not standardise the history again.
Algorithm
- Refuse a state that has not made its first fit.
- Append the observed factors of the fitted observations to the fitted factors with
cross_sectional_carry_append. - Read the factor prior with
cross_sectional_factor_priorover the factor returns of the factors that are not empty and the observed returns, and process and expand its moments withcross_sectional_factor_moments. An Observed Factor is never empty. - Count the residuals of each asset with
variance_counton the foldedve. - Take the returns data of the Return Forecast with
cross_sectional_carry_forecast_returns. - Build the result with
cross_sectional_assemble, with the Return Forecast history and the standardised idiosyncratic returns that the state carries. The block records the position of each fitted row among the kept observations, and no timestamp, because the buffer keeps none. - Record the Shared Series cut of the buffer with
shared_series_record, which writes the marks of the dropped observations and maps each position to its observation among the folded observations.
Arguments
pe: Cross-Sectional Factor Prior estimator.st: The state of its carry fold.strict: Whether to throw an error ifsetsdoes not contain the desired value insets.dict[key]. It is forwarded to the factor prior.cache_reg: Iftrue, a prior stores on its result the cache that its refit under new scenario weights reads: aCrossSectionalFactorPriorthe active mask and the Return Forecast history on its block, and anOpinionPoolingPriorthe rows ofpe1, its pooled weights and the cache ofpe2inpc. The refit of an entropy pooling prior around it then runs no regression and no opinion. Every other prior forwards it to the prior that it wraps. Default isfalse. It is forwarded tocross_sectional_assemble.kwargs...: Additional keyword arguments passed to the matrix processing and the lift.
Validation
stholds a fit:lag + 2observations follow the Descriptor warm-up. AnArgumentErroris thrown otherwise.- The rules of
cross_sectional_assemble.
Returns
pr::LowOrderPrior: The prior that the folded observations state.
Related