MATH 314 Quiz 22

Given on 2025-11-19

Please submit a Jupyter notebook to the Quiz 22 repository by the end of class today.

  1. Use Polars to read in the hospital dataset and select the columns region, stay, and infection_risk. Remove any missing data (nulls). Here's the README for these data. Pay attention to units, though note that infection_risk is a unitless number. The higher it is the more likely a person is to get an infection. The lower it is, the less likely.

  2. Fit a unique intercepts and unique slopes linear model to predict infection_risk using the categorical variable region and the numeric variable stay.

  3. What can you say in general about the relationship between stay and infection_risk? Why? What about the different regions? Be specific and justify your answer using hypothesis tests, p-values, and/or confidence intervals.

  4. Use the method predict to calculate the mean infection_risk for a hospital in each region, using the mean of stay from each region. No Python loops, no copy-and-pastes, and only one call to predict. Hint: unique ints/slopes.