My survival graph looks weird at the end of the curves.
I checked my data, it has no negative values for the time-to-event variable. Time-to-event variable has values from 0-3266 days. There are no missing values for any columns. yet it produces such a weird graph. I have tried both ‘log’ and ‘log-log’ confidence interval types. I get the following error when I use ‘log-log’ but I get no error when I use ‘log’ confidence interval type, yet I get the same weird survival curve. Is there anything that I should double-check?
Here is my R code snippet:
<code># Filter out rows with missing values in relevant columns
df <- df %>%
filter(!is.na(T2_GI_BLED) & !is.na(POST_GI_BLEEDING) & !is.na(DRUG_GROUP))
# Convert the data to a format used by the survival package
survival_data <- with(df, Surv(T2_GI_BLED, POST_GI_BLEEDING))
# Fit the survival data to a constant for each drug group
survival_fit <- df %>%
group_by(DRUG_GROUP) %>%
do(tidy(survfit(Surv(T2_GI_BLED, POST_GI_BLEEDING) ~ 1, data = .)))
# Calculate the confidence interval for each drug group
survival_ci <- df %>%
group_by(DRUG_GROUP) %>%
do(tidy(survfit(Surv(T2_GI_BLED, POST_GI_BLEEDING) ~ 1, data = ., conf.int = TRUE, conf.type = "log")))
</code>
<code># Filter out rows with missing values in relevant columns
df <- df %>%
filter(!is.na(T2_GI_BLED) & !is.na(POST_GI_BLEEDING) & !is.na(DRUG_GROUP))
# Convert the data to a format used by the survival package
survival_data <- with(df, Surv(T2_GI_BLED, POST_GI_BLEEDING))
# Fit the survival data to a constant for each drug group
survival_fit <- df %>%
group_by(DRUG_GROUP) %>%
do(tidy(survfit(Surv(T2_GI_BLED, POST_GI_BLEEDING) ~ 1, data = .)))
# Calculate the confidence interval for each drug group
survival_ci <- df %>%
group_by(DRUG_GROUP) %>%
do(tidy(survfit(Surv(T2_GI_BLED, POST_GI_BLEEDING) ~ 1, data = ., conf.int = TRUE, conf.type = "log")))
</code>
# Filter out rows with missing values in relevant columns
df <- df %>%
filter(!is.na(T2_GI_BLED) & !is.na(POST_GI_BLEEDING) & !is.na(DRUG_GROUP))
# Convert the data to a format used by the survival package
survival_data <- with(df, Surv(T2_GI_BLED, POST_GI_BLEEDING))
# Fit the survival data to a constant for each drug group
survival_fit <- df %>%
group_by(DRUG_GROUP) %>%
do(tidy(survfit(Surv(T2_GI_BLED, POST_GI_BLEEDING) ~ 1, data = .)))
# Calculate the confidence interval for each drug group
survival_ci <- df %>%
group_by(DRUG_GROUP) %>%
do(tidy(survfit(Surv(T2_GI_BLED, POST_GI_BLEEDING) ~ 1, data = ., conf.int = TRUE, conf.type = "log")))