Cross-Sectional Factor Prior (b): private API
Functions
PortfolioOptimisers.cross_sectional_live_dropped — Function
cross_sectional_live_dropped(dc::Nothing, lv::AbstractVector{Bool}) -> Nothing
cross_sectional_live_dropped(dc::AbstractMatrix{Bool}, lv::AbstractVector{Bool})
-> BitMatrixExpand the dropped-column mask of a regression on the factors that are not empty onto every factor.
An Empty Factor takes a return of zero because no pair loads on it, not because the solve dropped its column, so its column of the mask is false.
Arguments
dc: The dropped-column mask of the regression on the factors thatlvmarks, ornothing.lv:trueat each factor that is not empty.
Returns
dc::Option{<:BitMatrix}: The mask on every factor, ornothing.
Related
PortfolioOptimisers.cross_sectional_live_factors — Function
cross_sectional_live_factors(
Z::AbstractArray{<:Union{Number, AbstractJuMPScalar}, 3},
X::AbstractMatrix{<:Union{Number, AbstractJuMPScalar}},
W::AbstractMatrix{<:Union{Number, AbstractJuMPScalar}}
) -> BitVector
Mark each factor that is not an Empty Factor over the observations of a design.
A factor is empty when its exposure is zero at every (observation, asset) pair of positive weight. cross_sectional_live_regression reads the mark over every observation of its design. The carry fold of a CrossSectionalFactorPrior reads it over its new observations, and joins it to the mark of the observations it fitted.
Algorithm
- Take the pairs of positive weight with
cross_sectional_design_mask, givingact. - Mark each factor whose exposure is not zero at a pair of
act.
Arguments
Z: Exposure tensorassets × factors × observations.X: Asset returns matrixobservations × assets.W: Cross-sectional weights matrixobservations × assets.
Validation
- The rules of
cross_sectional_design_mask.
Returns
lv::BitVector:trueat each factor that is not empty.
Related
PortfolioOptimisers.cross_sectional_cold_factors — Function
cross_sectional_cold_factors(Ms::Arr3Num, nf::VecStr, Zo::Option{<:Arr3Num}) -> StringReturns the sentence that names the factors whose exposure history holds no finite value, or an empty string where every factor holds one, so the refusal of cross_sectional_warmup can name the factor that consumed the whole history. The factors of Zo follow those of Ms.
The sentence gives the name of the factor, as "momentum" or "industry=Energy", not the position of its column. A one-hot family takes one column per level, so a position does not match the order of the factors that the user wrote.
Arguments
Ms: The exposure history,assets × factors × observations.nf: The name of each factor, the columns ofMsand then the columns ofZo.cross_sectional_warmupchecks its length.Zo: The exposure history of the observed factors, on the axes ofMs, ornothing.
Returns
msg::String: The sentence, with a leading space, or"".
Related
PortfolioOptimisers.cross_sectional_lookback — Function
cross_sectional_lookback(
pe::CrossSectionalFactorPrior,
L::Union{Nothing, Integer},
f::Function
) -> Union{Nothing, var"#s458"} where var"#s458"<:Integer
Returns the look-back of a CrossSectionalFactorPrior from the look-back of its factors: that look-back plus lag, or the look-back of its Return Forecast Estimator when that one is larger. nothing from either part gives nothing.
lookback gives it the look-back of the factors of the batch fit and itself as f. carry_lookback gives it the look-back of the factors on the carry fold and itself as f, so a Descriptor of the scores of the forecast that carries a state counts one row.
Arguments
pe: Cross-Sectional Factor Prior estimator.L: The look-back of its factors, ornothing.f: The verb that counts the look-back of the Return Forecast Estimator,lookbackorcarry_lookback.
Returns
n::Option{<:Integer}: The look-back of the prior, ornothing.
Related