r2_oos – Out-of-sample R² (Campbell-Thompson 2008) – 1 - SSE_model / SSE_benchmark.#
Back to relative_metrics axis | Back to L5 | Browse all options
Operational op under axis
relative_metrics, sub-layerL5_A_metric_specification, layerl5. Standalone callable:mf.functions.r2_oos.
Function signature#
mf.functions.r2_oos(
y_true: np.ndarray | pd.Series,
y_model: np.ndarray | pd.Series,
y_benchmark: np.ndarray | pd.Series,
) -> float
Parameters#
name |
type |
default |
constraint |
description |
|---|---|---|---|---|
|
`np.ndarray |
pd.Series` |
— |
— |
|
`np.ndarray |
pd.Series` |
— |
— |
|
`np.ndarray |
pd.Series` |
— |
— |
Returns#
float — scalar result.
Behavior#
Relative-loss metric r2_oos. Standard return-predictability metric in finance (and increasingly in macro). Identical formula to mse_reduction when the benchmark is the historical mean. Campbell & Thompson (2008) popularised the metric for the empirical-asset-pricing literature.
When to use
Macro / financial forecasting tradition; literature-compatibility with CT-2008-era papers.
In recipe context#
Set params.relative_metrics = "r2_oos" in the relevant layer to activate this op within a recipe:
# Layer L5 recipe fragment
params:
relative_metrics: r2_oos
References#
macroforecast design Part 3, L5: ‘evaluation = (metric × benchmark × aggregation × decomposition × ranking).’
Campbell & Thompson (2008) ‘Predicting Excess Stock Returns Out of Sample: Can Anything Beat the Historical Average?’, Review of Financial Studies 21(4): 1509-1531. (doi:10.1093/rfs/hhm055)