# Reporting the effect of a predictor in a logistic regression fitted with a restricted cubic spline

I have been playing around with using restricted cubic splines using the RMS package. Output below.

library(rms)
nlmodel_ni_bi_4 <- lrm(outcome~ rcs(age,4) + ethnicity + AV + sex + nb, data=df)
nlmodel_ni_bi_4

Frequencies of Missing Values Due to Each Variable

outcome           age          ethnicity       AV_binary          poisex      n_charge_binary
0               0            3896               0              12               0

Logistic Regression Model

lrm(formula = outcome ~ rcs(age, 4) + ethnicity +
AV + sex + nb, data = df)

Model Likelihood     Discrimination    Rank Discrim.
Ratio Test           Indexes           Indexes
Obs         62364    LR chi2    4200.40    R2       0.112    C       0.690
0          52455    d.f.             7    g        0.719    Dxy     0.380
1           9909    Pr(> chi2) <0.0001    gr       2.052    gamma   0.386
max |deriv| 2e-11                          gp       0.100    tau-a   0.102
Brier    0.123

Coef    S.E.   Wald Z Pr(>|Z|)
Intercept                 -7.2339 0.3149 -22.97 <0.0001
age                        0.4079 0.0239  17.05 <0.0001
age'                      -0.6351 0.0483 -13.15 <0.0001
age''                      2.4672 0.2589   9.53 <0.0001
ethnicity=NI              -0.6664 0.0299 -22.31 <0.0001
AV=1                       0.6583 0.0252  26.14 <0.0001
sex=M                      0.2920 0.0274  10.67 <0.0001
nb=1                       1.1922 0.0244  48.82 <0.0001


I am used to running logistic regression where all of the predictors are either continuous linear or categorical. Here, when describing the individual predictors effect on the outcome, we would present the adjusted odds ratio, associated p value and sometimes relative risk. I am not sure how to report the age predictor in my current model with RCS. I am lost on a number of issues:

1. Exactly what are the three terms associated with the age variable in the output (age, age', age''). Is this the derivative and the derivative of the derivative? or is it a term for each knot that has been fitted?

2. With a linear term the adjusted odds ratio has a simple interpretation, with a consistent slope. Given that the RCS is not linear, what is the recommended way to describe its effect?

3. Are there any guidelines for how to report predictors fitted with splines?

Thanks

## 1 Answer

My course notes describe the components of a restricted cubic spline function, and provides ways to interpret the model when general smooth effects are included. You can compute an odds ratio at two selected points for age (default in the summary.rms function is quartiles), or better: show the partial effect plots to depict the entire age effect. You can also use plot(nomogram(fit)) to construct a nomogram for the whole model. Don't try to interpret individual terms.

The terms such as age' represent differences in cubes that restrict the function of age to be linear beyond the outer knots.

• Thanks, very helpful. When you write "don't try to interpret individual terms." are you saying that the estimate provided in the table above should not be reported or interpreted. Or are you suggesting that the estimates should be reported but interpreted through other means (e.g. the odds ratio at different points), partial effects plots etc.? Would you suggest the use of these same method for plotting interactions with variables that have a spline fit to them. – user183974 Feb 15 '18 at 5:15
• Yes to the last question, and also I think it's not helpful to report the coefficients and standard errors. Partial effect plots and ANOVA tables are more helpful. – Frank Harrell Feb 15 '18 at 12:53