Hypothesis Testing Fundamentals


Hypothesis Testing Fundamentals

Maria
So today we're diving into hypothesis testing. It's one of those topics that can feel really abstract at first, but the core idea is actually pretty intuitive once you break it down.

Simon
Absolutely. And the lecture started with a great point: without variability, there's no need for statistics. If every patient responded the same way to a treatment, we'd never need to test anything. But because people vary, we need tools to figure out whether a difference we see is real or just noise.

Maria
Exactly. That's the whole foundation. You compare the variability within groups to the variability between groups. If the between-group difference is large relative to the within-group spread, you start thinking maybe there's a real effect.

Simon
And that's where the null and alternative hypotheses come in. The null hypothesis, H0, is usually that there's no difference—like the new drug and placebo are equally effective. The alternative, H1, is that they differ. And you set up the null hoping you'll be able to reject it.

Maria
Right. And when you make a decision based on your data, there are four possible outcomes. Two are correct: true positive when you reject a false null, and true negative when you fail to reject a true null. But then there are the errors.

Simon
Type I error: rejecting the null when it's actually true—a false positive. That's like claiming a drug works when it doesn't. The probability of that is alpha, and it's controlled by the researcher. The FDA cares a lot about keeping alpha low, typically at 0.05.

Maria
And Type II error: failing to reject the null when it's false—a false negative. That's missing a real effect. Beta is the probability of that error. And power is 1 minus beta—the chance of correctly detecting an effect when it exists.

Simon
The pharmaceutical company cares more about power, because they don't want to miss a truly effective drug. In early-phase trials, power is often between 60% and 80%. In late-phase, they aim for 80% to 95%.

Maria
And there's a trade-off: if you keep the sample size fixed and lower alpha, beta goes up, so power goes down. To improve both, you need a larger sample size. That's one way to guarantee a statistically significant result—just make the sample huge.

Simon
Which brings us to the coin-toss example. Suppose you have a regular coin and a two-headed coin. You toss it and get heads. The null is that it's the regular coin. You keep tossing and get more heads. At what point do you reject the null?

Maria
That depends on your threshold. The p-value is the probability of getting your result—or something more extreme—if the null were true. For one head, p=0.5. Two heads, p=0.25. Three heads, p=0.125. Four heads, p=0.0625. Five heads, p=0.03125. So if you set alpha at 0.05, you'd reject after five heads in a row.

Simon
But here's the key: the p-value is not the probability that the null is true. It's not the probability that the alternative is true. It's just the probability of the data under the null. A common misinterpretation.

Maria
Exactly. That's the frequentist approach. But there's also the Bayesian perspective, which the lecture introduced. Bayesians start with a prior belief—like a 50-50 chance it's the regular coin. Then they update that belief with data to get a posterior probability.

Simon
After seven heads, the Bayesian posterior probability that it's the regular coin is only 0.8%, meaning 99.2% that it's the two-headed coin. Notice those numbers are different from the p-value of 0.008, but they're interpreted differently: the Bayesian gives direct probabilities about the hypotheses.

Maria
And Bayesian thinking is gaining traction, even at the FDA, because it's more intuitive: you update your belief as you get more data. But the math can be complex. Still, it's worth knowing about.

Simon
Now, let's talk about how sample size affects p-values. The lecture showed three scenarios with the same treatment effect of 3, but increasing sample sizes. With a small sample, the distribution of the difference is wide, p-value is large, and we fail to reject. With a larger sample, the distribution tightens, and the same effect becomes statistically significant.

Maria
That's a crucial lesson: statistical significance does not equal clinical significance. You can make even a tiny effect significant with a huge sample. So you have to ask: is this difference meaningful in practice? That's where power analysis comes in—to find the smallest sample size that will reliably detect a clinically important difference.

Simon
And confidence intervals are closely related to hypothesis testing. A 95% confidence interval that doesn't include zero corresponds to a p-value less than 0.05. It gives a range of plausible values for the true effect, which is often more informative than a single p-value.

Maria
The lecture also covered different trial types. In a superiority trial, you want to show the experimental is better than control. The null is that they're equal, and you hope to reject it. If the confidence interval is entirely above zero, you claim superiority.

Simon
Non-inferiority trials are different: you want to show the experimental is not worse than control by more than a pre-specified margin, delta. If the confidence interval lies entirely to the right of minus delta, you claim non-inferiority. And equivalence trials have both a lower and upper delta; if the entire interval lies within those bounds, you claim equivalence.

Maria
Choosing delta is tricky—it's a clinical, not a statistical, decision. And that's why some people are uncomfortable with these designs. But they're widely used, especially for generics or when a placebo control is unethical.

Simon
Finally, multiple comparisons. If you test many hypotheses, you inflate the chance of a Type I error. The dartboard analogy is perfect: if you throw enough darts, you'll eventually hit the bullseye by chance. So you need to adjust—formally for primary analyses, like using Bonferroni correction (divide alpha by the number of tests).

Maria
Informally, for exploratory analyses, you can just be more cautious or mention the multiplicity in your paper. But never ignore it. And remember the two guaranteed ways to get a statistically significant result: huge sample size or lots of tests. Neither means the result is clinically meaningful.

Simon
Bottom line: hypothesis testing is about balancing errors, understanding what p-values really mean, and always interpreting results in context. Confidence intervals help, and being aware of Bayesian alternatives can open up new ways of thinking.

Maria
And if you take away one thing, let it be this: statistical significance is not the end of the story. It's the beginning of asking whether the result matters. With that foundation, you're ready to critically evaluate research and design better studies.

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