BaşlayınÜcretsiz Başlayın

First Kaplan-Meier estimate

In this exercise, we will use the same data shown in the video. We will take a look at the survfit() function and the object it generates. This exercise will help you explore the survfit object.

The survival package is loaded for you in this exercise.

Bu egzersiz

Survival Analysis in R

kursunun bir parçasıdır
Kursu Görüntüle

Egzersiz talimatları

  • Explore the use of the survfit() function by entering ?survfit in the console.
  • Compute the Kaplan-Meier estimate using survfit().
  • Take a look at the structure of the survfit object using str().
  • Create a data.frame with the four time points, the corresponding number at risk (n.risk), number of observations with an event (n.event), number of observations censored (n.censor) and the value of the survival curve (surv). Take all info from the survfit object.

Uygulamalı interaktif egzersiz

Bu örnek kodu tamamlayarak bu egzersizi bitirin.

# Create time and event data
time <- c(5, 6, 2, 4, 4)
event <- c(1, 0, 0, 1, 1)

# Compute Kaplan-Meier estimate
km <- survfit(___(___, ___) ~ ___)
km

# Take a look at the structure
str(___)

# Create data.frame
data.frame(time = km$time, n.risk = ____, n.event = ____,
  n.censor = ____, surv = ___)
Kodu Düzenle ve Çalıştır