Skip to content
ImagineWorld

Survival Analysis

node_idnode-book_building-statistical-models-in-python_chapter-13-survival-analysis
node_typechapter-node
schema_profileworld.chapter_node.v1
statusactive
entropyhigh
manifoldworld
domainimagineworld.net
authorityinforms
layercorpus
chapter_num13
chapter_titleSurvival Analysis
governed_byCORPUS
constitutional_citationCONSTITUTION
local graph

In this short chapter, we will introduce another branch of statistics called survival analysis, which is related to survival and time-censoring studies. Survival analysis is also called time-to-event variable analysis, which is a particular statistical outcome type that requires other techniques than those used in the few last chapters that we have studied. A time-to-event variable analysis studies, for example, whether a participant has an event of interest during the study timeframe. In other words, we study the proportion of a sample surviving after a specific time point and the rate at which the survived sample proportion will fail or die, or whether there are survival differences in different treatment groups. The term survival in survival analysis is originally based on the time from treatment until death in the medical field. However, survival analysis is readily applicable to many fields including engineering (where it is referred to as reliability theory or reliability analysis), sociology (event history analysis), and economics (duration analysis). Survival studies might not be ambiguous in medical research when a death occurs, although some events such as organ failure can be poorly defined. Ambiguity does occur in other research fields, however: for instance, in engineering, a failure or a broken system can be partial or not strictly determined by time. We also examine survival data, the survival function, hazard, and hazard ratios in this chapter.

In this chapter, we’re going to cover the following main topics:

  • Censoring
  • Survival data
  • The survival function, hazard, and hazard ratios

In the field of statistics, Censoring refers to a situation where the full extent or precise value of a measurement or observation is not entirely known. In Survival Analysis, this happens when we have information about sample observations and do not know when the given event happened, and is considered a key issue in survival analysis, distinguishing time-to-event analysis from the other statistical analyses mentioned in the previous chapters. There are several reasons why censoring happens; for example, a person withdraws from a study or exits prior to a follow-up, or the event in question has already happened before the study starts. The censored event is non-informative, that is, censoring causes study failure due to some reason other than failure time. In other words, failure caused by censoring is not related to the probability of an event occurring. Informative censoring happens when an observation is lost to follow-up because of research reasons. Three types of informative censoring are right censoring, left censoring, and interval censoring. In this book, we focus on non-informative right censoring.

When we know the event has happened before the observation data is collected, then the observation is left-censored. An example left-censored scenario is where we study the age when a middle-school student begins puberty. There may be some students reaching this developmental stage before they enter middle school. All of these students are considered left-censored. As another example, consider an HIV study for an at-risk group of patients where, by the time the study starts, some patients already have HIV.

When the event happens after some time point but we do not know the exact time, then it is considered right-censored. Applying the previous scenario here, imagine there are some students who withdraw from the puberty developmental stage study, or we lose them prior to following up (for example, they move to another school) or they have a delayed puberty (the developmental stage had still not taken place by the time they left middle school to begin high school). Another example is a cancer study where a group of patients is recruited for a clinical trial to see how a new treatment affects them, but a patient in the group dies because of a car accident after 2 years. In that case, we know this patient’s survival is at least 2 years during the period of the study, but do not know how many years beyond 2 that this patient could have survived with the cancer diagnosis.

Left censoring and right censoring are special cases of interval censoring. A clear example to illustrate interval censoring is a patient that tests negatively at time for HIV but positively at time. However, we do not know the exact time this patient got infected between time interval This particular patient had an annual checkup last year and again this year. The lab results show he was HIV-negative last year but HIV-positive this year. Therefore, the infection occurred at some time point between last year’s and this year’s checkups, but we do not know exactly when.

There are two types of right censoring: Type I censoring and Type II censoring. In Type I censoring, a study is designed to terminate after some time point. Fixed censoring occurs when an object does not have an event after time. This object is considered censored at time. Random censoring occurs when censored objects do not have the same censoring time. In Type II censoring, a study terminates after some prespecified number of events occur. This type of censoring is frequently used in life testing experiments to save time and money. For example, we randomly select objects as a sample to test whether a new innovation is really effective, but instead of testing all these objects, we define that the study terminates if failures occur to save time and costs. In this case, the first objects have events at time but the remaining objects do not have an event at time and they are therefore considered censored.

Let us visualize a cancer study for a period of 5 years testing a new treatment. The start time point is 0 when the study starts, and the end time point is 5 when the study ends.

Figure 13.1 – Right censoring in survival analysis for a cancer study

The first patient was recruited at the beginning of the study, but he died in year 2-and-a-half. The second patient was also recruited at the beginning of the study but in year 5, he was still surviving. This patient has survived for more than 5 years, but we do not know for how many years he can ultimately survive, which means that right censoring occurred with this patient. The third patient was recruited in year 1 but she died in year 4. The fourth patient joined the study in year 2 but by year 4, we were unable to follow up with this patient. The reason could be that he moved to another city, for instance. Censoring occurs for patient 2 and patient 4.

