bayesline.api.equity.AsyncFactorStatsReportAccessorImpl#
- class bayesline.api.equity.AsyncFactorStatsReportAccessorImpl(accessor: AsyncReportAccessorApi)#
- __init__(accessor: AsyncReportAccessorApi)#
Methods
__init__(accessor)Get the dates covered in the factor stats report.
Get the time-series of factor returns for the factors.
Get the factor groups and their factor covered in this factor stats report.
Get the time-series of p-values for the factors.
Get the time-series of t-statistics for the factors.
get_vif()Get the time-series of variance inflation factors (VIF) for the factors.
with_scenario(scenario_settings)Return a new accessor with the given scenario settings applied.
Attributes
The underlying report accessor API.
scenario_types- __init__(accessor: AsyncReportAccessorApi)#
- property accessor: AsyncReportAccessorApi#
The underlying report accessor API.
Returns#
- AsyncReportAccessorApi
The underlying report accessor API.
- async get_dates() list[date]#
Get the dates covered in the factor stats report.
Returns#
- list[dt.date]
The dates covered in the factor stats report.
- async get_factors() dict[str, list[str]]#
Get the factor groups and their factor covered in this factor stats report.
Returns#
- dict[str, list[str]]
Dict where the keys are the factor groups, and the values are the factors in that group.
- async get_factor_returns() DataFrame#
Get the time-series of factor returns for the factors.
Returns#
- pl.DataFrame
A dataframe with a date column and columns for each factor with their respective factor returns, in factor_group^factor format.
- async get_t_stats() DataFrame#
Get the time-series of t-statistics for the factors.
Returns#
- pl.DataFrame
A dataframe with a date column and columns for each factor with their respective t-statistics, in factor_group^factor format.
- async get_p_values() DataFrame#
Get the time-series of p-values for the factors.
Returns#
- pl.DataFrame
A dataframe with a date column and columns for each factor with their respective p-values, in factor_group^factor format.
- async get_vif() DataFrame#
Get the time-series of variance inflation factors (VIF) for the factors.
The VIF measures multicollinearity — how much the variance of a regression coefficient is inflated due to correlation with other factors. For factor j, VIF is defined as:
\[\begin{split}\\text{VIF}_j = \\frac{1}{1 - R_j^2}\end{split}\]where \(R_j^2\) is the R-squared from regressing factor j on all other factors. Equivalently, \(\\text{VIF}_j = (X^\\top W X)_{jj} \\cdot (X^\\top W X)^{-1}_{jj}\).
A VIF of 1 means no multicollinearity; values above 5–10 suggest that the factor’s coefficient estimate is unreliable due to near-linear dependence on other factors.
When the model includes linear constraints (e.g., a sum-to-zero constraint on industry factor returns), the unconstrained Gram matrix \(X^\\top W X\) is typically singular or near-singular along the constrained directions — for instance, the market intercept column is a linear combination of the industry dummy columns. In this case VIF is computed in the null space of the constraint matrix, measuring multicollinearity only among the degrees of freedom that the model is actually estimating. Factors whose collinearity is resolved by the constraint will show moderate VIF rather than artificially extreme values.
Returns#
- pl.DataFrame
A dataframe with a date column and columns for each factor with their respective VIF values, in factor_group^factor format.