# Example from Hosmer et al., 2013
# Applied Logistic Regression (3rd ed.), Chapter 5, Table 5.8
# Recode 'raterisk' into a binary variable 'raterisk_cat'
glow500 <- dplyr::mutate(
glow500,
raterisk_cat = dplyr::case_when(
raterisk %in% c("Less", "Same") ~ "C1",
raterisk == "Greater" ~ "C2"
)
)
# Fit a multiple logistic regression model with interactions
model.int <- glm(
fracture ~ age + height + priorfrac + momfrac + armassist +
raterisk_cat + age * priorfrac + momfrac * armassist,
family = binomial,
data = glow500
)
# Compute sensitivity and specificity at multiple cutpoints
cutpoints(model.int, cmin = 0.05, cmax = 0.75, byval = 0.05, plot = FALSE)
Run the code above in your browser using DataLab