The Quarto template for this assignment may be found in the repository at the following link: https://classroom.github.com/a/1iuiJX3t

Today’s data come from a retrospective analysis of core body temperature during surgery. Walters et al. (2020) examined the association between core body temperature and risk of infection during colorectal surgery. Data were collected for almost 8,000 patients undergoing such surgery at the Cleveland Clinic from 2005 through 2014. We are primarily interested in the outcome of any infection within 30 postoperative days, which is labeled AnyInfection.

There are many variables in the dataset temperature.csv, but here are the primary ones of interest:

  1. Is there sufficient evidence to suggest that average intraoperative core temperature is associated with differential odds of any infection occurring within 30 days of surgery, while controlling for all of the variables listed in the previous section? Conduct a hypothesis test at the \(\alpha = 0.05\) level to support your claim.
  2. Interpret the slope parameter corresponding to TWATemp in the model you constructed in Exercise 1.
  3. Using your model from Exercise 1, while controlling for the relevant clinical, demographic, and peri-operative variables identified above, what are the relative odds of developing any infection 30 days after surgery comparing a patient with normal body temperature (37 degrees C) vs. a patient with hypothermia (35 degrees C)?
  4. Suppose you had a 31 year old female patient with a BMI of 34, a Charlson score of 3, diabetes, peripheral vascular disease, a time-weighted body temperature equal to the average among all observations, and a surgery that took five hours. Using your model, what would be their estimated probability of developing any infection 30 days after surgery?
  5. Evaluate whether the linearity assumption is satisfied for the continuous predictors in the model.
  6. Suppose you use your logistic regression model as a classifier for any infection by using a threshold of 0.5 predicted probability (that is, predicted probabilities above 0.5 are classified as “experiencing infection”). What are the sensitivity, specificity, positive predicted value, and negative predicted value of your classifier among this cohort of patients?
  7. Construct an ROC curve for your classifier using this model. What AUC do you achieve?