-
Notifications
You must be signed in to change notification settings - Fork 1
/
BOMI1_2_OS_survival_Final.Rmd
executable file
·84 lines (65 loc) · 2.45 KB
/
BOMI1_2_OS_survival_Final.Rmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
---
title: "BOMI2_BOMI1_survival"
output:
html_document:
fig_height: 7
fig_width: 10
theme: cosmo
---
```{r load libs, message=FALSE, warning=FALSE, include=FALSE}
library(tidyverse)
library(readr)
library(readxl)
library(survival)
library(survminer)
library(ggthemes)
```
```{r import, echo=FALSE}
# Set sheet = 1 for BOMI2 and sheet = 2 for BOMI1
crc <- read_excel ("data/BOMI2_BOMI1_data_Final.xlsx", sheet=1)
```
## Univariate Cox - OS
```{r univariate cox, echo=FALSE, fig.height=6, fig.width=8}
crc <- mutate(crc, variable = factor(CAF7_PDGFRAnegPDGFRBposFAPposSMAposPanEpiMaskNeg_LowQuart))
crc_cox <- coxph(Surv(OS_Time, OS_Status) ~ variable , data = filter(crc))
summary(crc_cox)
km_plot<-survfit(Surv(OS_Time, OS_Status) ~ variable , data = filter(crc))
(p <- ggsurvplot( km_plot,
legend = "right",
size = 1.5,
censor.size = 9,
pval.size = 7,
font.legend = c(20,"plain","black"),
font.x.title = c(20,"plain","black"),
font.y.title = c(20,"plain","black"),
font.x = c(20, "plain", "black"),
font.y = c(20, "plain", "black"),
font.xtickslab = c(20, "plain", "black"),
font.ytickslab = c(20, "plain", "black"),
conf.int = FALSE,
pval= TRUE,
ggtheme = theme_par() ))
```
## Multivariate Cox - OS
```{r multivariate cox, echo=FALSE, fig.height=7, fig.width=8}
crc <- crc %>%
mutate(Adeno1 = ifelse(is.na(Adeno1_Squamous2_rest3), NA,
ifelse(Adeno1_Squamous2_rest3 == 1, 1, 0)),
Squamous2 = ifelse(is.na(Adeno1_Squamous2_rest3), NA,
ifelse(Adeno1_Squamous2_rest3 == 2, 1, 0)),
rest3 = ifelse(is.na(Adeno1_Squamous2_rest3), NA,
ifelse(Adeno1_Squamous2_rest3 == 3, 1, 0))
)
crc_cox <- coxph(Surv(OS_Time, OS_Status) ~ variable
+ Gender + Age67 + PS_WHO + CAF13_PDGFRAposPDGFRBposFAPnegSMAposPanEpiMaskneg_HighQuart,
data = filter(crc))
summary(crc_cox)
# ci.exp(crc_cox)
#ggforest(crc_cox, data = crc)
```
## Test for PH assumption
There's a problem if some of the p-values below is less than 0.05.
```{r validate cox, echo=FALSE}
(validate_cox = cox.zph(crc_cox))
ggcoxzph(validate_cox)
```