Class PnlAttribution
java.lang.Object
com.quantfinlib.risk.PnlAttribution
FRTB P&L attribution test (PLAT) — the exam a risk MODEL must pass
to keep internal-model approval: does the risk engine's theoretical
P&L (RTPL — what the model's factors and pricers say the desk made)
actually track the desk's hypothetical P&L (HPL — what revaluing
the real book on real prices says)? Two statistics, per MAR32:
- Spearman correlation between daily HPL and RTPL — do they RANK days the same way;
- Kolmogorov-Smirnov statistic between their empirical distributions — do they have the same SHAPE.
FrtbEs). Research lane.-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final recordThe PLAT verdict for one desk over one window.static enum -
Method Summary
Modifier and TypeMethodDescriptionstatic doubleksStatistic(double[] a, double[] b) The two-sample KS statistic: max gap between the empirical CDFs, evaluated after BOTH samples have consumed each distinct value — ties must not register a transient gap (identical series score exactly 0).static PnlAttribution.Resulttest(double[] hypotheticalPnl, double[] riskTheoreticalPnl) Runs the PLAT over aligned daily P&L series (250 days is the regulatory window; anything ≥ 20 computes).
-
Method Details
-
test
Runs the PLAT over aligned daily P&L series (250 days is the regulatory window; anything ≥ 20 computes).- Parameters:
hypotheticalPnl- HPL — actual book, actual pricesriskTheoreticalPnl- RTPL — the risk model's factors + pricers
-
ksStatistic
public static double ksStatistic(double[] a, double[] b) The two-sample KS statistic: max gap between the empirical CDFs, evaluated after BOTH samples have consumed each distinct value — ties must not register a transient gap (identical series score exactly 0).
-