From 42aec82e3676cd93fa2ec82a1f6ea8dd1654ae2e Mon Sep 17 00:00:00 2001 From: Jens Sauer Date: Thu, 22 Oct 2020 16:38:39 +0200 Subject: [PATCH] survival: Change scaling to days per year The base data was changed from month to years for more precision. Therefor the scaling of the graphs must be adjusted to days per year instead of month per year. --- survival.R | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/survival.R b/survival.R index e5ab0aa..451816f 100644 --- a/survival.R +++ b/survival.R @@ -13,13 +13,13 @@ surv_asct <- Surv(time = secmal$event_time_asct, event = secmal$event_status) # plot survival after diagnosis # scaled to years png(filename = "survival_dx.png", width = 3000, height = 3000, res = 300) -plot(survfit(surv_dx ~ 1), mark.time = TRUE, xscale = 12, xlab = "Years", ylab = "Survival") +plot(survfit(surv_dx ~ 1), mark.time = TRUE, xscale = 365.25, xlab = "Years", ylab = "Survival") title("Kaplan-Meier estimate for\nsecMalASCT study", "Survival after diagnosis") dev.off() # One graph per sex png(filename = "survival_dx_sex.png", width = 3000, height = 3000, res = 300) -plot(survfit(surv_dx ~ sex, data = secmal), mark.time = TRUE, xscale = 12, xlab = "Years", ylab = "Survival", lty = 2:3) +plot(survfit(surv_dx ~ sex, data = secmal), mark.time = TRUE, xscale = 365.25, xlab = "Years", ylab = "Survival", lty = 2:3) title("Kaplan-Meier estimate for\nsecMalASCT study", "Survival after diagnosis") legend(100, .9, c("Female", "Male"), lty = 2:3) dev.off() @@ -27,13 +27,13 @@ dev.off() # plot survival after diagnosis # scaled to years png(file = "survival_asct.png", width = 3000, height = 3000, res = 300) -plot(survfit(surv_asct ~ 1), mark.time = TRUE, xscale = 12, xlab = "Years", ylab = "Survival") +plot(survfit(surv_asct ~ 1), mark.time = TRUE, xscale = 365.25, xlab = "Years", ylab = "Survival") title("Kaplan-Meier estimate for\nsecMalASCT study", "Survival after transplantation") dev.off() # One graph per sex png(filename = "survival_asct_sex.png", width = 3000, height = 3000, res = 300) -plot(survfit(surv_asct ~ sex, data = secmal), mark.time = TRUE, xscale = 12, xlab = "Years", ylab = "Survival", lty = 2:3) +plot(survfit(surv_asct ~ sex, data = secmal), mark.time = TRUE, xscale = 365.25, xlab = "Years", ylab = "Survival", lty = 2:3) title("Kaplan-Meier estimate for\nsecMalASCT study", "Survival after transplantation") legend(100, .9, c("Female", "Male"), lty = 2:3) dev.off()