LoslegenKostenlos loslegen

Estimating the survival curve with survreg()

We can now estimate the survival of the breast cancer patients in the GBSG2 data using a Weibull model.

The Weibull distribution has two parameters, which determine the form of the survival curve.

The survival package and the GBSG2 data are loaded for you in this exercise.

Diese Übung ist Teil des Kurses

Survival Analysis in R

Kurs anzeigen

Anleitung zur Übung

  • Estimate a Weibull model for the breast cancer patients.
  • Compute the estimated survival curve from the model using the predict() function with type = "quantile".
  • Create a data.frame with the time points and corresponding survival probabilities.
  • Look at the first few lines of the result using the function head().

Interaktive Übung

Vervollständige den Beispielcode, um diese Übung erfolgreich abzuschließen.

# Weibull model
wb <- ___(___(___, ___) ~ ___, data = ___)

# Retrieve survival curve from model probabilities 
surv <- seq(.99, .01, by = -.01)

# Get time for each probability
t <- predict(___, type = ___, p = ___, newdata = data.frame(1))

# Create data frame with the information
surv_wb <- data.frame(time = ___, surv = ___)

# Look at first few lines of the result
head(___)
Code bearbeiten und ausführen