Hypothesis Testing: Randomization Tests


Hypothesis Testing: Randomization Tests

Michael
Welcome back to hypothesis testing, part two. Before we get into the new ideas, let’s refresh the five-step process for a randomization test. In step one, choose the right test and write the hypotheses in terms of population parameters. The null hypothesis always includes equality.

Maria
Then, in step two, construct a randomization distribution assuming the null hypothesis is true. In step three, use that distribution to find the p-value: the area representing results at least as extreme as your observed statistic, in the direction specified by the alternative hypothesis.

Michael
Step four is the decision. Compare the p-value with your significance level, or alpha. If the p-value is less than or equal to alpha, reject the null hypothesis; if it’s greater than alpha, fail to reject it. And unless there’s a reason to choose something different, the usual alpha level is 0.05.

Maria
Finally, step five is to state a conclusion in the context of the original research question. Don’t stop at saying “reject” or “fail to reject”—explain what the result means for the real-world question you set out to answer.

Michael
Today we’ll build on that process. We’ll distinguish Type I and Type II errors, consider how to choose alpha, look at multiple testing and practical significance, explore statistical power, and compare confidence intervals with hypothesis tests.

Maria
Let’s start with the errors. Picture a table: the rows are the decision you make in step four—reject the null or fail to reject it. The columns are what’s actually true in the population. That second part can be hard to know, because we usually have sample data rather than data from the whole population.

Michael
If you reject the null hypothesis, there are two possibilities. You may have made the correct decision because the null really is false. Or you may have made a Type I error: you rejected the null even though it was actually true. A Type I error is also called an alpha error.

Maria
And if you fail to reject the null, that can also be correct or incorrect. If the null really is true, your decision is correct. But if the null is false—say, there really is a population difference—and your test misses it, that’s a Type II error, also called a beta error.

Michael
Here’s an example. Suppose we test whether the mean number of cookies per pack is less than 25. The hypotheses are that the population mean, mu, equals 25 under the null, and that mu is less than 25 under the alternative. The randomization test gives a p-value of 0.14.

Maria
Since 0.14 is greater than the usual alpha of 0.05, we fail to reject the null. Now imagine that we later learn the true population mean is 24. The null hypothesis was actually false, so our failure to reject it was a Type II error.

Michael
For another example, suppose we test whether age and height are related among all Penn State students. The null says the population correlation, rho, equals zero; the alternative says rho does not equal zero. If the p-value is 0.044, we reject the null at alpha equals 0.05.

Maria
But then suppose a census of the entire student population shows there is no relationship after all. That means rho really is zero, so the null was true. Rejecting it was a Type I error. The census tells us the reality that wasn’t available to us when we had only a sample.

Michael
Next, choosing alpha. Alpha is the highest p-value at which you would reject the null, and 0.05 is the standard choice. But a different scenario can call for a different threshold.

Maria
For instance, a pilot study—a smaller study done before a larger one—may use a higher alpha, such as 0.10 or even 0.15. Pilot studies often have small samples, and their results are generally meant to provide information for the later study rather than to drive important decisions.

Michael
On the other hand, if a Type I error would have especially serious consequences, a lower alpha may make sense. In medical research, for example, incorrectly concluding that a treatment works could mean giving patients an ineffective treatment. Researchers might choose 0.01 or even 0.001.

Maria
A lower alpha makes it harder to reject the null, because the p-value has to be smaller. But it also reduces the probability of a Type I error. So alpha is a choice about how much evidence you require before rejecting the null, made with the consequences of an incorrect rejection in mind.

Michael
Now let’s consider what happens when we conduct many tests. At alpha equals 0.05, if the null hypothesis is true, there’s a five-percent chance of getting a statistically significant result by chance. Across 100 tests where all the null hypotheses are true, we’d expect about five significant results that are Type I errors.

Maria
That connects to publication bias. Studies with statistically significant results are more likely to be published than studies without them. So if only the significant results are easy to find, the literature may overrepresent chance findings and leave readers unaware of many studies that did not find significance.

Michael
If you conduct multiple tests on the same data, one simple way to account for the number of tests is the Bonferroni method. Divide the overall alpha level by the number of tests, then compare each p-value with that adjusted threshold.

Maria
For example, with six tests and an overall alpha of 0.05, you’d compare each p-value with 0.05 divided by six, which is about 0.0083. That gives you a more stringent threshold for each test. It’s an easy method to calculate, and we’ll encounter multiple-comparison methods again later in the course.

Michael
Another key distinction is statistical versus practical significance. A p-value at or below alpha makes the result statistically significant. But statistical significance is affected by sample size: with a very large sample, even a small difference can be statistically significant.

Maria
So statistical significance asks an inferential question: is there evidence of some difference in the population, based on our sample? Practical significance asks a different question: how large is the difference, and is it meaningful in real life? The magnitude of a difference is often described as its effect size.

Michael
For two independent sample means, one effect-size measure is Cohen’s d. It’s the difference between the sample means divided by the pooled standard deviation, so it describes the difference in standard-deviation units. That’s similar in spirit to a z-score: it puts a difference on a standardized scale.

Maria
The common Cohen’s d guidelines are: below 0.2, little or no effect; from 0.2 to 0.5, a small effect; from 0.5 to 0.8, a medium effect; and above 0.8, a large effect. These are ways to describe the size of an effect, rather than to decide whether a p-value is statistically significant.

Michael
There are other effect-size measures for other kinds of questions. With two independent proportions, relative risk compares the risk in group one with the risk in group two, where risk means the proportion. For correlation or regression, we use R-squared, also called the coefficient of determination.

Maria
That brings us to statistical power. Power is the probability of rejecting the null hypothesis when it’s actually false. In that situation, rejecting the null is the correct decision. Since a Type II error is failing to reject a false null, power is one minus beta.

Michael
Several factors affect power. Increasing the sample size decreases the standard error and increases power. A larger difference between the sample result and the hypothesized value also increases power. And increasing the alpha level increases power as well.

Maria
The reverse is true for the standard error: when it increases, power decreases. It can be useful to experiment with these factors in StatKey—change one, run the test again, and observe how the randomization distribution and p-value respond.

Michael
Finally, confidence intervals and hypothesis tests are both inferential procedures. In each case, we collect data from a sample and use it to make an inference about a population. Both can also be carried out using resampling methods.

Maria
The resampling approach differs. A randomization test starts with a null hypothesis, and its randomization distribution is centered on the value specified by that null. Bootstrapping starts with the observed sample data, without a hypothesized value, so its sampling distribution is centered on the observed sample statistic.

Michael
There’s also a useful connection between confidence intervals and tests. A 95% confidence interval is approximately equivalent to a two-tailed hypothesis test with alpha equal to 0.05. The results are generally very similar, though they aren’t always exactly equivalent—for example, with proportions near zero or one.

Maria
So the big picture is: understand what a rejection or non-rejection could get wrong, choose alpha with the consequences in mind, be cautious about multiple tests and publication bias, and look beyond statistical significance to the size and real-world meaning of an effect.

Michael
And when you interpret a test, keep power and the study design in mind, too. Confidence intervals and hypothesis tests offer related ways to reason from a sample to a population, but they organize that inference differently. If questions come up while you work through the notes, textbook, homework, or lab, post them on the appropriate course discussion board.

Ask anything
We've read this whole study set, so questions about it get the best answers.