Data

This page is a reference for several datasets that we use in the course.

Four life outcomes

The file nlsy_outcomes.csv contains data from the NLSY97 cross-sectional sample (excluding oversamples). Each person (indexed by id) has four rows corresponding to four outcomes: high school completion, BA completion, marriage, and first birth.

  • id is the person identifier
  • sex is a covariate from the baseline interview
  • race is a covariate from the baseline interview
  • outcome is the outcome that the row summarizes: educ_hs for high school completion, educ_ba for college, married for first marriage, and parent for first birth
  • time is the age in years at which the outcome occurs, or the unit is censored
  • censored is an indicator variable coded FALSE if the outcome occurs and TRUE if the unit was censored: the last interview happened without the event occurring. For units with censored = TRUE, the time variable is the age at the last interview.
nlsy_outcomes <- read_csv("https://ilundberg.github.io/eventhistory/assets/nlsy_outcomes.csv")

When analyzing these data, you should first filter the data to a single value of outcome that you plan to study. The figure below shows Kaplan-Meier survival curves for these four outcomes.

Employment duration

This dataset can be used to model the duration of an employment spell as a function of covariates defined at the beginning of the spell.

The file employment_duration.csv contains data from the NLSY97 cross-sectional sample (excluding oversamples). Each row is a (person \(\times\) employment spell). Variables are defined as follows:

  • id is a person identifier
  • time is the duration of the employment spell in years. It begins with the month a respondent moves from being non-employed to being employed at least one week. It ends with the month a respondent becomes non-employed again for an entire month.
  • censored is an indicator for being censored, coded TRUE if the last interview occurred during this employment spell and FALSE if the end of the employment spell was observed
  • Two covariates are defined at the baseline survey: sex and race
  • Four covariates are defined at the start of the employment spell: age, education, marital, and parent (whether the respondent is a parent)
employment_duration <- read_csv("https://ilundberg.github.io/eventhistory/assets/employment_duration.csv")

The figure below shows a Kaplan-Meier survival curve for first marriage duration in these data.

First marriage duration

This dataset can be used to model the duration of a first marriage as a function of covariates defined at the beginning of the marriage. It can also be used to reason about competing risks, because marriages end for several reasons recorded in the how_end variable.

The file first_marriage_duration.csv contains data from the NLSY97 cross-sectional sample (excluding oversamples). Each row is a person who reports the start of a first marriage.

  • id is a person identifier
  • censored is an indicator for being censored, coded TRUE if the last interview occurred while the respondent was still married and FALSE if otherwise (i.e., end of marriage was observed)
  • time is the duration of the first marriage in years, until either the end of the marriage or censoring
  • how_end is how the marriage ended: Censored, Divorced, Legally Separated, or Widowed
  • Two covariates are defined at the baseline survey: sex and race
  • Three covariates are defined at the start of the first marriage: age, education, and parent (whether the respondent is a parent)
first_marriage_duration <- read_csv("https://ilundberg.github.io/eventhistory/assets/first_marriage_duration.csv")

The figure below shows a Kaplan-Meier survival curve for first marriage duration in these data.

U.S. life table deaths

Using 2023 U.S. age-specific mortality data from an NCHS report, I generated deaths for a hypothetical population that experiences these rates, available in deaths.csv.

deaths <- read_csv("https://ilundberg.github.io/eventhistory/assets/deaths.csv")

These data include

  • id indexes simulated persons
  • age is the time variable
  • died is whether the person died (died = 1) or was censored (died = 0)

The figure below visualizes Kaplan-Meier survival estimates in these data.

Heart recipients

These data come from a medical trial that tracked survival outcomes of patients receiving heart transplants.

Crowley, J., & Hu, M. (1977). Covariance analysis of heart transplant survival data. Journal of the American Statistical Association, 72(357), 27-36.

The trail enrolled people eligible for heart transplants, some of whom later received transplants and some did not. The full data are available in the jasa data object of the survival package. A simplified version of the data focuses on survival outcomes post-transplant for transplant recipients. This simplified file is heart_recipients.csv.

heart_recipients <- read_csv("https://ilundberg.github.io/eventhistory/assets/heart_recipients.csv")

In the heart_recipients data,

  • t is time in years from transplant until either death or censoring
  • c is censoring, coded TRUE for censoring and FALSE for death
  • age is the patient’s age at the time of transplant

Below is a Kaplan-Meier survival curve with these data.

Justice retirement

These data were originally collected by German Rodriguez (original source). He used Wikipedia and the Supreme Court website to create a dataset on the time that Supreme Court justices were in office, and how their time ended (retirement, resignation, death, still an incumbent).

A simplified version of these data is retirement.csv

retirement <- read_csv("https://ilundberg.github.io/eventhistory/assets/retirement.csv")

These data contain

  • number indexes Supreme Court justices
  • name contains names
  • state contains the justice’s home state
  • age_appointed is the age at which the justice was appointed
  • status indicates how the term ended (Resigned, Retired, or Died)
  • t is the total time from appointment until status

The graph below shows the cumulative proportion in each status over time.