1. Home
  2. Explore
  3. Mathematics
  4. Hypothesis Testing Basics

Study methods

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

Hypothesis Testing Basics

Hypothesis Testing

Hypothesis testing uses sample data to test claims about population parameters. The process determines whether an assumed population value (mean, proportion, variance, etc.) is still valid or has shifted. This is similar to confidence intervals, where sample data estimates a range of plausible values, but hypothesis testing directly evaluates a specific claimed value.

The Five-Step Process

Hypothesis testing follows a structured procedure with five main steps:

  1. Identify the hypotheses – the null and alternative statements

  2. Compute the test statistic – a value from sample data that measures how far the sample result is from the assumed population value

  3. Determine critical values or the p-value – these provide a decision rule

  4. Make a decision – reject or fail to reject the null hypothesis

  5. Summarize the conclusion – state the result in the context of the original problem


Step 1: State the Hypotheses

Two competing statements are set up:

  • Null hypothesis (H0H_0H0​): The statement of no change, no effect, or the assumed value. It always contains an equality (===, ≤\leq≤, ≥\geq≥ but typically just ===). It represents the current belief or the value under test.

    • For the mean: H0:μ=μ0H_0: \mu = \mu_0H0​:μ=μ0​

    • For the proportion: H0:p=p0H_0: p = p_0H0​:p=p0​

    • For the standard deviation/variance: H0:σ=σ0H_0: \sigma = \sigma_0H0​:σ=σ0​ or H0:σ2=σ02H_0: \sigma^2 = \sigma_0^2H0​:σ2=σ02​

  • Alternative hypothesis (H1H_1H1​ or HaH_aHa​): The statement that challenges the null, indicating a possible change. It uses an inequality (<<<, >>>, ≠\neq=). The direction determines the type of test.

    • Left-tailed: H1:μ<μ0H_1: \mu < \mu_0H1​:μ<μ0​ (parameter less than assumed value)

    • Right-tailed: H1:μ>μ0H_1: \mu > \mu_0H1​:μ>μ0​ (parameter greater than assumed value)

    • Two-tailed: H1:μ≠μ0H_1: \mu \neq \mu_0H1​:μ=μ0​ (parameter different from assumed value)

The alternative hypothesis is based on the researcher's claim or suspicion, and its form dictates whether the test is one-tailed (left or right) or two-tailed.

Key Point: The null hypothesis always contains the equality, and the alternative contains the inequality. The value in both hypotheses comes from the assumed population parameter (the value under test).


Step 2: Compute the Test Statistic

The test statistic is a standardized score computed from sample data. It measures how far the sample result lies from the null hypothesis value, relative to the expected variability. The formula depends on the parameter being tested.

For a Proportion (ppp)

When testing a population proportion, the test statistic is a z-score:

z=p^−p0p0(1−p0)nz = \frac{\hat{p} - p_0}{\sqrt{\frac{p_0 (1 - p_0)}{n}}}z=np0​(1−p0​)​​p^​−p0​​

Where:

  • p^=xn\hat{p} = \frac{x}{n}p^​=nx​ is the sample proportion (number of successes divided by sample size)

  • p0p_0p0​ is the hypothesized population proportion from H0H_0H0​

  • nnn is the sample size

For a Mean (μ\muμ)

  • If the population standard deviation (σ\sigmaσ) is known (rare in practice): use a z-score

