I am analysing the time to the end of rehabilitation; however, not all patients receive rehabilitation. Therefore, for making Kaplan-Meier curves for the whole study population (including non-receivers), these curves should start below survival 1. For example, if only 70% of patients received rehabilitation, y-axis start value should be 0.7. How to make this trick in R? Would it also be possible to make so that all survival tables take into account the non-receivers?
The following graph isn't ideal, as it shows the event happened for 30% of patients on day 0. This isn't true since they never received rehabilitation.
Generated data and KM curves
library(survival)
library(survminer)
library(tidyverse)
df = tibble(
time = c(0, 0, 0, 40, 50, 60, 70, 100, 100, 100),
status = c(1, 1, 1, 1, 1, 0, 0, 0, 0, 0))
fit <- survfit(Surv(time, status) ~ 1, data = df)
ggsurvplot(fit, data = df)
You could use the argument axes.offset = FALSE
like this:
library(survival)
library(survminer)
library(tidyverse)
df = tibble(
time = c(0, 0, 0, 40, 50, 60, 70, 100, 100, 100),
status = c(1, 1, 1, 1, 1, 0, 0, 0, 0, 0))
fit <- survfit(Surv(time, status) ~ 1, data = df)
ggsurvplot(fit, data = df, axes.offset = FALSE)
Created on 2023-03-14 with reprex v2.0.2