0
$\begingroup$

I am interested in evaluating the relationship between age, BMI and lipid level. The lipid level is an outcome in my study. I think that the relationship between lipid level and age and the relationship between lipid level and BMI may be non-linear, respectively. Therefore, I would like to apply restricted cubic splines into the age and BMI in the rms package of R

In this case, I have to consider how many knots should be used for each of the two splines, one for age and the other for BMI (and moreover, I have to decide the position of the knots).

As a solution to this issue, I am thinking of implementing the following commands to determine how many knots are optimal for age and BMI, respectively, changing the number of knots and adopting the model with the lowest AIC.

mod <- ols(lipid~rcs(age,num_knot_age)+rcs(BMI,num_knot_BMI),data=dat);

Is there any other better way to do this? I would appreciate your advice.

$\endgroup$
1
  • 2
    $\begingroup$ There is quite a bit of discussion of this in Frank Harrell's book "Regression Modelling Strategies". (He is the author of the rms package that has these functions). $\endgroup$
    – Peter Flom
    Commented Jan 27 at 11:05

1 Answer 1

3
$\begingroup$

To expand on the comment from Peter Flom, Chapter 2 of Frank Harrell's online Regression Modeling Strategies provides specific guidance. Section 2.4.6 says:

Locations not important in most situations

Place knots where data exist — fixed quantiles of predictor’s marginal distribution

The latter is the default with rcs().

The number of knots is primarily determined by the size of the data set: 3, 4 or 5 are typical choices. Section 2.4.6 also suggests using AIC to choose the number of knots, consistent with your approach.

Your proposed model doesn't seem to allow for any interactions between age and BMI. That might be important to include. Section 2.7.2 discusses ways to include complex interactions between flexibly fit continuous predictors.

$\endgroup$
1
  • $\begingroup$ Thank you for your advice. Your response was very helpful and I would like to consider the number of knots for age and BMI based on the AIC. I would also like to consider the interaction. $\endgroup$
    – Totti
    Commented Jan 29 at 6:53

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.