StaFIR: Convex Learning of Stationarity-Aware Causal Filters
Organizations: Drakai Capital Paris
Abstract
Reducing nonstationarity in a persistent time series entails deciding how much of its temporal dependence to remove. In finance, fractional differencing is often tuned using the Augmented Dickey--Fuller (ADF) test, limiting the search to a one-parameter family of lag profiles and addressing input preservation only indirectly. We propose StaFIR, a causal finite-impulse-response filter with a learned nonnegative mixture of exponential lag profiles. Its convex learning objective balances empirical stationarity with similarity to the input. We evaluate StaFIR on ARFIMA--GARCH controlled settings and rolling financial series, including a realized-volatility forecasting task. The experiments show that StaFIR adjusts its filtering strength to persistence while limiting unnecessary transformation in stationary regimes. In downstream forecasting, there is no clear accuracy difference from fixed half-order differencing, while StaFIR achieves higher measured similarity to the raw signal. A complementary direct forecasting experiment finds that greater input similarity is associated with smaller forecasting penalties, although the raw representation remains stronger.
Figures & tables
| Method | ADF rejection | PP rejection | KPSS non-rejection | LW |
|---|---|---|---|---|
| FD(0.5) | 100 | 100 | 31 | 0.46 [0.44, 0.48] |
| FD-adf | 38 | 43 | 11 | 0.82 [0.80, 0.85] |
| FD-context | 71 | 72 | 26 | 0.61 [0.56, 0.65] |
| StaFIR-context | 77 | 80 | 10 | 0.53 [0.49, 0.58] |
| Method | Similarity | |||||
|---|---|---|---|---|---|---|
| raw FD-adf | 100.0 | |||||
| 1-diff | 53.9 | |||||
| EWMA | 91.8 | |||||
| FD(0.5) | 79.4 | |||||
| FD-context | 93.9 | |||||
| StaFIR-context | 93.5 |
Appendix figures & tables19 assets
Supplementary material from the paper’s appendix.
Appendix
| Method | Adaptive | Parameter | Selection rule |
|---|---|---|---|
| raw , 1-diff | no | – | fixed references |
| EWMA , rolling-z | no | window | fixed |
| FD(0.5) | no | order | fixed a priori |
| FD-adf | yes | order | smallest order with ADF rejection |
| FD-context | yes | order | contextual rule of Appendix C.2 |
| StaFIR-context | yes | contextual rule of Appendix C.2 |
| Component | Package | Routine | Specification |
|---|---|---|---|
| ADF test | statsmodels v 0.14.6 | statsmodels.tsa.stattools.adfuller | Unit-root null. Constant only, regression = "c" , with one fixed lag, maxlag = 1 and autolag = None . Parameters from baseline configuration in Lopez de Prado [2018] . We report the statistic, -value, and rejection indicator. |
| PP test | arch v 8.0.0 | arch.unitroot.PhillipsPerron | Unit-root null. Constant only, trend = "c" . Bandwidth / lag length is chosen automatically with lags = None . We report the statistic, -value, selected bandwidth / lag, and rejection indicator. |
| KPSS test | statsmodels v 0.14.6 | statsmodels.tsa.stattools.kpss | Level-stationarity null. Constant only, regression = "c" . Lag length is selected using nlags = "auto" . We report the statistic, interpolated -value, selected lag length, and rejection indicator. |
| SOCP solver | cvxpy v 1.9.2 with clarabel v 0.11.1 | CLARABEL through the cvxpy modeling layer | Solves the filter SOCP in Section 3 . We record solver status, objective value, iterations, feasibility, and runtime. Settings are max_iter = 50 and tol_gap_abs = tol_gap_rel = tol_feas = . |
| Series | Underlying | Obs. | Sample span | Origins | Origin span |
|---|---|---|---|---|---|
| sp500 | S&P 500 index ( SPX Index ) | 6,539 | 2000-01-03 – 2025-12-31 | 73 | 2006-05-15 – 2024-05-22 |
| eurusd | EUR/USD rate ( EURUSD Curncy ) | 6,783 | 2000-01-03 – 2025-12-31 | 76 | 2006-02-17 – 2024-03-29 |
| cds_idx_sp | On-the-run Crossover five-year index spread | 5,307 | 2005-08-30 – 2025-12-31 | 53 | 2011-10-17 – 2024-05-07 |
| xbx_index | CoinDesk Bitcoin Price Index ( XBX ) | 4,077 | 2014-11-03 – 2025-12-31 | 33 | 2019-03-21 – 2024-09-26 |
| Test outcomes (%) | ||||||
|---|---|---|---|---|---|---|
| Method | Stationarity | Similarity | ADF rejection | PP rejection | KPSS non-rejection | Fail |
| raw | 65.3 0.6 | – | 61 | 63 | 19 | 0/3000 |
| 1-diff | 80.4 0.6 | 50.3 0.3 | 100 | 100 | 99 | 0/3000 |
| EWMA | 70.1 0.5 | 82.5 0.8 | 85 | 88 | 62 | 0/3000 |
| rolling-z | 70.0 0.5 | 83.1 0.8 | 83 | 86 | 54 | 0/3000 |
| FD(0.5) | 78.2 0.5 | 74.4 0.4 | 100 | 100 | 71 | 0/3000 |
| Mean | KPSS non-rejection (%) | |
|---|---|---|
| 0.00 | 80.4 | 97.3 |
| 0.20 | 79.1 | 71.7 |
| 0.40 | 75.3 | 47.0 |
| 0.49 | 73.1 | 37.7 |
| Stationarity gain | Similarity cost | Effect turnover | |||||
| Method | Pre | Trans. | Post | Trans. | Pre | Trans. | Post |
| Memory increases ( d_up ) | |||||||
| FD-adf | 0.00 (0.00) | 2.91 (0.26) | 3.27 (0.35) | 2.03 (0.18) | 0.000 (0.000) | 0.171 (0.015) | 0.206 (0.017) |
| FD-context | 4.73 (0.60) | 11.21 (0.43) | 14.62 (0.92) | 19.62 (0.74) | 0.093 (0.023) | 1.159 (0.261) | 1.669 (0.406) |
| StaFIR-context | 4.60 (0.50) | 9.47 (0.42) | 13.46 (0.97) | 16.08 (0.69) | 0.174 (0.021) | 1.189 (0.192) | 1.325 (0.234) |
| Memory decreases ( d_down ) | |||||||
| Test outcomes (%) | Stationarity components | Similarity components | Aggregate score | |||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Method | ADF rejection | PP rejection | KPSS non-rejection | dCor | ||||||||
| raw | 7 | 6 | 5 | 63.5 | 61.3 | 65.7 | 1.00 | 1.00 | 1.00 | 57.6 | 100.0 | – |
| 1-diff | 100 | 100 | 97 | 94.3 | 74.9 | 72.3 | 0.07 | 0.19 | 0.16 | 71.9 | 43.0 | – |
| EWMA | 42 | 44 | 34 | 70.6 | 64.0 | 65.6 | 0.48 | 0.78 | 0.52 | 61.3 | 71.7 | – |
| rolling-z | 30 | 31 | 34 | 70.1 | 65.7 | 66.6 | 0.48 | 0.80 | 0.53 | 62.2 | 72.4 | – |
| FD(0.5) | 100 | 100 | 31 | 77.1 | 72.2 | 70.3 | 0.56 | 0.80 | 0.54 | 67.7 | 73.9 | – |
| Baseline | Paired origins | |||
| XO 5Y | ||||
| FD-context | 0.9 [-0.9, 2.5] | -2.2 [-7.0, 2.4] | -0.08 [-0.15, -0.02] | 53 |
| FD(0.5) | -2.2 [-4.4, -0.3] | -9.3 [-13.3, -5.1] | 0.03 [-0.04, 0.11] | 53 |
| 1-diff | -6.3 [-8.4, -4.3] | -40.5 [-44.2, -36.9] | 0.38 [0.32, 0.46] | 53 |
| FD-adf | 8.5 [6.3, 10.6] | 15.9 [12.1, 19.7] | -0.41 [-0.51, -0.32] | 53 |
| raw | 9.8 [7.9, 11.6] | 16.8 [13.1, 20.4] | -0.48 [-0.55, -0.40] | 53 |
| Horizon | vs. FD-context | vs. FD(0.5) | vs. raw AR(110) |
|---|---|---|---|
| Horizon | vs. raw | vs. FD(0.5) | vs. FD-context |
|---|---|---|---|
| Test outcomes (%) | ||||||
|---|---|---|---|---|---|---|
| Method | Stationarity | Similarity | ADF rejection | PP rejection | KPSS non-rejection | Fail |
| StaFIR-context | 73.2 0.9 | 88.2 1.1 | 95 | 97 | 31 | 0/3000 |
| StaFIR-context-7-scale | 73.3 0.9 | 88.1 1.1 | 96 | 97 | 32 | 0/3000 |
| StaFIR-context-free-lags | 73.1 0.9 | 88.1 1.1 | 95 | 97 | 34 | 0/3000 |
| StaFIR-context-no-2nd-order | 70.7 0.8 | 91.6 1.1 | 87 | 90 | 38 | 0/3000 |
| Test outcomes (%) | ||||||
|---|---|---|---|---|---|---|
| Method | Stationarity | Similarity | Effect turnover | ADF rejection | KPSS non-rejection | Fail |
| StaFIR-context | 66.3 3.5 | 82.7 5.5 | 0.725 0.158 | 78 | 10 | 0/235 |
| StaFIR-context-no-2nd-order | 64.4 3.3 | 85.4 5.2 | 0.984 0.245 | 62 | 14 | 0/235 |
| StaFIR-context-7-scale | 66.4 3.5 | 82.3 5.5 | 0.715 0.171 | 80 | 17 | 0/235 |
| StaFIR-context-free-lags | 66.1 3.6 | 82.7 5.4 | 0.734 0.145 | 78 | 13 | 0/235 |
| Joint test outcome | Reference reached | Score shortfall | ||||||
|---|---|---|---|---|---|---|---|---|
| S&P 500 | ||||||||
| 0.00 | 0.20 | 58.6 | 100.0 | 0.00 | 0.019 | 0.93 | 0.00 | |
| 0.00 | 0.40 | 58.6 | 100.0 | 0.00 | 0.019 | 0.93 | 0.00 | |
| 0.00 | 0.80 | 58.6 | 100.0 | 0.00 | 0.019 | 0.93 | 0.00 | |
| 0.90 | 0.20 | 61.3 | 91.3 | 0.04 | 0.742 | 0.16 | 3.79 | |
| 0.90 | 0.40 | 61.7 | 90.1 | 0.04 | 0.900 | 0.18 | 2.40 | |
| Wall adaptation | Host inf. | State | Adaptation CPU (s) | Peak RSS abs./+ (MiB) | Selection failures | |||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Method | select (s) | carried (ms) | p50/p95 ( s) | (KiB) | select | carried | cycle | /origin | select | carried | Synthetic | Real |
| StaFIR-context | 1.56 | 203 | 4.0/4.1 | 1.59 | 1.562 | 0.219 | 1.562 | 1.562 | 200.3/+15.96 | 196.6/+12.38 | 0/3000 | 0/469 |
| FD-adf | 0.061 | 1 | 4.0/4.1 | 1.59 | 0.062 | 0.000 | 0.062 | 0.062 | 185.9/+1.00 | 184.9/+0.05 | 0/3000 | 0/469 |
| FD-context | 0.12 | 1 | 4.0/4.1 | 1.59 | 0.125 | 0.000 | 0.125 | 0.125 | 188.2/+3.70 | 184.7/+0.04 | 0/3000 | 0/469 |
| Share of origins (%) | |||||
| Selection period | Per-origin refit (s) | Similarity | Effect turnover | Joint test outcome | Selection change |
| FD-adf | |||||
| 0.06 | 96.8 3.2 | 0.099 0.123 | 10 | 72 | |
| 0.03 | 96.7 3.2 | 0.064 0.129 | 10 | 37 | |
| 0.02 | 96.7 3.2 | 0.048 0.128 | 9 | 22 | |
| 0.01 | 96.8 3.1 | 0.034 0.116 | 9 | 12 | |
| Comparator schedule | |||||
|---|---|---|---|---|---|