Learning Outcomes
By the end of this section, students will be able to:
- Describe the characteristics of survival data
- Set up your software programme to analyse survival data
Video C2.1- Introduction to Survival Data (10 minutes)
C2.1a PRACTICAL: Stata
Setting up survival data
The command ‘stset’ needs to be specified first. This command tells Stata you are analysing survival-time data, and you therefore need to specify the time variable and the variable that defines the event (i.e. failure).
Following the command ‘stset’ comes the name of the “time to event” variable, which is your outcome variable. This is followed by the option which specifies an event [failure()], with 0=censorship. If you do not specify this option, Stata assumes that there is no censoring.
Since we want to look at the event of “death”, and we have followed participants for several years, the following command is used:
stset fu_years, failure(death) id(whl1_id)
Notice the output from Stata. The ‘stset’ command adds four variables to the dataset: “_t” is the time to event variable; “_d” indicates if the participant was censored (0) or had an event (1); “_t0” denotes the beginning of the time variable, with time 0 as default; and “_st” indicates which rows are being used in the analysis, with all coded 1 for default.
Question C2.1a: How many events occurred during the follow up period?
Answer
1,526 deaths
C2.1 PRACTICAL: SPSS
There is no practical material here for SPSS
C2.1 PRACTICAL: R
The command “Surv” is used to create a survival object, which sets up a time to event data structure. When we have only one time period, like in this study, we specify in the form Surv(follow up time, event indicator).
Since we want to look at the event of “death”, and we have followed participants for several years, the following command is used:
Surv(white.data$fu_time, white.data$death)
The output from R is a matrix with two columns – the first is the survival time, and the second an indicator for death or not.
Question C2.1a: How many events occurred during the follow up period?
Answer
1,526 deaths