Key concepts of event occurrence
Investigating event occurrence
The life table
Hazard and survival functions
Quiz
Quiz 1
100 attempts allowed
Discrete-time hazard models
Modelling discrete-time hazard
The proportionality assumption
Example: web survey breakoffs
Quiz
Quiz 2
100 attempts allowed
Practical
Solution
Continuous-time survival models
Continuous time and the Kaplan-Meier method
The Cox model
Testing proportional hazards
Discrete or continuous time?
Quiz
Quiz 3
100 attempts allowed
Practical
Solution
Further reading
Course forum
Make the course better
References
Survival Analysis
Model the Occurrence and Timing of Events in Longitudinal Data Using R
In this course, you will learn how to handle censoring, build life tables, estimate discrete-time hazard models, Kaplan-Meier curves, and Cox regression. By the end, you will be able to explain the occurrence and timing of events with time-constant and time-varying predictors and test the proportionality assumptions behind your models.
Minimum price
$200
$200
You pay
Author earns
About
About the Course
Many questions we ask with longitudinal data concern events. Do people experience an event, such as finding a partner, leaving a job, or dropping out of a study? When does it happen? And what explains who experiences the event and when? Survival analysis, also known as event history analysis, is the set of methods developed to answer these questions.
Analyzing events is difficult because of censoring. In most studies, some people have not experienced the event by the time the study ends, while others leave before we can observe it. If we simply drop these cases, the results are biased towards the people who experience the event quickly.
This course will teach you how to analyze the occurrence and timing of events using R, from the life table to discrete-time hazard models and Cox regression.
The course starts with the main concepts: censoring, life tables, and hazard and survival functions. It then moves to discrete-time hazard models, which treat time in waves, years, or grades and can be estimated as logistic regressions on person-period data. Finally, it covers continuous-time methods, the Kaplan-Meier estimator and the Cox model, and how to test the proportionality assumptions behind both model types. In the process, you will learn to use the survival package, glm(), and the tidyverse to estimate, visualize, and interpret these models.
What You Will Learn
Key concepts of event occurrence
Before modeling events, we need to define exactly what we are studying and how to handle people for whom we never see the event.
In this section, you will learn the main concepts behind survival analysis, including:
- The three pieces of information every analysis needs: the target event, the beginning of time, and the metric for clocking time
- Right and left censoring, and why dropping censored cases biases the results
- How to build and read a life table: the risk set, the events, the censored cases and the hazard
- The hazard and survival functions, and how to read the median lifetime from the survival curve
- How to compare hazard and survival curves between groups
Discrete-time hazard models
In panel studies, time is usually measured in waves, years, or school grades, so we only know the period in which an event happened.
In this section, you will learn how to:
- Move from hazards to odds and logit hazards, and why we model the hazard on the logit scale
- Estimate discrete-time hazard models using logistic regressions
- Turn the estimated coefficients into fitted hazard and survival curves
- Include time-constant and time-varying predictors
- Test the proportionality assumption and relax it using interactions with time
Continuous-time survival models
When time is measured precisely, for example in days, very few people share the same event time and the life table no longer works.
In this section, you will learn how to:
- Explain why the hazard becomes a rate in continuous time
- Estimate and plot Kaplan-Meier survival curves and compare them between groups
- Prepare survival data with Surv() and fit Cox regression models with coxph()
- Interpret hazard ratios
- Test the proportional hazards assumption with cox.zph() and residual plots
- Relax the assumption using stratification
Learn by doing with real longitudinal data
The course combines videos, written explanations, quizzes, and hands-on practical exercises so you learn by applying the techniques directly. You will also gain access to a forum to ask questions related to the topics covered in the class.
In the first practical, you will use 15 waves of a synthetic extract of the British Household Panel Survey (BHPS) to study how long it takes people who are single to find a partner. You will create the event, time, and censoring variables, build a life table, and code the risk set. You will then compare discrete-time hazard models with different ways of modeling time and with predictors such as gender, age, and income. In the second practical, you will use the re-arrest data from Singer and Willett’s Applied Longitudinal Data Analysis. You will estimate Kaplan-Meier curves and Cox models and test the proportional hazards assumption. A bonus section introduces recurrent events, using a clinical trial dataset that comes with the survival package.
The practicals include:
- Exercises with activities and questions to answer
- Full solution code with answers to all questions
- Detailed walkthrough videos
By the end of the course, you will have a complete workflow for analyzing time-to-event data in R that you can adapt to your own datasets.
Who this course is for
This course is designed for researchers who want to study the occurrence and timing of events using R, including:
- PhD students working with longitudinal or event history data
- Social scientists studying life-course transitions, such as partnership, employment, or leaving education, with panel or cohort data
- Survey methodologists and data analysts interested in attrition, dropout, or breakoff
- Researchers who know logistic regression and want to model the time to an event
Prerequisites
You should already be comfortable with:
- Basic R syntax
- Working with data frames
- Basic data manipulation in R
- Regression models, including logistic regression
If you are new to R, consider taking the course Introduction to R for Social Researchers, which provides the foundations needed to follow the workflows taught here. The first practical starts from data in long format and creates the event and time variables. If you want to learn how to merge, reshape, and clean panel data in more depth, take the course Master Longitudinal Data Wrangling using R. If you need a refresher on logistic regression, the chapter on regression models in the book Longitudinal Data Analysis Using R covers it. You do not need to know multilevel or structural equation models to follow this course.
What you will be able to do after this course
After completing the course, you will be able to:
- Define the event, the beginning of time, and the time metric for your own research question
- Handle right censoring and build life tables in R
- Estimate discrete-time hazard models with glm()
- Turn the results of discrete-time models into fitted hazard and survival curves
- Estimate Kaplan-Meier curves and Cox regression models with the survival package
- Interpret odds ratios and hazard ratios
- Test and relax the proportionality assumptions of discrete-time and Cox models
This course is included in this track...
Categories
Instructor
About the Instructor
Alexandru Cernat is a professor in Methodology and Social Data Science at the University of Manchester.
He has a PhD in survey methodology from the University of Essex and was a post-doc at the National Centre for Research Methods and the Cathie Marsh Institute.
His research and teaching focus on: survey methodology, longitudinal data, measurement error, latent variable modelling, new forms of data and missing data.
He is also the founder of longitudinalanalysis.com, a platform that helps researchers and analysts learn to collect, clean, and analyse longitudinal data.
You can find out more about him and his research at: alexcernat.com.
Episode 267
An Interview with Alexandru Cernat
Material
Course Material
The Leanpub 60 Day 100% Happiness Guarantee
Within 60 days of purchase you can get a 100% refund on any Leanpub purchase, in two clicks.
See full terms...
Earn $8 on a $10 Purchase, and $16 on a $20 Purchase
We pay 80% royalties on purchases of $7.99 or more, and 80% royalties minus a 50 cent flat fee on purchases between $0.99 and $7.98. You earn $8 on a $10 sale, and $16 on a $20 sale. So, if we sell 5000 non-refunded copies of your book for $20, you'll earn $80,000.
(Yes, some authors have already earned much more than that on Leanpub.)
Learn more about writing on Leanpub
Free Updates. DRM Free.
If you buy a Leanpub book, you get free updates for as long as the author updates the book! Many authors use Leanpub to publish their books in-progress, while they are writing them. All readers get free updates, regardless of when they bought the book or how much they paid (including free).
Most Leanpub books are available in PDF (for computers) and EPUB (for phones, tablets and Kindle). The formats that a book includes are shown at the top right corner of this page.
Finally, Leanpub books don't have any DRM copy-protection nonsense, so you can easily read them on any supported device.
Learn more about Leanpub's ebook formats and where to read them
Write and Publish on Leanpub
You can use Leanpub to easily write, publish and sell in-progress and completed ebooks and online courses!
Leanpub is a powerful platform for serious authors, combining a simple, elegant writing and publishing workflow with a store focused on selling in-progress ebooks.
Leanpub is a magical typewriter for authors: just write in plain text, and to publish your ebook, just click a button. (Or, if you are producing your ebook your own way, you can even upload your own PDF and/or EPUB files and then publish with one click!) It really is that easy.
