Teach you how to use stata for cox regression and make a nomogram

COX regression is a commonly used clinical analysis method, which is mostly used for patients with tumors, blood and other diseases. It takes into account the censorship of clinical follow-up, and is often used for survival analysis. We have talked about the use of SPSS and R language for COX regression many times. Today, we will continue to talk about stata. Its advantage over the other two software is that it is simpler than R language, can be operated on the interface, and is more convenient than SPSS. .
First, we open stata to import the data, or the original breast cancer data, let's take a look at the data:
age means age, pathsize means pathological tumor size (cm), lnpos means positive axillary lymph nodes, histgrad means histopathological grade, er means female Hormone receptor status, pr represents progesterone receptor status, status outcome event is dead, pathscat represents pathological tumor size category (grouping variable), ln_yesno represents whether there is lymph node enlargement, time is survival time, and agec is our own design Set, don't worry about it.
Insert picture description here
Suppose we are studying the effect of ln_yesno indicating whether there is lymph node enlargement on the survival rate of patients.
Let’s first compare the graph with the KM curve and open it with the red arrow.
Insert picture description here
First, set the time and survival status
Insert picture description here
Insert picture description here
as shown in the figure below. Some information about patients who survived and died. The longest survival time is 133 months.
Insert picture description here
We need to see if there is any influence of lymph node enlargement on the survival rate of patients. Check the grouping below, otherwise the cumulative survival rate will be the cumulative survival rate.
Insert picture description here
Finally, click OK.
Insert picture description here
This is just an analysis that only considers the factors of lymph node enlargement. In the clinical timing, the survival rate is also affected by many factors, such as age, lymph node metastasis, etc.
We can also make some adjustments to adjust the
Insert picture description here
results of patient confounding factors It is obviously different from the original. After adjustment, the survival rate of lymph node enlargement is obviously lower. The
Insert picture description here
picture can be modified a lot, such as adding a risk table, etc., I will not go into details here. You can study it yourself, and now we come Talk about how to make a nomogram
Stata needs to install two packages to make nomograms, nomolog and nomocox. Nomolog is used to make Logistic regression nomograms. Nomocox is used to make COX regression
nomograms. The installation command of Nomolog is:
ssc install nomolog or
net from http://www.stata-journal.com/software
net cd sj15-2
net describe st0391
net install st039

The installation command of
nomocox is ssc install nomocox

If you really can’t install it, you can also download
nomolog at this address :
https://download.csdn.net/download/dege857/14878926

nomocox
https://download.csdn.net/download/dege857/14879027

After downloading, copy the files of the two packages in
the directory of C:\ado\plus\n.
Insert picture description here
If your directory is only C:\ado\plus, and there is no folder for n, you can create a
copy and then return it. To enter the command:
Nomolog:
window menu append item “stUserGraphics” “&Nomogram post logistic regression” “db nomolog”
window menu refresh
so that an icon is formed in the
Insert picture description here
stata Nomocox command is:
window menu append item “stUserGraphics” “&Nomogram post Cox regression" "db nomocox"
window menu refresh
OK, after installing the nomogram plug-in, we will start to make the nomogram , but everyone should understand that the nomogram is only a visual analysis of COX regression, so we have to do it first COX regression, click the red arrow in turn.
Insert picture description here
Actually, it is similar to the competitive risk model. Covariates are also selected here. Because we have set the outcome variable and time variable just now, there is no need to set it again here.
Insert picture description here
Click OK to get the following picture
Insert picture description here
. Although the COX regression model has come out, some categorical variables stata will be used as continuous variables if it is not set. This is of course wrong. We need to mark the categorical variables and add an i in front of it. The
operation is as follows: first put the stata Copy the command, the command is: stcox ln_yesno er pr age
Insert picture description here
copy to the command box
Insert picture description here
I. in front of the categorical variable, so the command becomes: stcox i.ln_yesno i.er i.pr age, and then enter the command. The
Insert picture description here
final model is.
Insert picture description here
After adjusting for other covariates, the risk of death with lymph node enlargement is 2.35 times higher
It’s very simple to make a
Insert picture description here
nomogram later, but click on the graph in turn. This is the interface of the stata nomogram. Click the survival dialog box with the red arrow.
Insert picture description here
At least one parameter must be set here. Fill in
Insert picture description here
the simplest nomogram like 10 here . It's
Insert picture description here
finished, there are many functions and adjustments left for everyone to explore. After all, the operation is very simple. It feels that stata is much easier to make nomograms than R.
For more exciting articles, please pay attention to the public account: zero-based scientific research

Insert picture description here

Guess you like

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