The goal of this exercise is to walk through a logistic regression analysis. It will give you a basic idea of the analysis steps and thought-process; however, due to class time constraints, this analysis is not exhaustive.

library(tidyverse)
library(broom)
library(rms)
## add any other packages as needed 

This data is from an ongoing cardiovascular study on residents of the town of Framingham, Massachusetts. The goal is to predict whether a patient has a 10-year risk of future coronary heart disease. The dataset includes the following:

fram_data <- read_csv("data/framingham.csv") %>%
  drop_na() %>%
  mutate(education = case_when(
    education == 1 ~ "Some HS", 
    education == 2 ~ "HS or GED", 
    education == 3 ~ "Some College", 
    education == 4 ~ "College"
  ),
  currentSmoker = if_else(currentSmoker == 0, "nonsmoker", "smoker"),
  diabetes = if_else(diabetes == 0,"No", "Yes"),
  male = factor(male)
  )

References