Teach you how to use R language to make restricted cube bar graphs

Clinically, the dependent variable and the clinical outcome are sometimes not linearly related, and the regression model has an important assumption that the independent variable and the dependent variable are linearly related, so the nonlinear relationship model is limited by regression analysis. 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 the nonlinear relationship.
In recent years, high-scoring SCI, such as The Lancet and BMJ, often use RCS to express non-linear relationships. Today we will teach you how to use R language to draw restricted cubic spline (RCS) bar graphs.
We are using a cancer data set that comes with the R language. First, import the data into RStudio to
Insert picture description here
Insert picture description here
import the survival and rms you need to download.
Insert picture description here
Insert picture description here
Delete the missing values, integrate the data,
Insert picture description here
Insert picture description here
establish the COX regression equation,
Insert picture description here
Insert picture description here
import the drawing package to
Insert picture description here
Insert picture description here
draw the graph, where rcs is Use the method of limiting the cube bar graph. Here you can also change other methods as needed. Geom_point here is the definition of scatter points.
Insert picture description here
Insert picture description here
You can also further beautify the picture. I won’t say more here. If you want to get the data in this article, you can follow the official account . contact me.
Insert picture description here

Guess you like

Origin blog.csdn.net/dege857/article/details/108864144