I have insects that got progressively colder in a cooling bath and were removed one at a time at temperatures ranging from 0 to -35. I made the column removal_temp the absolute value of removal temperature. This way it can function how time normally would in survival models. I checked if they were alive or dead (there were no repeated measured, each insect checked once at just one temperature because we kill them in ATP stain to find out if they...were alive. They're sessile so it has to be this way). If they were alive (death = 0), that would be right-censored data. If they were dead (death = 1), that would be interval-censored data, because they could've died at any sub-zero temperature, not necessarily right when they were checked. I thought I found out how to account for both types of censoring here:
surv_object_interval <- with(insect_data, Surv(start_temp, removal_temp, event = death))
surv_object_interval
the format of the survival object is (0, 35+]; intervals! However, when I produce results and a plot:
km_interval <- survfit(surv_object_interval ~ 1)
summary(km_interval)
ggsurvfit(km_interval) +
labs(x = "Removal Temperature (-°C)", y = "Survival Probability") +
add_confidence_interval()
They are identical to the following, where I don't include start_temp,
surv_object_original <- Surv(insect_data$removal_temp, insect_data$death)
surv_object_original
km_original <- survfit(surv_object_original ~ 1)
summary(km_original)
ggsurvfit(km_original) +
labs(x = "Removal Temperature (-°C)", y = "Survival Probability") +
add_confidence_interval()
How could this be? It can't be that interval censoring is the default, because, if so, how would it know the other boundary of the interval (0)? It must be that I am not getting R to understand my data's censoring. How do I get R to understand that where death = 1 it is interval-censored, and where death = 0 it is right-censored? I have scoured the internet and cannot find anyone who has had this problem. I know there are other packages, other ways, but I've tried to no avail. It must be possible...right?
Here are the packages used and sample data to reproduce the problem:
library(survminer)
library(survival)
#data sample
set.seed(1738)
n <- 40
removal_temp <- seq(10, 35, length.out = n)
start_temp <- rep(0, n)
death <- c(1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,1,1,1,1,1,0,1,1,0,0,1,0,0,0,0,1,0,0,0,0)
insect_data <- data.frame(removal_temp, start_temp, death)