.. _linking: .. _bf_linking: Multi-period linking ==================== Each date's effects add up to that date's return difference :math:`r_t - b_t`: portfolio minus benchmark for Brinson-Fachler and the active factor model, and the portfolio return itself for the factor model (its benchmark is zero, :math:`b_t = 0`). Summed over time they do not add up to the compounded difference :math:`R_T - B_T`, with :math:`R_T = \prod_{t \le T}(1 + r_t) - 1` and :math:`B_T = \prod_{t \le T}(1 + b_t) - 1`: value added early compounds in later periods. For example, with portfolio returns of 5% and -3% and benchmark returns of 2% and 1%, the per-period active returns sum to -1.00%, but the compounded active return is :math:`1.85\% - 3.02\% = -1.17\%`. Methods ------- ``linking_method`` (see :ref:`configuration`) chooses how the cumulative effects are rescaled: * ``carino`` (default): Carino (1999). Each date's effect :math:`e_t` is scaled by :math:`k(r_t, b_t) / k(R_T, B_T)`, with .. math:: k(x, y) = \frac{\ln(1 + x) - \ln(1 + y)}{x - y}, \qquad k(x, x) = \frac{1}{1 + x}, \qquad \text{linked}(T) = \sum_{t \le T} e_t \, \frac{k(r_t, b_t)}{k(R_T, B_T)} There is no residual and the result does not depend on the order of the effects. * ``grap``: GRAP (1997), :math:`\text{linked}(T) = \prod_{t \le T}(1 + b_t) \sum_{t \le T} e_t \prod_{i < t}(1 + r_i) \big/ \prod_{i \le t}(1 + b_i)`. * ``none``: plain running sums (no linking, the behaviour of 0.3.x and earlier). In the example above, take an allocation effect of 1% and -3% and a selection effect of 2% and -1% (no interaction), so each date's effects add up to its active return of 3% and -4%. The cumulative effects at the second date are: .. list-table:: :header-rows: 1 :widths: 25 25 25 25 * - Method - Allocation - Selection - Sum * - ``carino`` - -2.11% - 0.94% - -1.17% * - ``grap`` - -2.14% - 0.97% - -1.17% * - ``none`` - -2.00% - 1.00% - -1.00% Only the cumulative outputs change: the per-date effects are the same under every method. What each method links ---------------------- .. list-table:: :header-rows: 1 :widths: 34 30 36 * - Output - :math:`r_t` and :math:`b_t` - Linked effects add up to * - Brinson-Fachler (textbook) cumulative indexes - portfolio and holdings benchmark return - the cumulative alpha, which is :math:`R_T - B_T` up to the per-date reconciliation residuals * - Factor model cumulative contributions, totals and shares - portfolio return and :math:`0` - :math:`R_T`, the compounded portfolio return (factors, components and the residual) * - Active factor attribution (``FactorModelResult.active``) - portfolio and holdings benchmark return - :math:`R_T - B_T` **Brinson-Fachler.** With ``carino`` or ``grap`` the cumulative portfolio and benchmark returns are compounded, and at every date the cumulative allocation + selection + interaction equal the cumulative alpha. That alpha equals the compounded :math:`R_p - R_b` up to the per-period reconciliation residuals (at most :math:`10^{-10} + 2 \cdot 10^{-6}\,|R_b|` per date). The legacy formula is never linked: it keeps the plain sums so it keeps reproducing 0.3.x, and when ``linking_method`` is not ``none`` the run logs an INFO note that ``linking_method`` is ignored for it. **Factor model.** With :math:`b = 0` the Carino coefficient is :math:`k(x, 0) = \ln(1 + x) / x`. With ``carino`` or ``grap`` the cumulative contributions cover only the dates that have a portfolio return, so the first price date is excluded; a warning, logged once per model, counts the dropped dates (see :ref:`factor_model`). Numerical notes --------------- The Carino coefficient is evaluated in a numerically stable form (no special-case threshold near :math:`r = b`, and accurate as a return approaches -100%). Every method, including ``linking_method = none`` and the legacy formula, raises ``PerformanceAttributionError`` on a non-finite per-period value or a return of -100% or below (0.3.x carried NaN or infinity into the charts), and the compounding methods also raise if cumulative growth overflows or underflows. Menchero linking and geometric attribution are not offered.