# Interpreting Ordinal Regression with Linear Spline

**URL:** <https://discourse.datamethods.org/t/interpreting-ordinal-regression-with-linear-spline/25385>\
**Category:** data analysis\
**Tags:** ordinal, spline\
**Created:** [January 21, 2025, 4:52pm UTC](https://discourse.datamethods.org/t/interpreting-ordinal-regression-with-linear-spline/25385 "2025-01-21T16:52:37Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Louis\_Martin](https://discourse.datamethods.org/user_avatar/discourse.datamethods.org/louis_martin/32/4980_2.png) [@Louis\_Martin](https://discourse.datamethods.org/u/Louis_Martin)\
**Post date:** [January 21, 2025, 4:52pm UTC](https://discourse.datamethods.org/t/interpreting-ordinal-regression-with-linear-spline/25385/1 "2025-01-21T16:52:38Z")

</div>

I’m planning to perform a retrospective analysis to determine whether steroid doses improve outcomes for a subset of NICU patients. The outcome variable will be respiratory interventions at NICU discharge, where outcomes are ordered from best to worst (e.g. Room air \> 1 L Nasal Cannula \> 2 L Nasal Cannula \> … \> Ventilator \> Patient Died). Patients received 0-6 doses of steroids.

I would expect that having one dose would improve outcomes, but subsequent doses would be less effective, so I was considering including a linear spine for dose number. However, I’m not sure how to interpret the Beta coefficients when there is a linear spline term.

Here are some simulated data without covariates.

```auto
require(rms)
set.seed(817)
N <- 350
# Patients have 30% probabily of getting any steroid
any_steroid <- sample(0:1, N, replace = T, prob = c(0.3, 0.7))
# Most patients get low number of doses
doses <- ifelse(any_steroid == 0, 0, as.integer(rgamma(N, 2, 1)))
# Cap doses at 6
doses <- ifelse(doses > 6, 6, doses)
# Making outcome numeric for simplicity
outcome.seed <- as.integer(runif(N, 6, 20))
# One dose reduces outcome (makes it better). Subsequent doses are ineffective
outcome <- as.integer(outcome.seed - ifelse(doses > 0, 5, 0))

d <- data.frame(doses = doses, outcome = outcome)
dd <- datadist(d); options(datadist = 'dd')

# Ordinal regression with linear spline
f <- orm(data = d, outcome ~ lsp(doses, 1))
ggplot(Predict(f, fun = plogis))

```

![ordinal ggpredict](https://discourse.datamethods.org/uploads/default/original/2X/0/026e6b0bf4cbb391e6adf270588dd4f256539801.png)

The prediction plot shows up exactly as I would expect, with one dose lowering the probability of a bad outcome and subsequent doses having essentially no effect. Here is the model output.

![ordinal output](https://discourse.datamethods.org/uploads/default/original/2X/5/53d600eb55e6fcf2d20f6638a6994a32cf293a5f.png)

Based on the betas, I would say that one doses reduces the odds of a worse outcome by 1/exp(-1.8023) = 6.06 times. Subsequent doses increase the odds of a worse output by exp(-1.8023+1.8726) = 1.07 per dose. Does this interpretation make sense? Is there a way to get a p value or confidence intervals for the effect of more than one dose?

---

<div class="post-metadata">

**Author:** ![f2harrell](https://discourse.datamethods.org/user_avatar/discourse.datamethods.org/f2harrell/32/165_2.png) [@f2harrell](https://discourse.datamethods.org/u/f2harrell)\
**Post date:** [January 21, 2025, 5:06pm UTC](https://discourse.datamethods.org/t/interpreting-ordinal-regression-with-linear-spline/25385/2 "2025-01-21T17:06:02Z")

</div>

Your interpretion lpooks good and note that p-values are overused. But you can get anything you want by deciding which two doses to compare, or you can compare a series of doses 2, 3, … to dose=1. The `contrast` function (type `?contrast.rms` for help) makes this easy.
