library(tidyverse)
library(tidymodels)
library(knitr)AE 10: Comparing logistic regression models
Go to the course GitHub organization and locate your ae-10 repo to get started.
Render, commit, and push your responses to GitHub by the end of class to submit your AE.
Packages
Response to Leukemia treatment
Today’s data is from a study where 51 untreated adult patients with Acute Myeloid Leukemia who were given a course of treatment, and they were assessed as to their response to the treatment.1
The goal of today’s analysis is to use pre-treatment factors to predict how likely it is a patient will respond to the treatment.
We will use the following variables:
Age: Age at diagnosis (in years)Smear: Differential percentage of blastsInfil: Percentage of absolute marrow leukemia infiltrateIndex: Percentage labeling index of the bone marrow leukemia cellsBlasts: Absolute number of blasts, in thousandsTemp: Highest temperature of the patient prior to treatment, in degrees FahrenheitResp: 1 = responded to treatment or 0 = failed to respond
leukemia <- read_csv("data/leukemia.csv") |>
mutate(Resp = factor(Resp))Comparing models
- Consider a model with all the pre-treatment variables:
Age,Smear,Infil,Index,BlastsandTemp. Fit a model using these six variables to predict whether a patient responded to the treatment. Call the modelfull_model. Display the model.
# add codeBased on the model, which pre-treatment variables are statistically significant using a threshold of \(\alpha = 0.05\)? (We will talk more about inference for logistic regression coefficients in an upcoming lecture.)
Fit a model that only includes the statistically significant predictors. Call the model
reduced_model.
# add code- Use a drop-in-deviance test to compare a model that includes only the significant predictors to the full model. Which model do you choose based on the results of this test?
# add code- Is your choice based on AIC consistent with your choice from the previous exercise? What about a choice based on BIC?
# add codeSubmission
To submit the AE:
Render the document to produce the PDF with all of your work from today’s class.
Push all your work to your AE repo on GitHub. You’re done! 🎉
Footnotes
The data set is from the Stat2Data R package. This AE is adapted from exercises in Stat 2.↩︎