Introduction to Hypothesis Testing
Null and Alternative Hypotheses
Hypothesis testing is a statistical method used to make decisions about a population parameter based on sample data. It involves setting up two opposing hypotheses:
- Null Hypothesis (H0): This is a statement of no effect, no difference, or no relationship. It represents the status quo or a commonly accepted belief. We assume the null hypothesis is true until there is sufficient evidence to reject it.
- Alternative Hypothesis (H1 or Ha): This is a statement that contradicts the null hypothesis. It represents what we are trying to find evidence for. The alternative hypothesis can be one-sided (e.g., greater than or less than) or two-sided (e.g., not equal to).
Null Hypothesis (H0): A statement indicating no statistical significance, assumed true until evidence suggests otherwise.
Alternative Hypothesis (H1): A statement that contradicts the null hypothesis, representing the claim to be tested.
Examples:
- Testing if a new drug is better:
H0: The new drug has no effect (mean recovery time is the same as old drug).
H1: The new drug reduces recovery time (mean recovery time is less than old drug). - Testing if a coin is fair:
H0: The coin is fair (proportion of heads = 0.5).
H1: The coin is not fair (proportion of heads ≠ 0.5).
Level of Significance (α)
The level of significance, denoted by α (alpha), is the probability of rejecting the null hypothesis when it is actually true. It represents the maximum acceptable risk of making a Type I error. Common values for α are 0.05 (5%) and 0.01 (1%).
Level of Significance (α): The probability of rejecting a true null hypothesis, often set at 0.05 or 0.01.
A smaller α value means we require stronger evidence to reject H0, reducing the chance of a Type I error but increasing the chance of a Type II error.
Type I and Type II Errors, their Probabilities and Critical Region
In hypothesis testing, decisions are made under uncertainty, which means there's always a risk of making an incorrect decision. There are two types of errors:
- Type I Error (False Positive): This occurs when we reject the null hypothesis (H0) when it is actually true. The probability of making a Type I error is denoted by α (the level of significance).
- Type II Error (False Negative): This occurs when we fail to reject the null hypothesis (H0) when it is actually false. The probability of making a Type II error is denoted by β (beta).
Type I Error: Rejecting the null hypothesis when it is true (Probability = α).
Type II Error: Failing to reject the null hypothesis when it is false (Probability = β).
Relationship between α and β: Usually, if you decrease α, β tends to increase, and vice versa, for a fixed sample size. The power of a test is 1 - β, which is the probability of correctly rejecting a false null hypothesis.
| Decision | H0 is True | H0 is False |
|---|---|---|
| Reject H0 | Type I Error (α) | Correct Decision (Power = 1 - β) |
| Fail to Reject H0 | Correct Decision | Type II Error (β) |
Critical Region
The critical region (also known as the rejection region) is the set of values for the test statistic that leads to the rejection of the null hypothesis. These values are considered extreme enough to be unlikely if the null hypothesis were true. The boundaries of the critical region are determined by the level of significance (α) and the sampling distribution of the test statistic.
- For a two-tailed test, the critical region is split into two tails of the distribution.
- For a one-tailed test (left or right), the critical region is entirely in one tail.
Concept of p-value
The p-value (probability value) is a measure of the strength of evidence against the null hypothesis. It is the probability of observing a test statistic as extreme as, or more extreme than, the one calculated from the sample, assuming that the null hypothesis is true.
p-value: The probability of obtaining test results as extreme as the observed results, assuming the null hypothesis is true. A small p-value indicates strong evidence against the null hypothesis.
Interpreting the p-value:
- If p-value ≤ α: We reject the null hypothesis. The observed data are statistically significant, providing strong evidence against H0.
- If p-value > α: We fail to reject the null hypothesis. There is not enough evidence to conclude that H0 is false.
A smaller p-value means stronger evidence against H0.
Large Sample Tests using the Central Limit Theorem (CLT)
For large sample sizes (typically n ≥ 30), the Central Limit Theorem (CLT) allows us to assume that the sampling distribution of sample means or proportions will be approximately normal, regardless of the shape of the population distribution. This enables the use of Z-tests for hypothesis testing in various scenarios.
The general steps for large sample hypothesis testing are:
- State the null (H0) and alternative (H1) hypotheses.
- Choose a level of significance (α).
- Calculate the test statistic (Z-score) using sample data.
- Determine the critical value(s) or calculate the p-value.
- Make a decision: Reject H0 if the test statistic falls in the critical region or if p-value ≤ α; otherwise, fail to reject H0.
- State the conclusion in the context of the problem.
Testing Single Proportion
This test is used to determine if a sample proportion (p̂) is significantly different from a hypothesized population proportion (p0).
- Hypotheses:
H0: p = p0
H1: p ≠ p0 (two-tailed), p > p0 (right-tailed), or p < p0 (left-tailed) - Test Statistic (Z):
Z = (p̂ - p0) / √[p0(1 - p0) / n]
Where:- p̂ is the sample proportion (x/n)
- p0 is the hypothesized population proportion
- n is the sample size
- Decision Rule: Compare the calculated Z-value with the critical Z-value(s) from the standard normal distribution based on α and the type of test (one-tailed or two-tailed). Alternatively, compare the p-value with α.
Testing Difference of Two Proportions
This test compares two sample proportions (p̂1 and p̂2) to determine if there is a significant difference between their corresponding population proportions (p1 and p2).
- Hypotheses:
H0: p1 = p2 (or p1 - p2 = 0)
H1: p1 ≠ p2 (two-tailed), p1 > p2 (right-tailed), or p1 < p2 (left-tailed) - Pooled Proportion (p̂c): Used under H0 when p1 = p2.
p̂c = (x1 + x2) / (n1 + n2)
- Test Statistic (Z):
Z = (p̂1 - p̂2) / √[p̂c(1 - p̂c)(1/n1 + 1/n2)]
Where:- p̂1 = x1/n1 and p̂2 = x2/n2 are the sample proportions
- n1 and n2 are the sample sizes
- Decision Rule: Same as for a single proportion test.
Testing Single Mean
This test determines if a sample mean (x̄) is significantly different from a hypothesized population mean (μ0).
- Hypotheses:
H0: μ = μ0
H1: μ ≠ μ0 (two-tailed), μ > μ0 (right-tailed), or μ < μ0 (left-tailed) - Test Statistic (Z):
If population standard deviation (σ) is known:Z = (x̄ - μ0) / (σ / √n)
If population standard deviation (σ) is unknown but sample size (n) is large (typically n ≥ 30), we use the sample standard deviation (s) as an estimate for σ:Z = (x̄ - μ0) / (s / √n)
Where:- x̄ is the sample mean
- μ0 is the hypothesized population mean
- σ is the population standard deviation (or s, sample standard deviation, for large n)
- n is the sample size
- Decision Rule: Same as for proportion tests.
Testing Difference of Two Means
This test compares two sample means (x̄1 and x̄2) to determine if there is a significant difference between their corresponding population means (μ1 and μ2).
- Hypotheses:
H0: μ1 = μ2 (or μ1 - μ2 = 0)
H1: μ1 ≠ μ2 (two-tailed), μ1 > μ2 (right-tailed), or μ1 < μ2 (left-tailed) - Test Statistic (Z):
If population standard deviations (σ1 and σ2) are known:Z = (x̄1 - x̄2) / √(σ12/n1 + σ22/n2)
If population standard deviations (σ1 and σ2) are unknown but sample sizes (n1 and n2) are large (n1, n2 ≥ 30), we use sample standard deviations (s1 and s2) as estimates:Z = (x̄1 - x̄2) / √(s12/n1 + s22/n2)
Where:- x̄1 and x̄2 are the sample means
- n1 and n2 are the sample sizes
- σ1, σ2 (or s1, s2) are the standard deviations
- Decision Rule: Same as for other Z-tests.
Testing Standard Deviation and Difference of Standard Deviations
While standard tests for population variance or standard deviation often use the Chi-square (χ2) distribution for a single variance and the F-distribution for comparing two variances, the Central Limit Theorem can be applied for large samples to approximate the sampling distribution of the sample standard deviation itself as normal, allowing for Z-tests.
Testing Single Standard Deviation
This test is used to determine if a sample standard deviation (s) is significantly different from a hypothesized population standard deviation (σ0) for large samples.
- Hypotheses:
H0: σ = σ0
H1: σ ≠ σ0 (two-tailed), σ > σ0 (right-tailed), or σ < σ0 (left-tailed) - Test Statistic (Z) for large samples:
For large samples, the sampling distribution of s is approximately normal with mean σ and standard deviation σ / √[2(n-1)].Z = (s - σ0) / (σ0 / √[2(n-1)])
Where:- s is the sample standard deviation
- σ0 is the hypothesized population standard deviation
- n is the sample size
- Decision Rule: Compare the calculated Z-value with the critical Z-value(s).
Testing Difference of Two Standard Deviations
This test is used to compare two sample standard deviations (s1 and s2) to determine if there is a significant difference between their corresponding population standard deviations (σ1 and σ2) for large samples.
- Hypotheses:
H0: σ1 = σ2 (or σ1 - σ2 = 0)
H1: σ1 ≠ σ2 (two-tailed), σ1 > σ2 (right-tailed), or σ1 < σ2 (left-tailed) - Test Statistic (Z) for large samples:
For large samples, the difference (s1 - s2) is approximately normally distributed. If H0 is true (σ1 = σ2 = σ), we can use a pooled estimate for σ or assume they are approximately equal.Z = (s1 - s2) / √[σ12 / (2n1) + σ22 / (2n2)]
Under H0: σ1 = σ2 = σ, the formula simplifies to:Z = (s1 - s2) / (σ √[1/(2n1) + 1/(2n2)])
If σ is unknown, for large samples, sample standard deviations (s1 and s2) can be used as estimates:Z = (s1 - s2) / √[s12 / (2n1) + s22 / (2n2)]
Where:- s1 and s2 are the sample standard deviations
- n1 and n2 are the sample sizes
- σ is the common population standard deviation under H0 (if applicable)
- Decision Rule: Compare the calculated Z-value with the critical Z-value(s).