Biostatistics • August 27, 2026

Restricted Cubic Splines in Clinical Research: Modeling Nonlinear Associations Without Arbitrary Categorization

Glassmorphic visualization of a smooth nonlinear clinical association modeled with restricted cubic splines

Restricted cubic splines model a continuous predictor as a smooth, flexible function rather than forcing a linear effect or arbitrary categories. In clinical research, they can reveal threshold-like or curved associations while preserving information. Their value depends on prespecified knots, adequate data across the predictor range, careful testing of nonlinearity, interpretable effect plots, and validation. A spline curve is a model of an association, not proof of causality or a license to extrapolate beyond the observed data.

Many clinical variables do not have a simple one-unit relationship with an outcome. Age, blood pressure, kidney function, dose, biomarker concentration, and treatment delay may have effects that flatten, accelerate, reverse, or change direction across their range. A common response is to divide the variable into categories, such as quartiles or clinically convenient bands. Categorization is easy to display, but it discards information, creates artificial thresholds, reduces power, and can make results depend on arbitrary cut points.

A second response is to place the variable in a linear regression term. This preserves the data but imposes a strong shape assumption: every one-unit increase has the same effect on the model scale. When that assumption is wrong, the estimated average slope can conceal clinically important regions of risk. Restricted cubic splines offer a middle path. They retain a continuous predictor while allowing a smooth nonlinear association that can be evaluated with an explicit statistical test and a plotted confidence band.

What a restricted cubic spline does

A restricted cubic spline represents a continuous predictor using several transformed basis functions joined at prespecified knots. The fitted model estimates coefficients for those basis functions rather than a single linear slope. The word “restricted” refers to the boundary behavior: beyond the outer knots, the function is constrained to be linear. This reduces unstable tail behavior compared with an unconstrained high-degree polynomial and makes the boundary assumption explicit.

The model is still a regression model. For a binary outcome, the spline terms can enter a logistic model; for time-to-event data, they can enter a Cox model or a parametric survival model; for continuous outcomes, they can enter a linear model; and for rates or counts, they can enter an appropriate generalized linear model. The link function determines the scale on which the association is modeled. The spline itself does not determine whether the result is an odds ratio, hazard ratio, risk difference, mean difference, or another estimand.

The fitted curve is usually evaluated relative to a meaningful reference value. For example, a researcher may report the estimated hazard ratio at several values of a biomarker compared with its median or a clinically relevant reference. A plot of the entire curve with a confidence band is often more informative than reporting one coefficient for each basis function, because individual spline coefficients are not usually clinically interpretable in isolation.

Why categorization can mislead

Dividing a continuous predictor into groups changes the scientific question. A quartile analysis compares groups defined by the sample distribution, not necessarily groups that correspond to biological or clinical thresholds. Two patients just above and just below a cut point are treated as different, while two patients at opposite ends of the same category are treated as equivalent. The result can be sensitive to the selected cut points and to the sample used to define them.

Categorization also weakens statistical efficiency. Within-category variation is discarded, and the analysis may lose the ability to detect a gradual trend. If the true relationship is U-shaped, a set of broad categories may suggest a few unrelated contrasts rather than reveal the underlying pattern. Spline modeling does not automatically solve every problem, but it makes the continuous structure visible and allows the analyst to assess whether a simpler linear term is adequate.

Clinical categories can still be appropriate when they are defined before analysis, have a clear clinical interpretation, and correspond to a decision or treatment pathway. The problem is not categories themselves; it is using arbitrary or outcome-driven cut points as a substitute for modeling and interpretation.

Knot selection: flexibility with discipline

Knots divide the predictor range into regions where the basis functions are joined. More knots allow more local flexibility, but they also increase the opportunity for overfitting, especially when observations are sparse in the tails. Fewer knots impose more smoothness and may miss real curvature. Knot placement should therefore be prespecified or justified using a transparent rule, with attention to the number of events, the distribution of the predictor, and the clinical range in which inference is needed.

Quantile-based placement is common because it places knots where data are available, while clinically motivated placement may be preferable when validated thresholds or measurement ranges have strong substantive meaning. Neither approach guarantees a correct curve. The analyst should inspect the number of observations and events around the knots, identify sparse regions, and avoid treating a default software setting as a methodological justification.

Knot selection is also related to the analysis goal. A descriptive epidemiologic association may tolerate a flexible curve if the sample is large and the plot is carefully bounded. A clinical prediction model needs additional control of optimism, calibration assessment, shrinkage or penalization when appropriate, and external validation. A curve that fits the development dataset smoothly may perform poorly in a new population.

Testing nonlinearity without testing the whole model

A spline model contains both a linear component and one or more nonlinear components. A useful inferential question is whether the nonlinear component improves the model beyond a linear term. This can be evaluated with a joint test of the coefficients associated with the nonlinear basis functions. The test is not a test of whether the entire predictor has no association. A statistically significant overall association can coexist with a nonsignificant nonlinear component, meaning that a linear approximation may be adequate over the observed range.

Researchers should state which comparison was made, which scale was used, and how the reference value was chosen. A p-value for nonlinearity should not be used as the sole basis for deciding whether to display a curve. Clinical plausibility, sample size, residual or calibration diagnostics, the shape of the confidence band, and the consequences of misspecification also matter. Conversely, a visually curved line is not evidence of a meaningful nonlinear effect if the confidence band is wide and the apparent bend is driven by a few observations.

Multiplicity should be considered when many predictors, outcomes, knot specifications, transformations, and subgroups are examined. A curve selected after extensive searching may look persuasive by chance. The analysis plan should distinguish prespecified primary modeling from exploratory shape discovery and should report sensitivity analyses when the specification is uncertain.