The study seems like a regression problem but in this example, the second patient was considered to have survived when the study concluded. This makes survival analysis different from regular statistical analyses. We also do not remove the data of the second patient from the study data since the information is valuable: patients can survive for at least 5 years. In addition, patient follow-ups can be prevented because they may move to another place or are very sick but instead of removing the data, we record the reason why they dropped out of the study. Similarly, gender considerations can be biased because, for example, male patients may be more likely to withdraw from the study than female patients when they are sick, thus resulting in a potentially incorrect conclusion that females survive longer than males.

Survival data focuses on whether or not an object in a study experiences an event. In addition, the follow-up time is also considered. Time zero or time origin is the time when the study starts. Depending on the purpose of a study, time zero or time origin can be different. For instance, in a prostate cancer study, researchers recruit 40-year-old and older male participants, but in a study of puberty developmental ages, male and female teenagers of 12 and older are recruited. If the research takes place over a period of time (which could be several months or years) then recording the time origin and follow-up time during the study is vitally important.

Lastly, we discuss the relationship between survival and censoring times and how we record survival data with censoring. Suppose that for each object in a sample, we know its true event time and true censoring time Then, the survival time of an object is the period of time until an event occurs and the censoring time of an object is the moment when censoring occurs, when, for example, the study ends or we are unable to follow up on this object. Let denote the status indicator for the object:

In other words, when the event occurs before censoring and when the event occurs after censoring. The observed outcome variable is

and the censored survival data for object can be captured as

The following example considers three patients in a cancer study. Time is considered here in years and the duration of the study is 5 years.

PatientTC
13 (the patient died in year 3)No censoring – patient died in year 31 (because the event was observed)
27 (the patient died in year 7 but the study ended in year 5)5 (the study ends in year 5)0 (because the censoring was observed)
3No information4 (the patient dropped out of the study)0 (because the censoring was observed)

Figure 13.2 – Survival analysis for a cancer study

The following figure illustrates information about 3 patients in the cancer study.

Figure 13.3 – Survival analysis for a cancer study

Survival Function, Hazard and Hazard Ratio

Section titled “Survival Function, Hazard and Hazard Ratio”

Let us first discuss the survival function. The formula of the function is defined as

and represents the probability that the object survives past time. The survival function is a non-increasing function with t ranges from 0 to. When and when It is a smooth function theoretically but practically, events occur on a discrete time scale (days, weeks, years).

Figure 13.4 – Survival function illustrated

In this example, we go back to the cancer study that spanned 5 years. At time zero, when the study started, the survival probability was 1 or 100% but at year 5, the probability of survival was close to 0.2 or 20%.

Now we consider the Stanford heart transplant dataset. The dataset contains the information of 103 patients who participated in an experimental heart transplant program (see Figure 13*.5*). The patients were seriously ill and had the potential to obtain some benefit from being part of the program, as they could be waiting anywhere from a few weeks to several months to receive a new heart from a donor. The CSV dataset can be downloaded at https://www.openintro.org/data/csv/heart_transplant.csv.

Figure 13.5 – First five rows of Stanford translant data

We are interested in two features here: survived (recording the survival status of dead versus alive) and survtime (the number of days the patients survived after they were determined to be a candidate for a heart transplant until the study ended). When we sort the data by survtime, among the first 15 observations, the patient in row 13 is still alive as shown in Figure 13*.6*. Therefore, the observation at row number 13 is time censored.

Figure 13.6 – Status of first 15 transplant patients

In this example, to calculate the probability of survival beyond survtime = 3, we just need to calculate the probability of survival in each interval of time, which is calculated by

where

then

Next, we discuss hazard function or hazard rate. The hazard function is defined as

,

t he instantaneous rate at which events occur given survival up to that time. In other words, it is just the probability of dying in the next few seconds or the next day given being alive now. The hazard ratio is a ratio of death probabilities. For example, when a hazard ratio is 3, then the given group has 3 times the chance of dying compared to another group.

In this chapter, we provided an overview of time-to-event variable analysis and how it differs from other statistical analyses that we have studied in the previous chapters. We covered censoring intuition (left, right, and interval censoring) and discussed Type I and Type II censoring. We also discussed non-informative and informative events in this chapter. We then discussed survival data and the relationship between survival and censoring times and how we record survival data with censoring. The survival function, hazard, and hazard ratio were also mentioned in the last section of this chapter.

In the next chapter, we will consider the non-parametric Kaplan-Meier model, the parametric exponential model, and also the semiparametric Cox Proportional Hazards model. We will perform real data analysis in Python by applying these models for survival analysis.