Skip to content

Problems with survival analysis data #319

Answered by lishensuo
ghost asked this question in Q&A
Discussion options

You must be logged in to vote

The tcga_surv_plot() function is utilized to perform KM (Kaplan-Meier) survival analysis based on log-rank test and the model is different with Cox regression model. You can manually calculate the p.value of KM analysis after getting data_surv data.frame.

data_surv <- data_surv %>%
  dplyr::arrange(.data$value) %>%
  dplyr::mutate(per_rank = 100 / nrow(.) * (1:nrow(.)))
## dividing into two groups as the 'group' column
cutpoint = c(50, 50)
data_surv <- data_surv %>%
  dplyr::mutate(group = dplyr::case_when(
    .data$per_rank > !!cutpoint[2] ~ "High",
    .data$per_rank <= !!cutpoint[1] ~ "Low",
    TRUE ~ NA_character_
  ))

surv_diff <- survdiff(Surv(OS.time, OS) ~ group, data = data_surv

Replies: 1 comment 3 replies

Comment options

You must be logged in to vote
3 replies
@ghost
Comment options

@lishensuo
Comment options

Answer selected by ShixiangWang
@ghost
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants