Clinical researchers routinely summarize how a continuous exposure relates to risk with a restricted cubic spline, a smooth curve made of cubic pieces joined at a few "knots" and forced to be straight beyond the outermost knots so it cannot swing wildly where data are sparse. From that curve they read off decision-relevant quantities: a threshold where risk starts rising, or a nadir where risk is lowest. One example is the J-shaped mortality curve for the stress hyperglycemia ratio in critical myocardial infarction, whose nadir sits near 1.02–1.04 (SHR in MIMIC-IV and CIN-II). Today these curves are fit once, offline. As registries and electronic health records grow continuously, the natural move is to refit as data arrive. Naive refitting makes the reported nadir and threshold jump from update to update even when nothing real has changed. Online learning calls this pathology "flip-flopping" and studies it under the heading of switching costs (Devroye et al., Daniely et al.).
We propose treating streaming spline estimation as smoothed online convex optimization. In that setting each update pays a fit cost on new data plus a switching cost for moving away from the previous estimate. The key choice is to charge the switching cost on the change in the curve's slope, weighted by where patients actually are, rather than on the raw spline coefficients. That penalty is still a simple quadratic in the coefficients, so optimal algorithms from the switching-cost literature apply directly. Because a nadir is where the slope crosses zero, bounding slope movement also bounds how far the reported nadir can jump. The result is an estimator whose clinically reported quantities move only when the evidence moves, together with an explicit trade-off curve between fit and stability.
Core Claim
The non-convexity of a spline in its input is a red herring for estimation. The fitted curve is $f_w(x)=\sum_j w_j B_j(x)$, where $B_j$ are the restricted cubic spline basis functions and $w$ the coefficients. Any logistic, Cox partial-likelihood, or squared loss is convex in $w$. The real open problem is what to penalize and how to handle knots that should move as the data distribution drifts. At round $t$ the estimator chooses $w_t$ to minimize
$$ \ell_t(w) + \lambda_t \int \big(f_w'(x) - f_{w_{t-1}}'(x)\big)^2 p_t(x)\,dx \;=\; \ell_t(w) + \lambda_t (w-w_{t-1})^\top G_t (w-w_{t-1}), $$
where $\ell_t$ is the loss on the newly arrived batch, $p_t$ is the current estimate of the exposure distribution, $G_t$ is the Gram matrix of basis derivatives under $p_t$, and $\lambda_t$ is the stability weight.
The payoff comes from the first-order condition at the nadir $x^\star$, where $f'(x^\star)=0$. By the mean value theorem, a slope perturbation of size $\delta$ near the nadir moves it by roughly
$$ |x^\star_t - x^\star_{t-1}| \lesssim \frac{\sup_{x\text{ near }x^\star}|f_t'(x)-f_{t-1}'(x)|}{f''(x^\star)}. $$
On a finite spline space the supremum is controlled by the weighted $L_2$ norm in the penalty, with a constant that depends on the knots. So the penalty directly caps nadir jitter, and caps it most tightly where the curve is sharply curved.
The claim is that this derivative-space switching cost, combined with knot-drift handling and a weight $\lambda_t$ that adapts to whether the stream is merely noisy or has genuinely shifted, yields a better fit-versus-stability frontier than refitting, coefficient-space smoothing, or state-space filtering.
Relation to Prior Work
The algorithmic machinery comes from smoothed online convex optimization, where an agent pays both a per-round cost and a cost for moving.
Three papers set the algorithmic terms. Online balanced descent balances movement against the per-round cost and gets dimension-free guarantees for sharply growing costs (Chen et al.). Its regularized variant, R-OBD, adds a pull toward the current minimizer and exactly matches the lower bound $\frac{1}{2}(1+\sqrt{1+4/m})$ for $m$-strongly convex costs with squared movement cost (Goel et al.). With a quadratic switching cost in a fixed metric, our per-round update is an R-OBD step in the geometry defined by $G_t$. We reuse that method rather than claim a new one.
Two further papers constrain the design. Bhuyan et al. prove that fixed-weight interpolation incurs linear dynamic regret when the target drifts stochastically, and propose lazy adaptive interpolation (LAI) with time-varying weights. This rules out a constant $\lambda$ and motivates adaptive weights. Pan et al. show that nonlinear switching costs must be Lipschitz for bounded competitive ratios. That argues against penalizing nadir movement directly, since the nadir is a non-smooth, possibly discontinuous function of $w$ when the curve flattens. We therefore penalize the slope, a smooth proxy, and obtain nadir control through the bound above.
Kalntis et al. motivate the idea that the switching metric should come from the domain rather than a default norm. They built handover costs from measured network delays and report up to 79.6x lower handover costs than delay-ignorant policies. Our metric instead derives from the decision quantity users read off the curve.
On the spline side, the batch analyses supply both the curve shapes and the stability requirement. These are the J-shaped SHR curve (SHR paper), the 25 g/day sugar threshold (Yu et al.), and the L-shaped antioxidant–HPV curve from NHANES (Li et al.). All are retrospective single fits. The research file found no work that updates such curves online under a movement penalty.
Research Program
The first component is the estimator. Each round receives a batch of patients. The procedure has four steps.
The estimator first updates $p_t$ with a streaming quantile sketch and places knots at the standard quantiles of $p_t$. When a knot has moved by more than a set tolerance, it re-expresses the previous curve in the new basis by $L_2(p_t)$ projection. It records the projection error, because a new basis cannot always represent the old curve exactly. Next it solves the penalized problem above with a few Newton steps from a warm start. Finally it sets $\lambda_t$ by an LAI-style rule. The rule estimates whether recent gradient innovations look like zero-mean noise or like persistent drift, and lowers $\lambda_t$ in the second case.
Coefficient uncertainty comes from the penalized Hessian. It propagates to intervals for the nadir and threshold by the delta method, then checks against bootstrap on the batch fit at the end of the stream.
The second component is analysis. We will bound cumulative nadir movement in terms of the penalty budget and the curvature at the nadir. We will also bound excess cumulative loss against a slowly moving comparator sequence, inheriting the R-OBD and LAI guarantees in the $G_t$ geometry. When knots move, the bound gains an additive term from projection error, which is measured empirically.
Baselines
The naive reference point is full batch refitting of the restricted cubic spline on all data seen so far at every round, with knots at current quantiles. This is what an analyst would do by hand. It is the fit-optimal choice in a stationary world and the natural generator of flip-flopping early in the stream. Sliding-window refitting is its drift-responsive counterpart, with the window length tuned on a held-out stream. Both use the same knot rule and the same data as our method. For the final curve on the full cohort, the target is the batch nadir of 1.02–1.04 reported by the SHR paper. The online method's end-of-stream nadir should land in that interval.
The strongest existing competitor is a state-space spline, meaning a Kalman filter over the coefficients with a random-walk prior. It is stochastic-optimal when the drift really is a Gaussian random walk, and its adaptive gain behaves much like LAI. A second strong competitor is R-OBD in raw coefficient space, a Euclidean proximal step toward $w_{t-1}$ with fixed weight (Goel et al.). Each receives the same tuning budget of the same number of configurations on the same validation streams. The Kalman filter tunes process and observation noise; R-OBD tunes its weight. For online smoothed spline estimation specifically, no reported result was found on Lacuna.
Winning means the following. At matched cumulative out-of-sample log-loss, within one percent of full refitting, our method must show lower total variation of the reported nadir and threshold across rounds than every baseline. After an injected shift, its detection delay must be no worse than the sliding window's.
Three ablations isolate the ingredients. The first swaps the derivative-space metric for a function-value $L_2(p)$ metric and for raw coefficient $\ell_2$. The second freezes $\lambda_t$ at its best constant value. The third keeps knots fixed from the first batch instead of projecting.
Why not just…?
Why not just refit and smooth the reported nadir with a moving average? Averaging the nadir output fixes the symptom but decouples the reported nadir from any coherent curve. The averaged nadir need not be a minimum of any fitted spline, and the threshold and interval estimates would each need their own ad hoc smoother. Bhuyan et al. also show that fixed-weight averaging suffers linear dynamic regret under stochastic drift. We include output-level exponential smoothing as a baseline and expect it to lag after real shifts.
Why not just use a Kalman filter on the spline coefficients? This is the real threat. With a process-noise covariance proportional to $G_t^{-1}$, the filter's update is close to ours in the stochastic regime. Our expected edge lies elsewhere. The first is abrupt shifts, where worst-case-robust updates avoid the slow recovery a mis-specified random-walk prior causes. The second is knot drift, which standard filters do not handle. We therefore run the filter in two versions, with isotropic covariance and with derivative-geometry covariance. If the second matches us on all streams, the honest conclusion is that the contribution is the metric and knot handling, not the online algorithm. We will report it that way.
Why not just use a linear or quadratic dose-response model, which is stable and convex? Linear models cannot represent a nadir at all. A quadratic forces symmetry around the nadir, while the SHR curve is J-shaped: flat on one side and steep on the other (SHR paper). On the semi-synthetic streams described below, we will report the quadratic's nadir bias against the known truth.
Proposed Experiments
The primary real stream is the MIMIC-IV critical myocardial infarction cohort defined as in the SHR paper, extracted with the MIMIC-IV pipeline. The outcome is one-year mortality, streamed in admission order within coarse anchor-year groups because MIMIC-IV shifts dates for de-identification. A second real stream uses NHANES survey cycles as natural rounds for the antioxidant–HPV relation studied by Li et al.. If access permits, CIN-II's 2007–2020 admissions provide a genuine calendar-time stream.
Because real streams lack ground truth, the decisive experiments are semi-synthetic. We resample MIMIC-IV covariates and generate outcomes from a known J-shaped curve. That curve is either stationary, drifting slowly as a random walk in its nadir, or shifted abruptly mid-stream. These three regimes mirror the settings in which Bhuyan et al. separate adaptive from fixed interpolation.
Metrics are reported as full fit-versus-stability frontiers, not single points. Fit is cumulative out-of-sample log-loss. Stability is the total variation of the reported nadir and threshold. Two further metrics are nadir error against the known truth and delay to track a shift.
The decisive checks are three. In the stationary regime, our method must cut nadir jitter substantially relative to refitting at negligible loss cost. In the shift regime, it must track the new nadir no slower than the tuned sliding window. Across regimes, the derivative-metric ablation must dominate the function-value and coefficient metrics, which is the test of the core claim. If that ablation fails, the proposal reduces to a known R-OBD application and we will say so.
References
- Impact of stress hyperglycemia ratio on mortality in patients with critical acute myocardial infarction: insight from american MIMIC-IV and the chinese CIN-II study
- Prediction by random-walk perturbation
- Competitive ratio vs regret minimization: achieving the best of both worlds
- Smoothed Online Convex Optimization in High Dimensions via Online Balanced Descent
- Beyond Online Balanced Descent: An Optimal Algorithm for Smoothed Online Optimization
- Best of Both Worlds Guarantees for Smoothed Online Quadratic Optimization
- Online Optimization with Feedback Delay and Nonlinear Switching Cost
- Smooth Handovers via Smoothed Online Learning
- Sugar Is the Key Cause of Overweight/Obesity in Sugar-Sweetened Beverages (SSB)
- An L-shaped link between the composite dietary antioxidant index and human papillomavirus infection in women: a US population-based study
- An Extensive Data Processing Pipeline for MIMIC-IV