probability with adjustment for multiple factors

Hello!
I keep struggling with my data and analysis :slight_smile:

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

So I managed to calculate probability of acceptance for every timeslot. I did it via glm model and predict function. Then I also did it via CrossTable. And it's all very nice (esp. CrossTable "cause it gives you % directly and it's all nicely visualised in a table).

Now I need to calculate the same probability again but with the adjustment for multiple other factor like age, gender, etc.

So I guess CrossTable is out of the picture here, right? Or is there any way to include it there?

So I'm trying to do glm again.

hour_glm2 = glm(acceptance ~ timeslot + age + gender , family="binomial", data = df)
summary(hour_glm)

This is how I did probability when only 2 factors where involved:

newdata <- data.frame(timeslot= c("1", "2", "3", "4", "5", "6"))
prob_admis <- predict(hour_glm, newdata = newdata, type = "response")
newdata$prob_admis <- prob_admis
newdata

But with all other factors involved when I try to apply the same approach I keep getting errors.
Any idea how to calculate probabity for every timeslot but with all other factors involved?

Huge thanx! xx

Hi!

To help us help you, could you please prepare a reproducible example (reprex) illustrating your issue? Please have a look at this guide, to see how to create one:

This topic was automatically closed 42 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.