3
$\begingroup$

I have around 500 observations with a binary outcome at 25% prevalence and will be building an internally validated prediction model. I want to use splines to model non linearity in my continuous predictors. This is a part of a theoretical exercise and so I’m trying a few different things but I am a little confused about the way I should approach this, given the following:

  • if I want to use the rule of thumb of 10 Events Per Predictor (EPP) to guide sample size for the development set, is it okay to keep this in mind when choosing the type of spline basis and number of knots? This would be in order to keep the extra predictors that count towards the EPP to the minimum. Since I have 5 continuous predictors, I wouldn’t want to end up with most of my data having to be used for the development. What I mean is that, for example, natural cubic spline with 5 knots will give me 6 predictors to my count, whereas a quadratic piece wise with 1 knot will give 4. I am going by k+1 and k+4, respectively, and would appreciate being corrected if this is wrong.
  • for the purpose of visualisation of the splines for each variable separately, does it make sense to first show non linearity on the logit scale, and then show plots of the spline curve on the probability scale? Is there a good way to visually show the fit that includes a scatter of data points?

I hope my questions make sense. My understanding of splines in general may not be the best but I couldn’t really find relevant information on these issues that would fully answer my questions.

$\endgroup$
2
  • $\begingroup$ Welcome to CV. Could you edit your question to spell out EPP at its first occurrence? I'm not sure what it means, and, also, many of our readers have English as a second (or third, or fourth) language, and acronyms don't translate well. $\endgroup$
    – Peter Flom
    Sep 8, 2023 at 18:14
  • $\begingroup$ So sorry, just corrected it! $\endgroup$
    – blueberry
    Sep 8, 2023 at 18:23

1 Answer 1

1
$\begingroup$

Frank Harrell discusses polynomials and splines in Section 2.4 of Regression Modeling Strategies (RMS). A k-knot cubic spline restricted to be linear beyond the outermost knots only uses k-1 degrees of freedom.

Chapters 10 through 12 of RMS discuss logistic regression, with examples of using splines to fit continuous predictors. Examples in Chapter 10 show the nonlinear curves on the logit scale, while examples in Chapter 12 use the probability scale. The choice depends on what you'd like to emphasize: the magnitude of the nonlinearity with the logit scale, the implications for probability estimates in the probability scale.

For a "scatter of data points" with simple models (e.g., an interaction of a binary predictor with a spline of a single continuous predictor), you can show observed probabilities over groups binned in the continuous predictor values. See Figure 10.6 of RMS for an example. That gets to be more complicated with multiple predictors.

With 125 events you risk overfitting if you estimate more than 8 to 10 coefficients; see Chapter 4 of RMS. That leaves you with only 2 coefficients (3 knots in a restricted cubic spline) for each of your 5 continuous predictors. You might also consider penalized models; see this page for an outline of alternatives.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.