Aan de slagGa gratis aan de slag

Visualising a Weibull model

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

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

We will focus now on the last two steps.

The survival, survminer, and reshape2 packages and the GBSG2 data are loaded for you in this exercise. The Weibull model wbmod and the imaginary patient data newdat you already computed are also available.

Deze oefening maakt deel uit van de cursus

Survival Analysis in R

Cursus bekijken

Praktische interactieve oefening

Probeer deze oefening eens door deze voorbeeldcode in te vullen.

# Use cbind() to combine the information in newdat with t
surv_wbmod_wide <- cbind(newdat, t)
  
# Use melt() to bring the data.frame to long format
surv_wbmod <- melt(surv_wbmod_wide, id.vars = c("___", "___"), variable.name = "surv_id", value.name = "___")
Code bewerken en uitvoeren