Homework 6

Due: Tuesday November 10 at 3 PM

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.

Part 1: more babies

Every year, the US releases to the public a large dataset containing information on births recorded in the country. This dataset has been of interest to medical researchers who are studying the relation between habits and practices of expectant mothers and the birth of their children.1 This is a random sample of 1,000 cases from the dataset released in 2014.

They’re the exact same data as last week, so let’s get ’em ready just like we did:

#births14 <- read_csv("data/births14.csv") |>
#  filter(!is.na(habit))

The data are available your data folder in births14.csv.

The variables in the data are as follows:

  • fage: Father’s age in years.
  • mage: Mother’s age in years.
  • mature: Maturity status of mother.
  • weeks: Length of pregnancy in weeks.
  • premie: Whether the birth was classified as premature (premie) or full-term.
  • visits: Number of hospital visits during pregnancy.
  • gained: Weight gained by mother during pregnancy in pounds.
  • weight: Weight of the baby at birth in pounds.
  • lowbirthweight: Whether baby was classified as low birthweight (low) or not (⁠not low⁠).
  • sex: Sex of the baby, female or male.
  • habit: Status of the mother as a nonsmoker or a smoker.
  • marital: Whether mother is married or ⁠not married⁠ at birth.
  • whitemom: Whether mom is white or ⁠not white⁠.

Exercise 1

Exercise 2

Exercise 3

Part 2: IMS exercises

These exercises from the textbook do not require code, but you should type your responses into the same Quarto file you’ve been using. Make sure to answer the questions in full sentences.

Exercise 4

CHANGE

IMS - Chapter 24 exercises, #2: Baby’s weight and father’s age, randomization test.

Exercise 5

CHANGE

IMS - Chapter 24 exercises, #6: Baby’s weight and father’s age, bootstrap percentile interval.

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.

Footnotes

  1. United States Department of Health and Human Services. Centers for Disease Control and Prevention. National Center for Health Statistics. Natality Detail File, 2014 United States. Inter-university Consortium for Political and Social Research, 2016-10-07. doi:10.3886/ICPSR36461.v1.↩︎