Posts

Showing posts from November 24, 2018

R draw survival curve and calculate P-value at specific times

Image
up vote 2 down vote favorite 1 I am trying to figure out how to generate a survival curve and calculate P-value of a specific time point and not of the entire survival curve. I use the surv and survfit methods from packages survminer , survival to create the survival object and ggsurvplot to draw the curve and it's p-value. df_surv <- Surv(time = df$diff_in_days, event = df$survivalstat) df_survfit <- survfit(dat_surv ~ Schedule, data = df) ggsurvplot( df_survfit , data = df, pval = TRUE ) Now it calculates the p-value over the entire curve of 2500+ days. I would also like to calculate the P-value at exact intervals. Let's say I would like to know the survival probability at / up-to 365 days. I can't simply cut-off all records which have survival times longer than x (e.g. 365) days, as bel...