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.
-
Use Polars to read in the hospital dataset and select the columns
region,stay, andinfection_risk. Remove any missing data (nulls). Here's the README for these data. Pay attention to units, though note thatinfection_riskis a unitless number. The higher it is the more likely a person is to get an infection. The lower it is, the less likely. -
Fit a unique intercepts and unique slopes linear model to predict
infection_riskusing the categorical variableregionand the numeric variablestay. -
What can you say in general about the relationship between
stayandinfection_risk? Why? What about the differentregions? Be specific and justify your answer using hypothesis tests, p-values, and/or confidence intervals. -
Use the method
predictto calculate the meaninfection_riskfor a hospital in each region, using the mean of stay from eachregion. No Python loops, no copy-and-pastes, and only one call topredict. Hint: unique ints/slopes.