# power is defined as the probability of observing a test statistics greater
# than the critical value
power.chisq.test(ncp = 20, df = 100, alpha = 0.05)
power.chisq.test(power = 0.80, df = 100, alpha = 0.05)
power.chisq.test(power = 0.80, ncp = 20, alpha = 0.05)
Run the code above in your browser using DataLab