# regression model with factor vars

Hello!

Strugling a bit with statistics as a newbie.

I've got 2 factor variables in dataset:
acceptance (with 2 levels - accepted and rejected) and
timeslot (with 6 levels of different time bins).

I'm trying to do a regression model and to see in which timeslot the highest/lowest probability of acceptance.

So I'm doing my model as following:
hour_glm = glm(acceptance ~ timeslot , family="binomial", data = df)
summary(hour_glm)

Call:
glm(formula = acceptance ~ timeslot , family="binomial", data = df)

Deviance Residuals:
Min 1Q Median 3Q Max
-1.6124 -1.4993 0.8680 0.8680 0.9126

## Coefficients: Estimate Std. Error z value Pr(>|z|) (Intercept) 0.98173 0.05762 17.037 < 2e-16 *** timeslot2 -0.32109 0.08791 -3.652 0.00026 *** timeslot3 -0.19961 0.06874 -2.904 0.00369 ** timeslot4 -0.25082 0.06587 -3.808 0.00014 *** timeslot5 -0.19986 0.06691 -2.987 0.00282 ** timeslot6 -0.13346 0.07036 -1.897 0.05786 .

Signif. codes: 0 ‘’ 0.001 ‘’ 0.01 ‘’ 0.05 ‘.’ 0.1 ‘ ’ 1

(Dispersion parameter for binomial family taken to be 1)

``````Null deviance: 21421  on 17248  degrees of freedom
``````

Residual deviance: 21400 on 17243 degrees of freedom
AIC: 21412

## Number of Fisher Scoring iterations: 4

And then I'm stuck. I'm not very good managing factors. How can I see when is highest/lowest acceptance probability?

Also what's the best way 2 visualize when you have 2 levels in the dependent var. ?

Thank you!

You have performed a logistic regression. The interpretation of each estimated beta coefficient is that it is the change in the logarithm of the odds of a success corresponding to a 1 unit change in that independent variable.

You could plot each timeslot level on the x axis versus predicted success on the y axis.

Why run a regression? Why not just calculate the percentage of acceptance for each time slot?

Thank you!
I calculated odds but not I have troubles interpreting them. As my outcome is a facotr var. with 2 levels - 1. Accepted and 2. Rejected.

When I have my odds do I interpret them as a probability of acceptance (or rejection)?

1 1 0.7274523
2 2 0.6594059
3 3 0.6861380
4 4 0.6750056
5 5 0.6860841
6 6 0.7002053

I figured it out Also double checked with CrossTable Thank you!

If LN(odds) = -0.32109
odds = e^-.32109 = .725358
probability = odds/(1 + odds) = .725358/(1 + .725358) = .830
This is the probability of acceptance = 1

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.