power_binom_test(n = 50, p0 = .50, pa = .75) ## => power = 0.971
power_binom_test(p0 = .50, pa = .75, power = .90) ## => n = 41
power_binom_test(n = 50, p0 = .25, power = .90, alternative="less") ## => pa = 0.0954
Run the code above in your browser using DataLab