I have a dataset containing traffic crash information. One variable in the set is the number of fatalities that resulted in the crash, which has the values 0, 1, 2, and 3.
I am working in R and want to create a logistic regression model to predict the probability that fatalities >= 1. In order words, what is the likelihood that a traffic incident will result in at least one fatality? How would I do this? I am thinking I need to create a new binary variable such that fatalities=yes (1) and fatalities=no (0), but I'm wondering if there's a more simple way. Not that creating the binary variable would be difficult, I guess I'm just wondering if the predictor variable has to be binary, or if it is possible to just set a condition on it (i.e. fatalities>=1)?
I()
function.mod <- glm(I(fatalities >= 1) ~ x1 + x2, ...)
. Or you could create a new variable using>=
and refer to that instead, as you describe. Both should be equivalent $\endgroup$