Homework 7

Due: Tuesday November 24 at 3 PM

We will be working again with data from The Stanford University Heart Transplant Study (Turnbull, Brown, and Hu 1974):

heart_transplant <- read_csv("data/heart-transplant.csv")
glimpse(heart_transplant)
Rows: 103
Columns: 8
$ id         <dbl> 15, 43, 61, 75, 6, 42, 54, 38, 85, 2, 103, 12, 48, 102, 35,…
$ outcome    <chr> "deceased", "deceased", "deceased", "deceased", "deceased",…
$ transplant <chr> "control", "control", "control", "control", "control", "con…
$ age        <dbl> 53, 43, 52, 52, 54, 36, 47, 41, 47, 51, 39, 53, 56, 40, 43,…
$ survtime   <dbl> 1, 2, 2, 2, 3, 3, 3, 5, 5, 6, 6, 8, 9, 11, 12, 16, 16, 16, …
$ acceptyear <dbl> 68, 70, 71, 72, 68, 70, 71, 70, 73, 68, 67, 68, 71, 74, 70,…
$ prior      <chr> "no", "no", "no", "no", "no", "no", "no", "no", "no", "no",…
$ wait       <dbl> NA, NA, NA, NA, NA, NA, NA, 5, NA, NA, NA, NA, NA, NA, NA, …

The data dictionary is as follows:

Variable Description
id ID number of the patient
outcome Survival status with levels alive and deceased
transplant Transplant group with levels control (did not receive a transplant) and treatment (received a transplant)
age Age of the patient at the beginning of the study
survtime Number of days patients were alive after the date they were determined to be a candidate for a heart transplant until the termination date of the study
acceptyear Year of acceptance as a heart transplant candidate
prior Whether or not the patient had prior surgery with levels yes and no
wait Waiting time for transplant

Using these data, we want to know how getting a transplant relates to survival times.

Setup

  1. Log-in to your container;
  2. Double-check that you have the sta101-f26-files project loaded in the upper-right corner of RStudio (this should always be true);
  3. Go to the “Git” tab in the upper-right panel of RStudio and click the Pull button (arrow pointing down). Now the new assignment template and dataset should appear in the hw folder of your Files;
  4. At the top of the new .qmd, in between ---, you have the settings for the document (the so-called YAML, but don’t worry about that). Modify the author so that it lists lil’ ol’ you.

Exercise 0

Recommend some music for us to listen to while we grade this.

Exercise 1

Create an appropriate data visualization to compare survival times between patients that did and did not receive a transplant.

Exercise 2

The observed difference between the two groups of patients is:

heart_transplant |>
  specify(response = survtime, explanatory = transplant) |>
  calculate(stat = "diff in means", order = c("treatment", "control"))
Response: survtime (numeric)
Explanatory: transplant (factor)
# A tibble: 1 × 1
   stat
  <dbl>
1  319.

To quantify the reliability of this point estimate, use the bootstrap to contruct and interpret a 90% confidence interval for the difference in means.

Exercise 3

Do these data provide convincing evidence of a difference between average survival times of patient who did and did not get a heart transplant?

Write the hypotheses for answering this question and conduct the hypothesis test using randomization. Use 1,000 resamples. Find and interpret the p-value in context of the data and the research question and comment on the statistical discernability of this result using a discernability level of 5%.

Exercise 4

Instead of randomization, redo your test using an appropriate mathematical approximation. Explain what assumptions the approximation makes, and comment on any differences or similarities in the results between the randomization test or the mathematical test.

Submission

  1. Hit the blue Render button to generate your final PDF;
  2. Give your work a final look over to double-check a few things:
    • that your code is stylish;
    • that none of your code or pictures runs off the page. We cannot grade what we cannot read;
    • that all of your plots are well-labeled and human-readable. In other words “Flipper length (mm)” instead of flipper_length_mm;
    • If your work is lacking on any of these items, fix them and re-render as needed;
  3. Download the PDF from your container;
  4. Upload it to Gradescope;
  5. Don’t forget to mark your pages.

References

Turnbull, Bruce W., Byron Wm. Brown, and Marie Hu. 1974. “Survivorship Analysis of Heart Transplant Data.” Journal of the American Statistical Association 69 (345): 74–80. https://doi.org/10.1080/01621459.1974.10480130.