Created
March 25, 2018 20:55
-
-
Save JonasMoss/238643b4b1d7563f9e7bfc89f11f2b96 to your computer and use it in GitHub Desktop.
Small demonstration of power.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## A small demonstration of statistical power for a one-sided z-test. The point | |
## is to show that powers close to zero or one are not reasonable to assume a | |
## priori. | |
n = 80 | |
theta = seq(-0.3, 1, by = 0.01) | |
plot(theta, 1 - pnorm(1.96 - sqrt(n)*theta), type = "l", bty = "l", | |
xlab = expression(theta), ylab = "Power", | |
main = paste0("Power when n = ", n)) | |
grid() | |
lines(theta, 1 - pnorm(1.96 - sqrt(n)*theta)) | |
abline(h = 0.05, col = "red", lty = 2) | |
abline(h = 0.95, col = "blue", lty = 2) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment