R Tutorial : Why do we need special methods for time-to-event data?
Key Takeaways
The video discusses the need for special methods in survival analysis, specifically in R, using packages such as survival and survminer, and introduces key concepts like censoring and the survival function.
Full Transcript
in this lesson we will discuss why we need special methods for survival analysis why can't they 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 viable distribution and the corresponding model is called the viable 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 important 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 the time point 6 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 1 arrives at your house after 5 minutes cap 2 doesn't arrive until time point 6 and you get annoyed and decide to walk instead that leads to you never observing when the cab actually arrives on day 3 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 type of censoring shown here is called right censoring and the most common type of censoring and survival analysis they exist two other types of censoring left and interval censoring which we will not cover in this course when working with right sensor time to event data we need to specify this appropriately NR in our example we have times five six two four and for the event indicator is one if the event happened and zero otherwise this means the two censored individuals two and three have a value of zero 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 GBS g2 dataset but speaking of our packages I haven't told you about the air 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 why 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 serve minor 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
Original Description
Want to learn more? Take the full course at https://learn.datacamp.com/courses/survival-analysis-in-r at your own pace. More than a video, you'll learn hands-on coding & quickly apply skills to your daily work.
---
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 survivor function has been a measure of interest. We will learn about the survivor function in the next lesson. There are some other measures that are of more interest in survival analysis than in other areas, like the hazard function.
The last point why we need special methods for survival analysis is probably the most important: 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 6, 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 1 arrives at your house after 5 minutes. Cab 2 doesn't arrive until time point 6 and you get annoyed and decide to walk instead. That leads to you never observing when the cab actually arrives. On day 3 the cab does not arrive in the first two minutes, but then you fall asleep and never observe what happens. The cabs on days 4 and 5 arrive after 4 minutes. This type of censoring is called righ
Watch on YouTube ↗
(saves to browser)
Sign in to unlock AI tutor explanation · ⚡30
Playlist
Uploads from DataCamp · DataCamp · 0 of 60
← Previous
Next →
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
SQL Server Tutorial: Date manipulation
DataCamp
R Tutorial: Intermediate Interactive Data Visualization with plotly in R
DataCamp
R Tutorial: Adding aesthetics to represent a variable
DataCamp
R Tutorial: Moving Beyond Simple Interactivity
DataCamp
Python Tutorial: Why use ML for marketing? Strategies and use cases
DataCamp
Python Tutorial: Preparation for modeling
DataCamp
Python Tutorial: Machine Learning modeling steps
DataCamp
R Tutorial: The prior model
DataCamp
R Tutorial: Data & the likelihood
DataCamp
R Tutorial: The posterior model
DataCamp
R Tutorial: An Introduction to plotly
DataCamp
R Tutorial: Plotting a single variable
DataCamp
R Tutorial: Bivariate graphics
DataCamp
Python Tutorial: Customer Segmentation in Python
DataCamp
Python Tutorial: Time cohorts
DataCamp
Python Tutorial: Calculate cohort metrics
DataCamp
Python Tutorial: Cohort analysis visualization
DataCamp
R Tutorial: Building Dashboards with flexdashboard
DataCamp
R Tutorial: Anatomy of a flexdashboard
DataCamp
R Tutorial: Layout basics
DataCamp
R Tutorial: Advanced layouts
DataCamp
Python Tutorial: Time Series Analysis in Python
DataCamp
Python Tutorial: Correlation of Two Time Series
DataCamp
Python Tutorial: Simple Linear Regressions
DataCamp
Python Tutorial: Autocorrelation
DataCamp
R Tutorial: The gapminder dataset
DataCamp
R Tutorial: The filter verb
DataCamp
R Tutorial: The arrange verb
DataCamp
R Tutorial: The mutate verb
DataCamp
R Tutorial: What is cluster analysis?
DataCamp
R Tutorial: Distance between two observations
DataCamp
R Tutorial: The importance of scale
DataCamp
R Tutorial: Measuring distance for categorical data
DataCamp
Python Tutorial: Plotting multiple graphs
DataCamp
Python Tutorial: Customizing axes
DataCamp
Python Tutorial: Legends, annotations, & styles
DataCamp
Python Tutorial: Introduction to iterators
DataCamp
Python Tutorial: Playing with iterators
DataCamp
Python Tutorial: Using iterators to load large files into memory
DataCamp
SQL Tutorial: Introduction to Relational Databases in SQL
DataCamp
SQL Tutorial: Tables: At the core of every database
DataCamp
SQL Tutorial: Update your database as the structure changes
DataCamp
Python Tutorial: Classification-Tree Learning
DataCamp
Python Tutorial: Decision-Tree for Classification
DataCamp
Python Tutorial: Decision-Tree for Regression
DataCamp
Python Tutorial: Census Subject Tables
DataCamp
Python Tutorial: Census Geography
DataCamp
Python Tutorial: Using the Census API
DataCamp
R Tutorial: A/B Testing in R
DataCamp
R Tutorial: Baseline Conversion Rates
DataCamp
R Tutorial: Designing an Experiment - Power Analysis
DataCamp
R Tutorial: Introduction to qualitative data
DataCamp
R Tutorial: Understanding your qualitative variables
DataCamp
R Tutorial: Making Better Plots
DataCamp
SQL Tutorial: OLTP and OLAP
DataCamp
SQL Tutorial: Storing data
DataCamp
SQL Tutorial: Database design
DataCamp
Python Tutorial: Introduction to spaCy
DataCamp
Python Tutorial: Statistical Models
DataCamp
Python Tutorial: Rule-based Matching
DataCamp
More on: Data Literacy
View skill →Related Reads
📰
📰
📰
📰
Boost Your Productivity: Atlassian's AI-Powered Jira Revolution
Dev.to · Dave Kurian
Selecting Your AI Tool Stack: A Three‑Layer Framework for Solo Travel Consultants
Dev.to AI
How to prepare TIC teacher exams in Spain with AI (oposiciones 2026)
Dev.to AI
AI Tools that Actually Pay You Back: A Developer's Guide to Monetizing AI
Dev.to AI
🎓
Tutor Explanation
DeepCamp AI