ComenzarEmpieza gratis

Computing the survival curve from a Cox model

In this exercise, we will reproduce the example from the video following the steps:

  • Compute Cox model
  • Decide on "imaginary patients"
  • Compute survival curves
  • Create data.frame with survival curve information
  • Plot

We will focus now on the first three steps in this exercise and do the next two steps in the upcoming exercise.

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

Este ejercicio forma parte del curso

Survival Analysis in R

Ver curso

Ejercicio interactivo práctico

Prueba este ejercicio y completa el código de muestra.

# Cox model
cxmod <- ___(Surv(time, cens) ~ horTh + tsize, data = GBSG2)

# Imaginary patients
newdat <- expand.grid(
  horTh = levels(GBSG2$___),
  tsize = quantile(GBSG2$___, probs = c(0.25, 0.5, 0.75)))
___(newdat) <- letters[1:6]

# Inspect newdat
newdat
Editar y ejecutar código