# Logistics model on variable with values 1, 2, 3?

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)?

• This seems like mostly a programming question, and should go on Stack Overflow. But in R you can do it in the formula directly by using the 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 May 10 at 15:04
• Yould look into ordinal logistic regression, search this site. May 10 at 15:42
• Thank you, David! That worked beautifully. And I appreciate the feedback. This was my first question to this site, but I will be sure to use Stack Overflow for programming questions in the future. May 11 at 16:14

You could try that binary transformation, directly or as suggested by @david. However, data transformation could change the odds.

For example, if you have $$n_{f_0} = 25$$, $$n_{f_1} = 25$$, $$n_{f_2} = 25$$, $$n_{f_3}=25$$, now you'll have $$n_{f_0}=25$$ and $$n_{f_1new}=75$$. So, the odds are likely to change too much.

Perhaps, you should try first to run the model with $$f_0$$ and $$f_1$$ (the original) and then extend the model the $$f_{1new}$$. And observe the difference.

If results don't seem reasonable (extreme odds), then the easy way is not feasible. Thus you might need to look to ordinal logit, as suggested by @kjetil, which can give you estimated probabilities such as $$P[f>1]$$.

• This has nothing to do with "territory" or feelings and everything to do with what this site is for and how it works. It's ridiculous to request that others do your editing for you. Please read our help center for more.
– whuber
May 11 at 11:45
• I am moderating, not harassing. If you object to moderation, this is not the site for you, because everybody (with a sufficient reputation) is a moderator.
– whuber
May 11 at 11:59
• Whuber is correct. The purpose of comments is to clarify the material in questions and answers. It's very hard to see how this exchange, which asks a clarifying question about the answer, and then explains how this site works, could possibly be harassment, bigotry or abuse.
– Sycorax
May 11 at 12:21