1. Home
  2. Explore
  3. Statistics
  4. Hypothesis Testing

Study methods

Flashcards
Quiz
Fill in the blanks
Written test
Lesson
Notes
Podcast
Content

Hypothesis Testing

Hypothesis Testing

Purpose and basic logic

Hypothesis testing uses sample data to assess whether an assumption about a population is plausible. A researcher begins with an initial assumption, such as that a treatment has no effect, and then asks whether the observed sample result would be unusually unlikely if that assumption were true.

The general process is:

  1. State an initial assumption about the population.

  2. Collect or analyze sample data and calculate a test statistic, often a sample mean.

  3. Determine how likely it would be to observe the result obtained—or a result still more extreme—if the initial assumption were true.

  4. Compare that likelihood with a chosen standard for what counts as sufficiently unlikely.

  5. Either reject the initial assumption or fail to reject it.

A very unlikely result provides evidence against the initial assumption. It does not prove with certainty that the assumption is false. Statistical conclusions involve uncertainty rather than the clean yes-or-no certainty of a mathematical proof.

The connection to proof by contradiction

In a proof by contradiction, one assumes a statement is true and shows that this leads to an impossibility. Hypothesis testing has a related structure: it begins by treating the null hypothesis as true and evaluates whether the sample result would be surprising under that assumption.

However, a statistical result is not a mathematical contradiction. A low probability does not make an outcome impossible; it indicates that the outcome is unusual under the null hypothesis.


The null and alternative hypotheses

Every hypothesis test begins with a null hypothesis, written as H0H_0H0​. It represents the baseline assumption being tested. In a treatment study, the null hypothesis often states that the treatment has no effect on the population mean.

For example, if a population mean is assumed to equal a known value μ0\mu_0μ0​, the null hypothesis can be written as

H0:μ=μ0H_0: \mu = \mu_0H0​:μ=μ0​

The specific quantity in the hypothesis depends on the question. A test about a proportion, for example, would state a claim about a population proportion rather than a mean.

A test also requires an alternative hypothesis, written as H1H_1H1​ or sometimes HAH_AHA​. It describes the result that would count as evidence against the null hypothesis. The alternative must be chosen before examining the data, so the direction of the test is not selected after seeing which result the sample produced.

Two-tailed alternative

A two-tailed test asks whether the population value differs from the null value in either direction:

H0:μ=μ0H_0: \mu = \mu_0H0​:μ=μ0​
H1:μ≠μ0H_1: \mu \ne \mu_0H1​:μ=μ0​

This test treats values much higher or much lower than μ0\mu_0μ0​ as evidence against H0H_0H0​. It is appropriate when the research question is whether the treatment changes the outcome, without specifying in advance whether the change should be an increase or a decrease.

One-tailed alternatives

A one-tailed, or directional, test specifies which direction would count as evidence:

  • For an increase:

    H0:μ≤μ0H1:μ>μ0H_0: \mu \le \mu_0 \qquad H_1: \mu > \mu_0H0​:μ≤μ0​H1​:μ>μ0​
  • For a decrease:

    H0:μ≥μ0H1:μ<μ0H_0: \mu \ge \mu_0 \qquad H_1: \mu < \mu_0H0​:μ≥μ0​H1​:μ<μ0​

The direction must be planned before the data are examined. Choosing a one-tailed test only after noticing that the sample mean is higher or lower would make the analysis dependent on the observed result and could exaggerate the evidence.

Choosing between one-tailed and two-tailed tests

A two-tailed test allows for evidence in either direction and is often the safer choice when the direction of the effect is uncertain. A one-tailed test can provide more power to detect an effect in its specified direction, but it does not treat an effect in the opposite direction as evidence for the alternative.

The choice is therefore based on the research question and prior reasoning, not on which test gives a more favorable result. The null and alternative hypotheses should be specified before collecting or analyzing the data.


Significance level and critical-value method

The significance level, denoted by α\alphaα, is the threshold used to decide how unusual a result must be before the null hypothesis is rejected. It is selected before the test is evaluated.

For example, choosing α=0.05\alpha = 0.05α=0.05 means that results with a probability below 0.050.050.05 under the null hypothesis will be treated as sufficiently unusual to reject H0H_0H0​. The significance level also sets the maximum Type I error rate accepted by the testing procedure.