z=xˉ−μ0σ/nz = \frac{\bar{x} - \mu_0}{\sigma / \sqrt{n}}z=σ/n​xˉ−μ0​​
  • If σ\sigmaσ is unknown (most common): use a t-score (Student's t distribution)

t=xˉ−μ0s/nt = \frac{\bar{x} - \mu_0}{s / \sqrt{n}}t=s/n​xˉ−μ0​​

Where:

  • xˉ\bar{x}xˉ is the sample mean

  • μ0\mu_0μ0​ is the hypothesized population mean from H0H_0H0​

  • sss is the sample standard deviation

  • nnn is the sample size

  • Degrees of freedom: df=n−1df = n - 1df=n−1

For a Standard Deviation or Variance (σ\sigmaσ or σ2\sigma^2σ2)

The test statistic follows a chi-square (χ2\chi^2χ2) distribution:

χ2=(n−1)s2σ02\chi^2 = \frac{(n - 1) s^2}{\sigma_0^2}χ2=σ02​(n−1)s2​

Where:

  • s2s^2s2 is the sample variance

  • σ02\sigma_0^2σ02​ is the hypothesized population variance from H0H_0H0​

  • nnn is the sample size

  • Degrees of freedom: df=n−1df = n - 1df=n−1

Note: The chi-square distribution is used only for tests about variability (standard deviation or variance), not for means or proportions.


Step 3: Determine the Decision Rule (Critical Value or p-value)

Two common methods exist for deciding whether to reject the null hypothesis. Both require a significance level, denoted α\alphaα (alpha). α\alphaα is the probability of making a Type I error — rejecting a true null hypothesis. Common values are 0.01 (1%), 0.05 (5%), and 0.10 (10%). α\alphaα is chosen before the test.

Method A: Critical Value Approach

Critical values are cutoff points from the sampling distribution (z, t, or χ2\chi^2χ2) that mark the boundary of the rejection region. The rejection region is the set of test statistic values that would lead to rejecting H0H_0H0​ at the given α\alphaα.

  • Left-tailed test (H1H_1H1​ uses <<<): The rejection region is in the left tail, area α\alphaα below the critical value. For a z-test, the critical value is negative (e.g., zαz_{\alpha}zα​).

  • Right-tailed test (H1H_1H1​ uses >>>): The rejection region is in the right tail, area α\alphaα above the critical value. For a z-test, the critical value is positive (e.g., zαz_{\alpha}zα​).

  • Two-tailed test (H1H_1H1​ uses ≠\neq=): The rejection region is split equally between both tails, each with area α/2\alpha/2α/2. Two critical values: one negative, one positive (e.g., zα/2z_{\alpha/2}zα/2​ and −zα/2-z_{\alpha/2}−zα/2​).

Decision rule: If the test statistic falls inside the rejection region (i.e., beyond the critical value in the direction of the alternative), reject H0H_0H0​. Otherwise, fail to reject H0H_0H0​.

Method B: p-value Approach

The p-value is the probability of observing a test statistic as extreme as (or more extreme than) the one computed from the sample, assuming the null hypothesis is true. It represents the strength of evidence against H0H_0H0​.

  • For a left-tailed test: p-value = area to the left of the test statistic

  • For a right-tailed test: p-value = area to the right of the test statistic

  • For a two-tailed test: p-value = 2 ×\times× (area in the tail beyond the test statistic, in the direction of the extreme)

Decision rule:

  • If p-value ≤α\leq \alpha≤α, reject H0H_0H0​. The sample result is too unlikely to occur by random chance alone at the chosen significance level.

  • If p-value >α> \alpha>α, fail to reject H0H_0H0​. The sample result is not sufficiently unusual.

Key Insight: The p-value method is generally preferred when using statistical software, as it directly provides the probability. The critical value method gives a visual cutoff but requires looking up values from tables or calculators.


Step 4: Make the Decision

Based on either the critical value or p-value comparison, the decision is one of two outcomes:

  • Reject H0H_0H0​: The sample data provides enough evidence to conclude that the null hypothesis is not true. The assumed population parameter appears to have changed.

  • Fail to reject H0H_0H0​: The sample data does not provide sufficient evidence to conclude that the null hypothesis is false. The assumed value remains plausible.

Important Note: "Fail to reject" does not mean "accept" the null hypothesis. It simply means the evidence is not strong enough to reject it. The null hypothesis might still be false, but the test didn't detect the difference.


Step 5: Summarize the Conclusion

The conclusion must be written in the context of the original research question. It should clearly state whether there is sufficient evidence to support the alternative claim.

Phrases used:

  • If reject H0H_0H0​: "There is sufficient evidence to conclude that [state the alternative in context]."

  • If fail to reject H0H_0H0​: "There is not sufficient evidence to conclude that [state the alternative in context]."

For example, if testing whether a new drug reduces blood pressure (with H1:μ<120H_1: \mu < 120H1​:μ<120):

  • Reject: "The data provide sufficient evidence that the drug reduces blood pressure below 120."

  • Fail to reject: "The data do not provide sufficient evidence that the drug reduces blood pressure below 120."


Worked Example: One-Proportion z-Test

Problem: A survey claims that 38% of Americans will not eat carbs this Thanksgiving. A dietitian believes the proportion is actually lower. A random sample of 150 residents shows that 48 said they will not eat carbs. Test the dietitian's claim at the 5% significance level.

Step 1: Hypotheses

  • H0:p=0.38H_0: p = 0.38H0​:p=0.38 (the assumed proportion)

  • H1:p<0.38H_1: p < 0.38H1​:p<0.38 (the dietitian's claim — lower)

Step 2: Test Statistic

  • Sample proportion: p^=48150=0.32\hat{p} = \frac{48}{150} = 0.32p^​=15048​=0.32

  • Null proportion: p0=0.38p_0 = 0.38p0​=0.38

  • Sample size: n=150n = 150n=150

  • Compute z-score:

z=0.32−0.380.38×(1−0.38)150=−0.060.38×0.62150z = \frac{0.32 - 0.38}{\sqrt{\frac{0.38 \times (1 - 0.38)}{150}}} = \frac{-0.06}{\sqrt{\frac{0.38 \times 0.62}{150}}}z=1500.38×(1−0.38)​​0.32−0.38​=1500.38×0.62​​−0.06​
Denominator=0.2356150=0.0015707≈0.03963\text{Denominator} = \sqrt{\frac{0.2356}{150}} = \sqrt{0.0015707} \approx 0.03963Denominator=1500.2356​​=0.0015707​≈0.03963
z≈−0.060.03963≈−1.51(rounded to two decimal places)z \approx \frac{-0.06}{0.03963} \approx -1.51 \quad (\text{rounded to two decimal places})z≈0.03963−0.06​≈−1.51(rounded to two decimal places)

Step 3: Decision Rule (p-value method)

  • Significance level: α=0.05\alpha = 0.05α=0.05

  • This is a left-tailed test, so p-value = area to the left of z=−1.51z = -1.51z=−1.51 under the standard normal curve.

  • Using software or a z-table: p-value ≈0.0655\approx 0.0655≈0.0655

Step 4: Decision

  • Compare p-value to α\alphaα: 0.0655>0.050.0655 > 0.050.0655>0.05

  • Since p-value >α\gt \alpha>α, we fail to reject H0H_0H0​.

Step 5: Conclusion

  • "There is not sufficient evidence at the 5% significance level to conclude that the proportion of Americans who will not eat carbs this Thanksgiving is less than 38%."

Note on Critical Value Method: For a left-tailed test with α=0.05\alpha = 0.05α=0.05, the critical z-value is zα=−1.645z_{\alpha} = -1.645zα​=−1.645. Since the test statistic z=−1.51z = -1.51z=−1.51 is greater than −1.645-1.645−1.645 (i.e., lies to the right of the critical value, outside the rejection region), we fail to reject H0H_0H0​ — the same conclusion.


Using Software (StatCrunch)

Statistical software like StatCrunch simplifies the computation. For hypothesis tests:

  • For proportions: Stat → Proportion Stats → One Sample → With Summary → enter number of successes (x), sample size (n), null proportion (p0p_0p0​), and select the alternative hypothesis direction (<<<, >>>, ≠\neq=). Choose "Hypothesis test" and set the significance level. Check "Show critical value" if desired. The output provides the test statistic (Z-stat), p-value, and critical value.

  • For means (unknown σ\sigmaσ): Stat → T Stats → One Sample → With Summary → enter sample mean, sample standard deviation, sample size. Set the null mean and alternative direction. The output gives the t-statistic, p-value, and critical t-value.

  • For means (known σ\sigmaσ): Stat → Z Stats → One Sample → With Summary (rarely used)

  • For standard deviation/variance: Stat → Variance Stats → One Sample → With Summary → enter sample variance (or standard deviation) and sample size. The output gives the chi-square statistic and p-value.

Two-sample tests follow a similar pattern under "Two Sample" options.


Two-Population Hypothesis Tests (Introduction)

The same five-step process extends to comparing two populations. The hypotheses now involve the difference between two parameters.

  • For two proportions: H0:p1=p2H_0: p_1 = p_2H0​:p1​=p2​ (or p1−p2=0p_1 - p_2 = 0p1​−p2​=0); H1:p1≠p2H_1: p_1 \neq p_2H1​:p1​=p2​ (or p1<p2p_1 < p_2p1​<p2​, p1>p2p_1 > p_2p1​>p2​)

  • For two means: H0:μ1=μ2H_0: \mu_1 = \mu_2H0​:μ1​=μ2​ (or μ1−μ2=0\mu_1 - \mu_2 = 0μ1​−μ2​=0); H1:μ1≠μ2H_1: \mu_1 \neq \mu_2H1​:μ1​=μ2​ (or μ1<μ2\mu_1 < \mu_2μ1​<μ2​, μ1>μ2\mu_1 > \mu_2μ1​>μ2​)

  • For two variances/standard deviations: H0:σ12=σ22H_0: \sigma_1^2 = \sigma_2^2H0​:σ12​=σ22​; H1:σ12≠σ22H_1: \sigma_1^2 \neq \sigma_2^2H1​:σ12​=σ22​ (usually using an F-test)

The test statistics use pooled or unpooled estimates. The decision and conclusion steps are analogous. For example, in StatCrunch for two independent sample means, use Stat → T Stats → Two Sample → With Summary, enter sample statistics for both groups, set the null difference to 0, and choose the appropriate alternative. The output provides a t-statistic and p-value.

Takeaway: The logic of hypothesis testing — form hypotheses, compute a test statistic, compare to a critical value or p-value, make a decision, and state a conclusion — remains identical whether testing one parameter or comparing two. Only the formulas and distributions change according to the parameter type and sample design.

Ask anything

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

FlashcardsQuizFill in the blanksWritten testLessonNotesPodcastContent