R Tutorial : Why do we need special methods for time-to-event data?

Survival analysis needs special methods because event times are always positive, censoring hides some outcomes, and we care about different functions than standard statistics. Learn how to represent time-to-event data in R using the Surv object and the survival package.
Chapters
In this lesson we will discuss why we need special methods for survival analysis. Why can't I just compute a linear model? The first important point of why we need particular methods for survival analysis is the fact that duration times are always positive, so we need to work with distributions that can handle positive outcomes. The linear model, for example, assumes a normal distribution which is not very appropriate for positive outcomes. A common distribution to model duration times is the Weibull distribution, and the corresponding model is called the Weibull model, which we will discuss later in this course. Historically, in survival analysis, the survival function has been a measure of interest. We will learn about the survival function in the next lesson. There are some other measures that are more interest in survival analysis than in other areas, like for example, the hazard function. The last point why we need special methods for survival analysis is probably the most censoring. In the example shown here, we know that for individual 1, the event happened at time point 5. Of individual 2, we only know that the event did not happen until time point six, but we have no knowledge about what happened after that. Let's think about the cab example again. Each day you call a cab and want to analyze how long it takes them to arrive at your house. The cab on day one arrives at your house after five minutes. Cab two doesn't arrive until time point six and you get annoyed and decide to walk instead. That leads to you never observing when the cab actually arrives. On day three, the cab does not arrive in the first two minutes, but then you fall asleep and never observe what happened. The caps on days four and five arrive after four minutes. The type of censoring shown here is called right censoring and the most common type of censoring in survival analysis. There exist two other types of left and interval censoring which we will not cover in this course. When working with write sensor time to event data, we need to specify this appropriate lienr. In our example we have times 5, 6, 2, 4, and 4. The event indicator is 1 if the event happened and 0 otherwise. This means the two censored individuals 2 and 3 have a value of 0. With the R package survival, we can specify that the variables time and event belong together. We do this using a serve object created with the serve function. We will also call this a survival object. In one of the upcoming exercises, we will take a look at the serve object more deeply and see what it looks like in the GBSG2 dataset. But speaking of R packages, I haven't told you about the R packages we will be using in this course yet, aside from the packages which store the datasets, we will focus on two packages during this course. Most importantly, we will use the Survival package. It provides all functionality for basic survival analysis and is a very wide, widely used R package. The Survival package allows the user not only to do survival analysis, but also to visualize the results. Additional to the plotting features in the Survival package, we will be using the surfminder package for more advanced visualizations. We will focus on interpreting visualizations in this course since we will skip the mathematically more advanced interpretation of the model effect estimates. Now, let's.
More from Richie

#359 My Best Friend is AI with Valerie Tiberius, Professor of Philosophy at University of Minnesota

How AI Agents Will Work While You Sleep | Ruslan Salakhutdinov, Professor at Carnegie Mellon

#358 How AI Agents Will Work While You Sleep | Ruslan Salakhutdinov, Professor at Carnegie Mellon