One method of testing compares the calculated test statistic with a critical value determined by α\alphaα:

  1. Choose the significance level and whether the test is one-tailed or two-tailed.

  2. Find the critical value or values corresponding to that choice.

  3. Calculate the test statistic from the sample.

  4. Reject H0H_0H0​ if the test statistic falls into the critical region; otherwise, fail to reject H0H_0H0​.

For a zzz-test, the critical values mark the boundary of the rejection region in the standard normal distribution. A test statistic is more extreme when it lies farther into the tail or tails specified by the alternative hypothesis.

Common critical values for zzz-tests

For a two-tailed test, the total area in both tails equals α\alphaα. For a one-tailed test, the area in the specified tail equals α\alphaα.

  • Two-tailed, α=0.05\alpha = 0.05α=0.05: critical values are approximately −1.96-1.96−1.96 and 1.961.961.96. Each tail contains 0.0250.0250.025 of the area.

  • Two-tailed, α=0.01\alpha = 0.01α=0.01: critical values are approximately −2.58-2.58−2.58 and 2.582.582.58.

  • Two-tailed, α=0.001\alpha = 0.001α=0.001: critical values are approximately −3.30-3.30−3.30 and 3.303.303.30.

  • One-tailed, α=0.05\alpha = 0.05α=0.05: the critical value is approximately 1.6451.6451.645 for an upper-tail test or −1.645-1.645−1.645 for a lower-tail test.

  • One-tailed, α=0.01\alpha = 0.01α=0.01: the critical value is approximately 2.332.332.33 for an upper-tail test or −2.33-2.33−2.33 for a lower-tail test.

The sign of a one-tailed critical value depends on the direction of the alternative. For example, H1:μ>μ0H_1: \mu > \mu_0H1​:μ>μ0​ places the rejection region in the upper tail, while H1:μ<μ0H_1: \mu < \mu_0H1​:μ<μ0​ places it in the lower tail.


P-values and the probability method

A p-value is the probability, assuming the null hypothesis is true, of observing a test statistic at least as extreme as the one obtained. The meaning of “as extreme” depends on whether the test is one-tailed or two-tailed.

  • For an upper-tailed test, the p-value is the probability of obtaining a test statistic at least as large as the observed statistic.

  • For a lower-tailed test, it is the probability of obtaining one at least as small.

  • For a two-tailed test, it includes results equally extreme in either direction.

The p-value can be compared directly with the significance level:

  • If p≤αp \le \alphap≤α, reject H0H_0H0​.

  • If p>αp > \alphap>α, fail to reject H0H_0H0​.

A small p-value means the observed result would be unusual if the null hypothesis were true. It does not mean that the p-value is the probability that the null hypothesis is true, nor does it establish the size or practical importance of an effect.

The critical-value and p-value approaches are two ways to make the same decision when they use the same test, hypotheses, and significance level. The critical-value approach compares the test statistic with a boundary; the p-value approach compares the probability associated with the statistic with α\alphaα.


Type I error and significance

A Type I error occurs when a test rejects a null hypothesis that is actually true. It is a false rejection of the baseline assumption.

The significance level controls the Type I error rate. If α=0.05\alpha = 0.05α=0.05, the test procedure allows a Type I error rate of 5%5\%5% under the conditions of the test. Choosing a smaller α\alphaα makes the standard for rejecting H0H_0H0​ more demanding.

For example, if a p-value is 0.020.020.02 and the chosen significance level is 0.050.050.05, the result meets the rejection criterion. The procedure’s Type I error threshold is 0.050.050.05, while the observed p-value is the probability of a result at least as extreme as the one obtained under H0H_0H0​.

A p-value below α\alphaα does not guarantee that the particular conclusion is correct. It means the result satisfies the preselected rule for rejecting the null hypothesis.

Significance depends on context

The appropriate significance level depends on the consequences of a false rejection and the standards of the field. A threshold of 0.050.050.05 is common in many applications, but other contexts may require a more or less stringent threshold. For example, a process requiring extremely precise control may call for a much smaller acceptable error rate.

Reporting the p-value allows readers to see the strength of the statistical evidence and interpret it in context, rather than seeing only whether it crossed a selected cutoff.


Example: testing a treatment’s effect on cognitive scores

