Teach you how to use R language to make Table 2 in SCI papers (single factor analysis table) (3)

In the previous chapters, we have discussed the production methods of two SCI single factor tables. Today we will use the third table. In fact, these three tables already cover most of the SCI single factor tables. , It can definitely be done. Today we will take a look at the third type, which is like an enhanced version of the second type. First, the pregnant women are divided into unborn women and those who have given birth, and then the relationship between the two groups of patients with placenta previa is compared.
Insert picture description here
We still use previous breast cancer data
age to indicate age, pathsize to indicate pathological tumor size (cm), lnpos to indicate positive axillary lymph nodes, histgrad to indicate histopathological grade, er to indicate estrogen receptor status, and pr to indicate progesterone receptor status , Status outcome event is dead, pathscat represents the size category of pathological tumors (grouping variable), ln_yesno represents whether there is lymph node enlargement, time is survival time, the agec behind is set by ourselves, don’t care about it.
library(foreign)
library(survival)
bc <- read.spss("E:/r/Breast cancer survival agec.sav",
use.value.labels=F, to.data.frame=T)
Insert picture description here
delete missing values, view Data
bc <- na.omit(bc)
head(bc)
This is the data format.
Insert picture description here
We first divide whether there is lymph node metastasis and divide it into two data tables, and then analyze them separately
ln_yesno0<-subset(bc,bc KaTeX parse error: Expected ' EOF', got'#' at position 12: ln_yesno<1)# ̲We tell the subset function to be in l... ln_yesno>
In this way, we get the two classification data sets ln_yesno0 and ln_yesno1, which we can use to perform statistics respectively.
We were divided into three categories, less than 40 years old, 40-60 years old, over 60 years, comparing these three age intervals status progesterone effect on the crowd without lymph node metastasis to death on the outcome of
the first to do a less than 40 In the age-old population, the effect of progesterone status (pr) on death outcome in people without lymph node metastasis.
Establish a model
f.age1 <- glm(status ~ pr, family = binomial(link = "logit"), data = ln_yesno0,subset = (age<=40)) The
model analysis
summary(f.age1)
Insert picture description here
has obtained the P value and standard error, and the table can be made. If you require a little higher, you can continue to find 95% CI and OR (see me (Original post)
Let’s look at the effect of progesterone status (pr) on death outcome in people with lymph node metastasis among people younger than 40 years old (note that a data set will be changed here)
f.age2<- glm(status ~ pr , family = binomial(link = “logit”), data = ln_yesno1, subset = (age<=40))
Insert picture description here
Let’s do another one. Among people younger than 40-60 years old, the progesterone status (pr) is the death of people without lymph node metastasis The impact of the outcome
f.age3 <- glm(status ~ pr, family = binomial(link = “logit”), data = ln_yesno0,subset = (age>40 & age<=60))
Let's do another one for people younger than 40-60 years old, the effect of progesterone status (pr) on death outcome in people with lymph node metastasis (change the data set)
f.age4 <- glm(status ~ pr, family = binomial(link = "Logit"), data = ln_yesno0,subset = (age>40 & age<=60)) In
Insert picture description here
this way, all the data in the table can be made one by one. In fact, the code and the original many are duplicates, and it is not difficult to do. But your thoughts must be clear and understand how it is made. We have made most of the single factor tables, and we will continue to introduce how to make SCI multi-factor tables next time.
Insert picture description here

Guess you like

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