

It’s not a good feeling though (at least for me)! I often get the same strange gut feeling when my car doesn’t work properly, because I don’t know how cars work. This makes sure our calculations are correct and helps us to trust the allEffects function more in the future.īut why on Earth did we even need to do calculate things “manually” if there are already pre-programmed functions out-there?īecause otherwise, we would need to blindly trust the function. If you compare our “manually” calculated results of log-odds and probabilities to the results of allEffects, you’ll see that they are identical. result % summary() # model: survived ~ sex + passengerClass + sex * passengerClass Moreover, it provides the probabilities with confidence intervals for our interaction model at the same time (9th line). It also gives you the standard error (3rd, out-commented, line), which you could use to calculate confidence intervals (4th and 5th, out-commented, lines), but you don’t need to because allEffects already provides confidence intervals to log-odds (6th & 7th, out-commented, lines).
#GPOWER LOGISTIC REGRESSION CODE#
The real log-odds can also be calculated by the allEffects() function from the effects package (2nd line of the code below). Scroll to the right to see the whole table. Let’s build our first interaction model and have a look at the results: # get the data In order to add an interaction term to a model with two categorical predictors, let’s say “sex + passengerClass” we add those same predictors into the equation one more time, but with a "*" between them instead of “+”. Library(effects) # for probability output and plots Library(sjmisc) # for plotting results of log.regr. Library(sjPlot) # for plotting results of log.regr. Library(car) # for checking assumptions, e.g. library(tidyverse) # data wrangling and visualization Load all needed packages at once to avoid interruptions.