Interpreting odds ratios, hazard ratios, and risk curves

For a logistic model, the spline describes how the log odds change across the predictor. The plotted odds ratio at a value is relative to the chosen reference and does not equal a risk ratio unless additional conditions hold. For a Cox model, the curve typically represents a hazard ratio relative to a reference, under the model’s proportional-hazards framework unless a time-varying effect is also specified. Neither curve directly reports absolute risk.

Clinical readers often need absolute predictions. A useful presentation may therefore pair the spline association plot with predicted risks or survival probabilities at representative covariate profiles, while clearly stating the population, follow-up horizon, baseline risk, and uncertainty. In a prediction model, calibration plots and decision-curve analyses may be more relevant than a single p-value for nonlinearity. In an etiologic analysis, the target estimand and confounding strategy must be defined before interpreting the curve as a causal effect.

Reference selection changes the visual interpretation but not the underlying fitted association. A median reference may be convenient, whereas a clinically normal value, treatment target, or observed minimum may be more useful. The reference should be stated in the figure and methods, and it should lie in a region with adequate data. If the reference is poorly supported, the resulting ratios can be unstable even when the model converges.

Evidence summary table

Methodological issueRecommended practiceVerification focus
Functional formUse a flexible continuous function when a linear effect is not scientifically defensible.Compare the spline with a prespecified linear model and report the modeling rationale.
Boundary behaviorUse restricted tails so the fitted function is linear beyond the outer knots.Check that inference is not driven by sparse extreme observations or extrapolation.
Knot placementPrespecify or transparently justify the number and location of knots.Report predictor distribution, events, and sensitivity to reasonable alternatives.
NonlinearityTest the joint nonlinear component rather than interpreting individual basis coefficients.Distinguish overall association from evidence that the shape is nonlinear.
Effect displayPlot the curve, confidence band, reference value, and observed-data density.Inspect whether apparent bends are supported across the clinical range.
Model interpretationLabel the scale correctly as OR, HR, risk, mean, rate, or another estimand.Do not interpret relative measures as absolute risk or causal effects by default.
Prediction useAssess calibration, optimism, and external performance when the spline is part of a prediction model.Validate in an independent or appropriately resampled dataset.
ReportingReport transformations, knots, reference, software, uncertainty, and model-building decisions.Use TRIPOD or the design-appropriate reporting guideline and preserve analysis code.

Actionable Steps: Fit and report a spline model responsibly

StepActionQuality gate
Step 1Define the predictor, outcome, estimand, link function, clinical range, and reason a nonlinear association is plausible.The question is stated before exploring outcome-driven cut points or curves.
Step 2Inspect the predictor distribution, outcome or event density, missingness, measurement units, and tail support.Sparse regions and clinically implausible values are identified before knot selection.
Step 3Prespecify knot number and placement, fit the spline and linear comparison, and conduct the joint nonlinearity test.The specification and comparison are reproducible and not chosen only after seeing the preferred curve.
Step 4Plot the fitted association with a confidence band, reference value, rug or density, and clinically interpretable scales.Readers can distinguish the observed range from extrapolated or weakly supported regions.
Step 5Run sensitivity analyses and validate the model when the curve informs prediction, treatment decisions, or causal interpretation.Overfitting, calibration, transportability, confounding, and model uncertainty are addressed.

Common failure modes

One failure mode is treating the spline as a discovery machine without accounting for the search process. If analysts try many knot numbers, references, outcomes, and subgroups, the final curve can reflect selection rather than a stable association. Another is reporting only the p-value for nonlinearity while omitting the curve, confidence band, or data density. Readers cannot assess whether the result is clinically important or supported by the data.

A third failure is extrapolation. Restricted tails are linear beyond the outer knots, but that mathematical restriction does not create information outside the observed range. Predictions in a region with few or no observations should be labeled uncertain and, when possible, excluded from the main clinical interpretation. A fourth failure is confusing association with causation. A smooth biomarker-risk curve can be confounded by disease severity, treatment selection, measurement timing, or other factors. Splines address functional form, not confounding.

Finally, analysts may use a spline in a prediction model and report discrimination alone. A flexible term can improve apparent discrimination while worsening calibration in new data. Prediction models need optimism assessment, calibration evaluation, and external validation. The spline transformation, knot values, and preprocessing rules must be reproduced exactly in validation data.

Relation to clinical reporting standards

For prediction models, TRIPOD reporting requires enough detail for readers to understand predictor handling, model specification, performance assessment, and validation. A manuscript should state whether the spline was prespecified, how its knots were selected, how missing predictor values were handled, and how the transformation was implemented at validation. For observational studies, the relevant reporting framework may include STROBE, while a systematic review of nonlinear dose-response associations may require PRISMA and a transparent description of how dose and correlation were handled.

Reporting guidance does not determine the correct knot placement or prove that the curve is clinically useful. It establishes a minimum level of transparency. A complete report allows another analyst to reproduce the basis functions, refit the model, inspect the same range, and understand which conclusions are robust and which remain exploratory.

Researcher's Toolkit: Strengthen Your Quantitative Analysis

Lingcore SCI provides workflow support for the steps that surround a nonlinear clinical analysis:

These tools can structure evidence and writing, but the research team must verify the model, inspect the data, and approve the scientific interpretation.

Conclusion

Restricted cubic splines are a practical way to model nonlinear associations while preserving the information in a continuous clinical variable. They are not a shortcut around study design or statistical judgment. A defensible analysis links the spline to a clear estimand, prespecifies or justifies knots, tests nonlinearity appropriately, displays uncertainty across the supported range, and validates any model intended for prediction or decision-making. When the result is reported with its assumptions and limitations, the method can reveal clinically relevant shape without manufacturing arbitrary thresholds.