Survival analysis in R keeps censoring figure with no censored data.
0
0
Entering edit mode
6 months ago
mgranada3 ▴ 30

I am following THIS guide on how to create a survival analysis in R.

The instructions say, "Each row is a subject. An event (death) is indicated if the variable outcome is 1, in which case time indicates the time of death. An outcome of 0 refers to no event (censored data), in which case time is the time of censoring.".

However, I have datasets which have no censored rows as all events were deaths but when I produce my figure my samples are shaded as if censored.

Example of 2 samples which contain all deaths and no censored events.

This is the code I have been running:

#TWO GROUP KAPLAN-MEIER CURVE
#read in file
ATCC <- read.csv("ATCCsample.csv")
head(ATCC )

#Surv beeded to convert the data to a format used by package
ATCCSurv <- Surv(time = ATCC$OverallSurvivalDays, event = ATCC$status)
#Survfit used to calculate survival curve
ATCCKM <- survfit(ATCCSurv ~ Subtype, data = ATCC , type="kaplan-meier") 

#plot curve
ggsurvplot(ATCCKM, conf.int = TRUE, pval = FALSE, risk.table = FALSE,
  legend.labs=c("ATCC  1", "ATCC  2"), 
  legend.title = "Subtype",
  censor.shape = "|", censor.size = 4,
  palette=c("firebrick", "goldenrod1"), 
  xlab = "Time since inoculation (days)",
  ylab = "Proportion surviving")

I have tried playing around with the "censor.size" but it doesn't look any different whether I change it to 0 or 20. It produces the same figure.

Is there something wrong with the code I am using? In THIS data set, each row only has a 1, and those still alive by day 7 I left blank (did not input 1 or 0).

R survival-analysis censor • 385 views
ADD COMMENT

Login before adding your answer.

Traffic: 2695 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6