- Real cancer patient data from medical studies
- Survival analysis using actual patient outcomes
- How tumor characteristics relate to diagnosis
- Statistical methods used in cancer research
Using data from the North Central Cancer Treatment Group study:
Let’s explore what affects patient survival
In cancer research, survival probability over time is often calculated using the formula:
\[S(t) = P(T > t)\]
Where \(S(t)\) is the probability of surviving beyond time \(t\).
The hazard function represents instantaneous risk:
\[h(t) = \lim_{\Delta t \to 0} \frac{P(t \leq T < t + \Delta t | T \geq t)}{\Delta t}\]
Hazard function (in simple terms):: If you’ve survived until day \(t\), what’s your risk of dying right now?
Research Question: Do males and females have different survival rates?
\[H_0: S_{male}(t) = S_{female}(t)\] \[H_1: S_{male}(t) \neq S_{female}(t)\]
We use the log-rank test to compare survival curves:
Result: p-value = 0.0013
At α = 0.05, we reject the null hypothesis.
Here’s the code for the survival analysis plot (slide 6):
library(survival)
# Load lung cancer data
data(cancer)
lung <- cancer
# Create survival object and fit
surv_obj <- Surv(lung$time, lung$status == 2)
fit <- survfit(surv_obj ~ 1, data = lung)
# Extract survival data for plotting
surv_data <- data.frame(
time = fit$time,
surv = fit$surv,
upper = fit$upper,
lower = fit$lower
)
ggplot(surv_data, aes(x = time, y = surv)) +
geom_line(color = "#8C1D40", size = 1.2) +
geom_ribbon(aes(ymin = lower, ymax = upper), alpha = 0.2, fill = "#8C1D40") +
labs(title = "Overall Survival Curve for Lung Cancer Patients",
x = "Time (days)",
y = "Survival Probability") +
theme_minimal() +
ylim(0, 1)
Important: These analyses use real patient data to advance cancer research and improve care.
Datasets Used:
survival::cancer (Loprinzi et al., 1994)MASS::biopsy (Wisconsin Diagnostic Breast Cancer)