skfolio.attribution.Component#

class skfolio.attribution.Component(vol_contrib, pct_total_variance, mu_contrib, vol, corr_with_ptf, mu_uncertainty=None)[source]#

Portfolio attribution component.

Represents one component of the portfolio attribution: systematic, idiosyncratic, unattributed, or total. Each component stores volatility and return contributions, the percentage of total portfolio variance, standalone volatility, correlation with the portfolio and optional return uncertainty.

For single-point attribution, fields are floats. For rolling attribution (from rolling_realized_factor_attribution), fields are 1D arrays of shape (n_windows,).

Attributes:
vol_contribfloat or ndarray of shape (n_windows,)

Volatility contribution to total portfolio volatility.

pct_total_variancefloat or ndarray of shape (n_windows,)

Percentage of total portfolio variance.

mu_contribfloat or ndarray of shape (n_windows,)

Return contribution to total portfolio return (expected return for predicted attribution and mean return for realized attribution).

volfloat or ndarray of shape (n_windows,)

Standalone component volatility.

corr_with_ptffloat or ndarray of shape (n_windows,)

Correlation with portfolio returns.

mu_uncertaintyfloat or ndarray of shape (n_windows,) or None

Standard error of the mean return attribution, reflecting estimation uncertainty in the cross-sectional factor return regression. The systematic and idiosyncratic values are equal because their estimation errors sum to zero (the total portfolio return is observed). None when uncertainty is not computed.

property mu#

Standalone component return (expected return for predicted attribution and mean return for realized attribution).

Components do not store a separate standalone return statistic. Unlike vol, the component-level return is already its contribution to total portfolio return, so mu is equal to mu_contrib.