How to detect a false $H_0$?
How to have higher power?
To determine the sample size needed for a study set $\alpha$ and the desired power, decide of the $H_A$, estimate $\sigma$ and calculate the sample size
Consider this test:
Suppose that $H_A$ is actually true
Suppose that the actual average is 132: i.e. $\mu = 132$
we sample 100 individuals
then the true sampling distribution of $\bar{x}$ is $N(132, 2.5)$
since $\text{SE} = \cfrac{25}{\sqrt{100}}$
what is the probability of successfully rejecting $H_0$?
We can divide it onto two probability questions:
Step 1
The null distribution is $N(130, 2.5)$
the 2.5% tails are those with $Z = \pm 1.96$
$-1.96 = z_1 = \cfrac{x_1 - 130}{2.5} $x_1 = 125.1$
$+1.96 = z_2 = \cfrac{x_2 - 130}{2.5}
$x_2 = 134.9$
Step 2
Now we compute the probability of rejecting $H_0$ if $\bar{x}$ actually came from $N(132, 2.5)$
$z_\text{left} = \cfrac{125.1 - 132}{2.5} = -2.76$ area: 0.003 $z_\text{right} = \cfrac{134.9 - 132}{2.5} = 1.16$ area: 0.123
so the probability of rejecting $H_0$ if the true mean is 132 is 0.004 + 0.123 = 0.126
This is the power of a test the probability of rejecting the $H_0$
The power varies depending on what we suppose the truth is
If the power of a test is 0.979, what's the type 2 error rate? Type 2 error rate is the probability of failing to reject $H_0$ so type 2 error rate is 1 - 0.979 = 0.021
x = seq(120, 140, 0.1) null.mu = 130; se = 2.5 null.y = dnorm(x, mean=null.mu, sd=se) plot(x, null.y, type='l', lty=2, bty='n', ylab='Probability') x1 = 125.1; x2 = 134.9 abline(v=c(null.mu, x1, x2), lty=2) real.mu = 132 real.y = dnorm(x, mean=real.mu, sd=se) lines(x, real.y, col='red', lwd=2) abline(v=real.mu, col='red', lwd=2) x1.left = max(which(x <= x1)) polygon(x=x[c(1, 1:x1.left, x1.left)], y=c(0, real.y[1:x1.left], 0), col=adjustcolor('red', 0.5), border=NA) x2.left = min(which(x >= x2)) x2.right = length(x) polygon(x=x[c(x2.left, x2.left:x2.right, x2.right)], y=c(0, real.y[x2.left:x2.right], 0), col=adjustcolor('red', 0.5), border=NA)
TODO: what's that?