Power for logistic regression

Relevant Links

https://webpower.psychstat.org/models/reg02/

https://rdrr.io/cran/WebPower/man/wp.logistic.html

https://webpower.psychstat.org/wiki/_media/grant/webpower_manual_book.pdf

Calculating the statistical power given sample size and effect size:

Note: p0 = Prob(Y=1|X=0): the probobility of observieng 1 for the outcome variable Y when the predictor X equals 0.

p1 = Prob(Y=1|X=1): the probobility of observieng 1 for the outcome variable Y when the predictor X equals 1.

wp.logistic(n = 400, p0 = 0.15, p1 = 0.1, alpha = 0.05,
            power = NULL, family = "normal", parameter = c(0,1))
## Power for logistic regression
## 
##       p0  p1     beta0      beta1   n alpha     power
##     0.15 0.1 -1.734601 -0.4626235 400  0.05 0.8998785
## 
## URL: http://psychstat.org/logistic

Generating power curve given a sequence of sample sizes:

res <- wp.logistic(n = seq(100,500,50), p0 = 0.15, p1 = 0.1, alpha = 0.05,
                power = NULL, family = "normal", parameter = c(0,1))
#res
#To plot the power curve:
plot(res)

Calculating the sample size given statistical powers and effect size:

wp.logistic(n = NULL, p0 = 0.15, p1 = 0.1, alpha = 0.05,
              power = 0.8, family = "normal", parameter = c(0,1))
## Power for logistic regression
## 
##       p0  p1     beta0      beta1        n alpha power
##     0.15 0.1 -1.734601 -0.4626235 298.9207  0.05   0.8
## 
## URL: http://psychstat.org/logistic