Unit 6 - Notes
Unit 6: Testing of Hypothesis
1. Core Concepts of Hypothesis Testing
Hypothesis testing is a statistical method used to make decisions or draw conclusions about a population based on sample data. It involves testing an assumption (the hypothesis) to determine its validity.
Key Terminology
- Hypothesis: A statement or claim about a population parameter (e.g., population mean μ, population proportion p).
- Null Hypothesis (H₀): A statement of "no effect" or "no difference." It is the default assumption that we seek to find evidence against. It always contains an equality sign (=, ≤, or ≥).
- Example: The average height of students is 175 cm (H₀: μ = 175).
- Alternative Hypothesis (H₁ or Hₐ): A statement that contradicts the null hypothesis. It represents the researcher's claim or theory. It contains a strict inequality sign (≠, <, or >).
- Example: The average height of students is not 175 cm (H₁: μ ≠ 175).
- Level of Significance (α): The probability of rejecting the null hypothesis when it is actually true. It represents the maximum risk of making a Type I error that the researcher is willing to accept. Common values are 0.05 (5%), 0.01 (1%), and 0.10 (10%).
- Test Statistic: A value calculated from the sample data that is used to decide whether to reject the null hypothesis. Its formula depends on the specific test being used (e.g., Z, t, F, χ²).
- Critical Region (Rejection Region): The set of all values of the test statistic that would cause us to reject the null hypothesis. The size of this region is determined by the level of significance (α).
- Critical Value(s): The boundary value(s) that separate the critical region from the non-rejection region.
- p-value: The probability of obtaining a test statistic as extreme as, or more extreme than, the one observed, assuming the null hypothesis is true.
- Decision Rule with p-value: If p-value ≤ α, reject H₀. If p-value > α, fail to reject H₀.
The General Procedure of Hypothesis Testing
- State the Hypotheses: Define the null (H₀) and alternative (H₁) hypotheses.
- Set the Significance Level (α): Choose a value for α (e.g., 0.05).
- Choose the Appropriate Test: Select the correct statistical test based on the data type, sample size, and assumptions.
- Calculate the Test Statistic: Compute the value of the test statistic from the sample data.
- Determine the Critical Region or p-value:
- Critical Value Method: Find the critical value(s) from the appropriate statistical table (Z, t, F, χ²).
- P-value Method: Calculate the p-value corresponding to the test statistic.
- Make a Decision:
- Critical Value Method: If the test statistic falls into the critical region, reject H₀. Otherwise, fail to reject H₀.
- P-value Method: If p-value ≤ α, reject H₀. Otherwise, fail to reject H₀.
- State the Conclusion: Interpret the decision in the context of the original problem.
2. Types of Error
In hypothesis testing, our decision is based on a sample, not the entire population, so there is always a chance of making an incorrect conclusion.
-
Type I Error (α):
- Definition: Rejecting the null hypothesis (H₀) when it is actually true.
- Analogy: A "false positive." Convicting an innocent person.
- Probability: The probability of committing a Type I error is denoted by α, the level of significance. We control this error by setting α.
- Consequence: Concluding there is an effect or difference when none exists.
-
Type II Error (β):
- Definition: Failing to reject the null hypothesis (H₀) when it is actually false.
- Analogy: A "false negative." Acquitting a guilty person.
- Probability: The probability of committing a Type II error is denoted by β.
- Consequence: Missing a real effect or difference.
Relationship between α, β, and Sample Size (n)
| Decision Made | H₀ is True | H₀ is False |
|---|---|---|
| Fail to Reject H₀ | Correct Decision (1-α) | Type II Error (β) |
| Reject H₀ | Type I Error (α) | Correct Decision (1-β) |
- Power of a Test (1-β): The probability of correctly rejecting a false null hypothesis. A more powerful test is better at detecting a real effect.
- Inverse Relationship: For a fixed sample size (n), decreasing α increases β, and vice versa. There is a trade-off.
- Effect of Sample Size: Increasing the sample size (n) can decrease both α and β simultaneously, thus increasing the power of the test.
3. Z-test for Single Mean
- Objective: To test a claim about a single population mean (μ) when the population standard deviation (σ) is known or the sample size is large.
- When to Use:
- The sample size is large (n ≥ 30) OR
- The population standard deviation (σ) is known.
- Assumptions:
- The sample is a simple random sample.
- The population is normally distributed, or the Central Limit Theorem (CLT) applies (due to n ≥ 30).
Hypotheses and Test Statistic
| Test Type | Null Hypothesis (H₀) | Alternative Hypothesis (H₁) |
|---|---|---|
| Two-tailed | μ = μ₀ | μ ≠ μ₀ |
| Right-tailed | μ ≤ μ₀ | μ > μ₀ |
| Left-tailed | μ ≥ μ₀ | μ < μ₀ |
Test Statistic Formula:
Z = (x̄ - μ₀) / (σ / √n)
Where:
x̄= Sample meanμ₀= Hypothesized population mean (from H₀)σ= Population standard deviation (if unknown and n ≥ 30, use sample standard deviations)n= Sample size
Decision Rule
-
Critical Value Method:
- Two-tailed: Reject H₀ if
|Z| > Zα/2. - Right-tailed: Reject H₀ if
Z > Zα. - Left-tailed: Reject H₀ if
Z < -Zα. - Common Critical Values: Z₀.₀₂₅ = 1.96, Z₀.₀₅ = 1.645, Z₀.₀₁ = 2.33.
- Two-tailed: Reject H₀ if
-
p-value Method:
- Calculate the p-value based on the calculated Z-score.
- Reject H₀ if p-value ≤ α.
4. Z-test for Difference of Means
- Objective: To compare the means of two independent populations (μ₁ and μ₂) when population standard deviations are known or sample sizes are large.
- When to Use:
- Samples are independent.
- Sample sizes are large (n₁ ≥ 30 and n₂ ≥ 30) OR
- Population standard deviations (σ₁ and σ₂) are known.
- Assumptions:
- The two samples are independent simple random samples.
- The populations are normally distributed, or the CLT applies.
Hypotheses and Test Statistic
| Test Type | Null Hypothesis (H₀) | Alternative Hypothesis (H₁) |
|---|---|---|
| Two-tailed | μ₁ = μ₂ (or μ₁ - μ₂ = 0) | μ₁ ≠ μ₂ (or μ₁ - μ₂ ≠ 0) |
| Right-tailed | μ₁ ≤ μ₂ (or μ₁ - μ₂ ≤ 0) | μ₁ > μ₂ (or μ₁ - μ₂ > 0) |
| Left-tailed | μ₁ ≥ μ₂ (or μ₁ - μ₂ ≥ 0) | μ₁ < μ₂ (or μ₁ - μ₂ < 0) |
Test Statistic Formula:
Z = ( (x̄₁ - x̄₂) - (μ₁ - μ₂)₀ ) / sqrt( (σ₁²/n₁) + (σ₂²/n₂) )
Where:
x̄₁,x̄₂= Means of sample 1 and sample 2(μ₁ - μ₂)₀= Hypothesized difference between population means (usually 0 from H₀)σ₁²,σ₂²= Variances of population 1 and population 2 (if unknown and samples are large, uses₁²ands₂²)n₁,n₂= Sizes of sample 1 and sample 2
Decision Rule
The decision rule is identical to the Z-test for a single mean, comparing the calculated Z-statistic to the critical Z-value or the p-value to α.
5. Student's t-test for Single Mean
- Objective: To test a claim about a single population mean (μ) when the population standard deviation (σ) is unknown and the sample size is small.
- When to Use:
- The sample size is small (n < 30).
- The population standard deviation (σ) is unknown.
- Assumptions:
- The sample is a simple random sample.
- The population from which the sample is drawn is approximately normally distributed.
Hypotheses and Test Statistic
The hypotheses are the same as for the Z-test for a single mean.
Test Statistic Formula:
t = (x̄ - μ₀) / (s / √n)
Where:
x̄= Sample meanμ₀= Hypothesized population means= Sample standard deviationn= Sample size
Degrees of Freedom (df): df = n - 1
Decision Rule
-
Critical Value Method:
- Find the critical t-value from the t-distribution table using the significance level (α) and degrees of freedom (df).
- Two-tailed: Reject H₀ if
|t| > tα/2, df. - Right-tailed: Reject H₀ if
t > tα, df. - Left-tailed: Reject H₀ if
t < -tα, df.
-
p-value Method:
- Calculate the p-value corresponding to the t-statistic and degrees of freedom.
- Reject H₀ if p-value ≤ α.
6. Student's t-test for Difference of Means (Independent Samples)
- Objective: To compare the means of two independent populations when population standard deviations are unknown and sample sizes are small.
- When to Use:
- Samples are independent.
- Sample sizes are small (n₁ < 30 or n₂ < 30).
- Population standard deviations (σ₁ and σ₂) are unknown but assumed to be equal.
- Assumptions:
- The two samples are independent simple random samples.
- The two populations are approximately normally distributed.
- The two populations have equal variances (σ₁² = σ₂²). (This can be checked with an F-test).
Hypotheses and Test Statistic
The hypotheses are the same as for the Z-test for the difference of means.
First, calculate the pooled sample variance (sₚ²), which is a weighted average of the two sample variances:
sₚ² = ( (n₁ - 1)s₁² + (n₂ - 1)s₂² ) / (n₁ + n₂ - 2)
Then, calculate the t-statistic:
t = ( (x̄₁ - x̄₂) - (μ₁ - μ₂)₀ ) / sqrt( sₚ² * ( (1/n₁) + (1/n₂) ) )
Degrees of Freedom (df): df = n₁ + n₂ - 2
Decision Rule
The decision rule is identical to the t-test for a single mean, using the calculated t-statistic, the degrees of freedom (n₁ + n₂ - 2), and the significance level α.
7. F-test for Equality of Two Variances
- Objective: To test the hypothesis that two independent populations have equal variances (σ₁² = σ₂²). This is often used as a preliminary test to decide whether to use the pooled t-test.
- When to Use: To compare the variances of two populations.
- Assumptions:
- The two samples are independent simple random samples.
- The two populations are normally distributed.
Hypotheses and Test Statistic
| Test Type | Null Hypothesis (H₀) | Alternative Hypothesis (H₁) |
|---|---|---|
| Two-tailed | σ₁² = σ₂² | σ₁² ≠ σ₂² |
| Right-tailed | σ₁² ≤ σ₂² | σ₁² > σ₂² |
Test Statistic Formula:
F = s₁² / s₂²
Where:
s₁²= Larger sample variances₂²= Smaller sample variance- By convention, place the larger variance in the numerator to make the test right-tailed.
Degrees of Freedom (df):
- Numerator degrees of freedom:
df₁ = n₁ - 1(where n₁ is the sample size for s₁²) - Denominator degrees of freedom:
df₂ = n₂ - 1(where n₂ is the sample size for s₂²)
Decision Rule
- Critical Value Method:
- Find the critical F-value from the F-distribution table using
α,df₁, anddf₂. For a two-tailed test, useα/2. - Reject H₀ if
F > F_critical.
- Find the critical F-value from the F-distribution table using
- p-value Method:
- Calculate the p-value corresponding to the F-statistic.
- Reject H₀ if p-value ≤ α.
8. Chi-Square (χ²) Test for Goodness of Fit
- Objective: To determine if the frequency distribution of a categorical variable from a sample is consistent with a claimed or theoretical population distribution.
- When to Use: To test how well a sample distribution fits a theoretical one (e.g., uniform, normal, Poisson).
- Assumptions:
- The data are obtained from a random sample.
- The data are categorical or can be grouped into categories.
- The expected frequency (E) for each category should be at least 5. If not, categories may need to be combined.
Hypotheses and Test Statistic
- H₀: The observed frequencies fit the expected (theoretical) distribution.
- H₁: The observed frequencies do not fit the expected (theoretical) distribution.
Test Statistic Formula:
χ² = Σ [ (O - E)² / E ]
Where:
O= Observed frequency in a category (from the sample data).E= Expected frequency in a category (calculated based on H₀).- The sum (Σ) is taken over all categories.
Degrees of Freedom (df):
df = k - 1 - m
Where:
k= Number of categories.m= Number of population parameters estimated from the sample data to calculate E.- If the expected frequencies are given or based on a fixed theory (e.g., a fair die),
m = 0. - If you use the sample mean to calculate expected Poisson frequencies,
m = 1.
- If the expected frequencies are given or based on a fixed theory (e.g., a fair die),
Decision Rule
The Chi-square goodness of fit test is always a right-tailed test. A small χ² value means the observed and expected values are close, supporting H₀. A large χ² value means they are far apart, providing evidence against H₀.
- Critical Value Method:
- Find the critical χ²-value from the Chi-square distribution table using
αanddf. - Reject H₀ if
χ²_calculated > χ²_critical.
- Find the critical χ²-value from the Chi-square distribution table using
- p-value Method:
- Calculate the p-value corresponding to the χ²-statistic.
- Reject H₀ if p-value ≤ α.