# Categorical Variable and Logistic Regression

I ran a really simple logistic regression and want to know the X% increase in odds for each of my categorical variables. My equation is $$Honors=f(Status)$$ such that $$Status$$ is Low, Medium or High. The output of my results shows the following

model\$coeffiecents
(Intercept)   Low   Medium
1.07366       0.284  0.241


I transformed the coefficients into odds using $$e^{coefficient}$$. So holding all things constant, we see the odds of being in Honors for Low is 27.3%($$e^{0.284}-1$$). The odds for being in Honors for Medium is 32.85%. Does this mean the odds for being in Honors for High is 1-(27.3%+32.85%) = 39.89%?

What if I wanted to get the probability of being in Honors given you are High? I can get Medium and Low as $$\frac{e^{coefficient}}{1+e^{coefficient}}$$ but how would I get High?

– whuber
May 1, 2020 at 20:19
• That is a great answer that kind of helped. However, it also is a Friday afternoon.... Thank you for not immediately closing the question cause of a possible duplicate. May 1, 2020 at 20:26
• After reading it over a few times, it did not help answer my question. May 1, 2020 at 20:51

In your case, "High" is taken as the reference level, and the log-odds, or coefficients are calculated relative to that. So the probability for High will be $$\frac{e^{intercept}}{1+e^{intercept}}$$ whereas that for other group is $$\frac{e^{intercept + coef}}{1+e^{intercept + coef}}$$ .

We can simulate data with known probabilities, high = 0.74, medium = 0.79 and low = 0.81:

set.seed(111)
true_p = c(0.74,0.79,0.81)
y = rbinom(1500,size=1,prob=rep(true_p,each=500))
type = rep(c("High","Medium","Low"),each=500)

fit = glm(y ~ type,family=binomial)
Coefficients:
(Intercept)      typeLow   typeMedium
1.0356       0.4944       0.4015


The probability for high is:

exp(coefficients(fit)[1])/(1+exp(coefficients(fit)[1]))
(Intercept)
0.738


Which is close to what we simulated. You can work out for low:

exp(1.0356+0.4944)/(1+exp(1.0356+0.4944))
[1] 0.8220063


or you can fit without an intercept, and it gives you the log-odds:

Call:  glm(formula = y ~ 0 + type, family = binomial)

Coefficients:
typeHigh     typeLow  typeMedium
1.036       1.530       1.437

fit = glm(y ~ 0+type,family=binomial)
exp(coef(fit))/(1+exp(coef(fit)))
typeHigh    typeLow typeMedium
0.738      0.822      0.808