Clinically, the relationship between the dependent variable and the clinical outcome is sometimes not linear, and an important assumption of the regression model is that the independent variable and the dependent variable are linearly related. Therefore, the use of regression analysis to fit the nonlinear relationship model is limited. Therefore, a better solution is to fit the nonlinear relationship between the independent variable and the dependent variable. Restricted cubic spline (RCS) is one of the most common methods to analyze nonlinear relationships.
This public account has written many articles one after another to take you to understand the Restricted Cubic Spline (RCS) from the simple to the in-depth.
Setup RCS via Spline Regression node
R language spline regression and draw restricted cubic bar plot
2. The RMS package draws restricted cubic splines. This is the most commonly used method at present, and most people use this method.
Example demonstrating how to create a restricted cubic bar chart using R language
3. Restricted cubic splines based on logistic regression and linear regression of the RMS package, which is an extension of the previous article.
R language to draw restricted cubic bar chart 2 (based on logistic regression and linear regression)
4. Draw two or more restricted cubic splines
Two methods in R language to draw classified RCS curves
5.ggplot draws histogram + restricted cubic spline + dual axis chart
R language ggplot draws histogram + restricted cubic spline + dual axis chart
6. Draw a restricted cubic bar chart of complex sampling design data (NHANES data). Although there are many methods on the market, looking back, my method is more reliable.
R language to draw complex sampling design logistic regression restricted cubic spline (RCS)
7. From the fun function of the RMS package, we can see how to manually derive HR or OR values from complex sampling models and draw restricted cubic spline functions. Although it is not difficult to do, the derivation also takes a lot of time.
8. At the request of fans, I wrote a linear cubic spline diagram for nhanes database interpolation.
9. Calculation of P for overall and P for nonlinear in restricted cubic splines (RCS)
Calculation of P for overall and P for nonlinear in restricted cubic spline (RCS)
10. Many people are interested in limiting cubic spline turning points, and released the threshold function to generate data tables with one click.
cox regression RCS threshold function cut.tab1.3 released
11. At the request of fans, make minor adjustments to the restricted cubic spline function and draw multiple legends manually.
Add different legends for RCS curves
12. Wrote the ggrcs package, which is currently version 2.9, and can easily draw rcs curves.