Suppose researchers want to investigate whether an antioxidant treatment affects cognitive test scores among elderly people.

The population is known to have a mean score of 454545 and a standard deviation of 999. A sample of 161616 people receives the treatment, and the sample’s mean score after treatment is 50.250.250.2.

Step 1: State the hypotheses

If the research question is whether the treatment changes scores in either direction, the hypotheses are

H0:μ=45H_0: \mu = 45H0​:μ=45
H1:μ≠45H_1: \mu \ne 45H1​:μ=45

This is a two-tailed test. Although the observed mean is higher than 454545, selecting an upper-tailed test only after seeing that result would not be justified. An upper-tailed alternative would be appropriate if an increase had been specified in advance based on prior reasoning.

Step 2: Calculate the standard error

Because the population standard deviation is known, the standard error of the sample mean is

SExˉ=σnSE_{\bar{x}} = \frac{\sigma}{\sqrt{n}}SExˉ​=n​σ​

With σ=9\sigma = 9σ=9 and n=16n = 16n=16,

SExˉ=916=94=2.25SE_{\bar{x}} = \frac{9}{\sqrt{16}} = \frac{9}{4} = 2.25SExˉ​=16​9​=49​=2.25

The standard error describes the expected variability of sample means, rather than the variability of individual scores.

Step 3: Calculate the zzz-test statistic

The test statistic measures how far the observed sample mean is from the null-hypothesis mean in standard-error units:

z=xˉ−μ0σ/nz = \frac{\bar{x} - \mu_0}{\sigma / \sqrt{n}}z=σ/n​xˉ−μ0​​

Substituting the values gives

z=50.2−459/16=5.22.25≈2.311z = \frac{50.2 - 45}{9 / \sqrt{16}} = \frac{5.2}{2.25} \approx 2.311z=9/16​50.2−45​=2.255.2​≈2.311

The observed sample mean is approximately 2.3112.3112.311 standard errors above the null-hypothesis mean.

Step 4: Find the p-value

For a two-tailed test, evidence as extreme as z≈2.311z \approx 2.311z≈2.311 includes values at least that far above or below zero:

p=P(Z≥2.311)+P(Z≤−2.311)p = P(Z \ge 2.311) + P(Z \le -2.311)p=P(Z≥2.311)+P(Z≤−2.311)

For the standard normal distribution, the upper-tail probability is approximately 0.01040.01040.0104. By symmetry, the lower-tail probability is the same, so

p≈2(0.0104)=0.0208p \approx 2(0.0104) = 0.0208p≈2(0.0104)=0.0208

The two-tailed p-value is therefore approximately 0.02080.02080.0208.

Step 5: Interpret the result

If the significance level is α=0.05\alpha = 0.05α=0.05, then p<αp < \alphap<α. The test rejects H0H_0H0​ at that level: the sample provides evidence that the population mean after treatment differs from 454545.

The result does not prove that the treatment caused the difference, establish the exact population mean, or show that the effect is practically important. It addresses the statistical evidence against the specified null hypothesis.

A follow-up study could investigate the specific directional claim that the treatment increases the mean, provided that claim is specified before collecting the new data. Replication with new data can help assess whether the finding is consistent.


Effect size and Cohen’s ddd

Statistical significance and effect size answer different questions. A hypothesis test evaluates how surprising the data are under the null hypothesis. Effect size describes the magnitude of the difference.

Cohen’s ddd expresses the difference between two means in standard-deviation units:

d=difference between meansstandard deviationd = \frac{\text{difference between means}}{\text{standard deviation}}d=standard deviationdifference between means​

For the cognitive-score example,

d=50.2−459=5.29≈0.58d = \frac{50.2 - 45}{9} = \frac{5.2}{9} \approx 0.58d=950.2−45​=95.2​≈0.58

Thus, the observed mean is approximately 0.580.580.58 standard deviations above the reference mean.

Cohen’s ddd uses the standard deviation rather than the standard error. It therefore describes the standardized size of the difference without scaling the difference according to sample size. By contrast, the zzz statistic for a sample mean uses the standard error, which depends on sample size. As a result, statistical significance and effect size should not be treated as interchangeable: one describes evidence against a null hypothesis, while the other describes the magnitude of the observed difference.

Ask anything

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

FlashcardsQuizFill in the blanksWritten testLessonNotesPodcastContent