library(mosaic) data(tips, package = "reshape2") Recode sex: tips %>% mutate(sex_n = case_when( sex == "Female" ~ 0, sex == "Male" ~ 1 )) -> tips2 Fit model: glm1 <- glm(sex_n ~ total_bill, data = tips2, family = "binomial") Way 1 plotModel(glm1) Way 2 Add predictions to data frame: tips2 %>% mutate(pred = predict(glm1, newdata = tips, type = "response")) %>% mutate(predict_Male = pred > .5) -> tips3 Check values of …