In the previous chapters, we have used R language to analyze a method of making SCI single factor tables. Today we will continue to analyze. In fact, the methods of this classification are similar.
We need to analyze the table first, and look at it. What does it mean? In fact, it is the analysis of the subset through regression analysis to understand the relationship between the variables and the outcome.
Today we will do the influence of whether there is lymph node metastasis on the outcome variable. In the data, ln_yesno means whether the lymph node has metastasis, 0 is No metastasis, 1 means metastasis,
continue to import our original breast cancer data,
library(foreign)
library(survival)
bc <- read.spss("E:/r/Breast cancer survival agec.sav",
use.value. labels=F, to.data.frame=T)
Delete the missing value and view the data
bc <- na.omit(bc)
head(bc)
We divide age into 3 categories, less than 40 years old, 40-60 years old, and greater than 60 years old. Compare those in these three age ranges The impact of population lymph node metastasis on death outcome
Establish model
f.age1 <- glm(status ~ ln_yesno, family = binomial(link = “logit”), data = bc, subset = (age<=40))
Analysis of model
summary( f.age1)
Here is the P value and standard error, continue to calculate 95% CI and OR
exp(confint(f.age1))
exp(coef(f.age1))
Therefore, in people younger than 40 years old, there is lymph node metastasis and no lymph node There is a 15-fold difference in metastatic mortality, which is a very large difference.
Create a table and
continue to count
f.age2 <- glm(status ~ ln_yesno, family = binomial(link = “logit”), data = bc, subset = (age>40 & age<=60) )
summary(f.age2)
exp(confint(f.age2))
exp(coef(f.age2))
Continue to count people
over 60 years old f.age3 <- glm(status ~ ln_yesno, family = binomial(link = “logit”), data = bc,subset = (age>60))
summary(f.age3)
exp(confint (f.age3))
exp(coef(f.age3))
finally builds the table
OK, and the variable of age has been calculated. It can be seen that under 40 years old, the presence or absence of lymph node metastasis has a great impact on the survival outcome. The other variables can be calculated in turn. I want to explain here that this table is different from the previous one. Here we take a subset for analysis. Continuous variables must be converted into categorical variables.