Factor Model Summary
Types
PortfolioOptimisers.FactorSummaryResult — Type
struct FactorSummaryResult{__T_ann_return, __T_ann_volatility, __T_sharpe, __T_autocorr, __T_mean_abs_t, __T_t_rate, __T_mean_vif, __T_stability, __T_coverage, __T_ppy, __T_nf, __T_fam} <: AbstractResultThe headline statistics of every factor of a cross-sectional factor model.
factor_model_summary returns a FactorSummaryResult. It holds the nine columns that plot_factor_model_summary draws, one entry per raw factor, the annualisation factor of the first three, and the names and the family labels of the raw factors. A caller can tabulate a summary, compare it across fits, test it, or read it with no plotting package installed. port_opt_view selects the factors of a summary by position, by name, or by family with a LabelGroup.
The five columns that can be absent
mean_abs_t, t_rate and mean_vif read the regression design, and stability and coverage read the exposure history. A block with no exposure history has none of them, and all five are nothing. A consumer handles that case by dispatch on nothing.
The raw factor axis
The summary computes the three Gram columns on the reduced factor axis of the family re-basis, and writes them back onto the raw axis by name. A raw factor that the re-basis dropped has NaN in those three columns and a value in the others.
Fields
ann_return: Annualised mean of the factor return series, one entry per raw factor.
ann_volatility: Annualised volatility of the factor return series, one entry per raw factor.
sharpe: Ratio of the annualised mean to the annualised volatility, one entry per raw factor.
autocorr: Lag-one autocorrelation of the factor return series, one entry per raw factor.
mean_abs_t: Mean absolute cross-sectional t-statistic, one entry per raw factor, ornothingwhen the block has no exposure history.
t_rate: Fraction of the observations at which the absolute t-statistic passes the threshold, one entry per raw factor, ornothingwhen the block has no exposure history.
mean_vif: Mean variance inflation factor, one entry per raw factor, ornothingwhen the block has no exposure history.
stability: Median exposure stability coefficient, one entry per raw factor, ornothingwhen the block has no exposure history.
coverage: Average fraction of the universe at which the factor exposure is finite, one entry per raw factor, ornothingwhen the block has no exposure history.
ppy: Periods per year, the annualisation factor. 252 for daily, 52 for weekly, 12 for monthly returns, and 1 states each figure per period. It defaults to1, which reports the statistics per period.
nf: Name of each factor on the factor axis of the answer, ornothingwhen the block names no factor. The axis is the one that the verb answers on, raw or reduced.
fam: Family label of each factor on the factor axis of the answer, ornothingwhen the block labels no family. A view selects the factors of one family with aLabelGroup.
Constructors
FactorSummaryResult(ann_return::VecNum, ann_volatility::VecNum, sharpe::VecNum, autocorr::VecNum, mean_abs_t::Option{<:VecNum}, t_rate::Option{<:VecNum}, mean_vif::Option{<:VecNum}, stability::Option{<:VecNum}, coverage::Option{<:VecNum}, ppy::Number, nf::Option{<:VecStr}, fam::Option{<:VecStr})FactorSummaryResult(; ann_return::VecNum, ann_volatility::VecNum, sharpe::VecNum, autocorr::VecNum, mean_abs_t::Option{<:VecNum} = nothing, t_rate::Option{<:VecNum} = nothing, mean_vif::Option{<:VecNum} = nothing, stability::Option{<:VecNum} = nothing, coverage::Option{<:VecNum} = nothing, ppy::Number = 1, nf::Option{<:VecStr} = nothing, fam::Option{<:VecStr} = nothing)The type is a Result, so factor_model_summary builds it and a caller reads it. The positional constructor checks the values. The keyword constructor takes each field by name and calls it. Its defaults are nothing for the five columns that can be absent and for the two labels, and 1 for ppy.
Validation
- Each column that is not
nothing, and each label that is notnothing, holds one entry per factor, as many asann_return. Otherwise, the constructor raises aDimensionMismatch. ppy > 0. Otherwise, the constructor raises aDomainError.- No entry of
ann_volatilityor ofmean_abs_tis negative. ANaNpasses. Otherwise, the constructor raises aDomainError. - Each entry of
t_rateand ofcoverageisNaNor in $[0, 1]$. Otherwise, the constructor raises aDomainError.
Related
Functions
PortfolioOptimisers.factor_model_summary — Function
factor_model_summary(csfm::CrossSectionalFactorModel; ppy::Number = 1,
threshold::Number = 2, step::Integer = 21,
weighting = BenchmarkWeightMetric(),
coverage_weighting = RegressionWeightMetric()) -> FactorSummaryResultSummarise every factor of a cross-sectional factor model as a FactorSummaryResult.
For each column, the summary calls one function of the regression group or of the exposure group, and it aggregates the series that function returns over the observations. The only statistics it computes itself are the factor return statistics and two aggregates: the median of the stability, and the patch that reads a constant exposure as perfectly stable.
The answer is on the raw factor axis. The regression group answers on the reduced axis of the family re-basis, and the summary joins the two by name.
Algorithm
- Read the factor return history with
factor_summary_returns, and refuse a block that has none. It is on the raw axis when the block carriesfr, and on the reduced axis otherwise. - Take the annualised mean, the annualised volatility and the Sharpe ratio of each series with
factor_summary_return_stats. An absent return takes no part. - Take the lag-one autocorrelation of each series with
factor_summary_autocorrelation. - Write the four statistics onto the raw axis with
factor_summary_mapped, at the positions step 1 gives. A factor a family re-basis dropped has a series infr, which the constraint of its family fixes. A block with a re-basis and nofrhas no series for it, and givesNaN. - Take the mean absolute t-statistic, the exceedance rate and the mean variance inflation factor with
factor_summary_gram, on the raw factor axis. A block with no exposure history givesnothingfor all three. An observed factor was not estimated, so it takesNaNin the three. - Take the median stability and the coverage with
factor_summary_exposure. A block with no exposure history givesnothingfor both. - Collect the nine columns,
ppy, and the names and the family labels of the raw axis into aFactorSummaryResult.
Arguments
csfm: A cross-sectional factor model block. A caller who holds a Prior Result writespr.rr.ppy: Periods per year.252annualises a daily fit, and the default of1reports the statistics per period.threshold: Absolute t-statistic that the exceedance rate counts against.step: Number of observations between the two cross-sections that the stability reads.weighting: TheAbstractOrthogonalityMetricwhose weight history the stability reads.coverage_weighting: TheAbstractOrthogonalityMetricwhose positive weights are the universe of the coverage. Its default ofRegressionWeightMetricis the estimation universe of the fit, and every asset when the block carries no regression weights.exposure_coveragereads the same default.
Validation
ppy > 0, else the function raises aDomainError.csfm.csris notnothing, else the function raises anIsNothingError.csfm.nfis notnothingwhencsfm.fcbis present, else the function raises anIsNothingError.
Returns
fs::FactorSummaryResult: The computed summary.
Related
PortfolioOptimisers.port_opt_view — Method
port_opt_view(fs::FactorSummaryResult, i, args...)Return a view of a FactorSummaryResult that keeps only the factors that i selects.
Algorithm
- Cut every column,
nfandfamto the selected factors withfactor_table_fields. An absent column staysnothing, andppystays as it is. - Build a new
FactorSummaryResultfrom the views.
Arguments
fs: A factor model summary.i: The factor index: positions, a range, aColon, a vector of names, or aLabelGroup.args...: Additional positional arguments (ignored).
Validation
- The rules of
factor_axis_positions.
Returns
fs::FactorSummaryResult: The summary of the selected factors.
Related