Module 04
Hypothesis Tests
4.1 Developing Null and Alternative Hypotheses,
Type I and Type II Errors, Population Mean: Known Population Mean: Unknown Inference About Means
and Proportions with Two Populations-Inferences About Population Variances, Inferences About a
Population Variance, Inferences About Two Population Variances
4.2 Tests of Goodness of Fit and Independence, Goodness of Fit Test: A Multinomial Population, Test of
Independence
1.] Define null and alternative hypotheses with an example.
Ans: A null hypothesis and an alternative hypothesis are two opposing statements used in statistical
hypothesis testing.
The null hypothesis (H₀) is the default assumption that there is no effect, no difference, or no change in the
population. It represents the status quo and is considered true unless there is strong evidence against it.
The alternative hypothesis (Ha) is what the researcher wants to prove; it states that there is an effect, a
difference, or a change.
For example,
if a company introduces a new drug and claims it improves recovery time,
• The null hypothesis would state that the drug has no effect on recovery time,
• While, The alternative hypothesis would state that the drug does improve recovery time. The goal of
hypothesis testing is to use sample data to determine which hypothesis is more likely to be true.
2.] Explain Type I and Type II errors with a real-life example.
Ans: Type I and Type II Errors – Detailed Explanation
In hypothesis testing, we begin with two hypotheses:
• Null Hypothesis (H₀): The default assumption (e.g., no difference, no effect).
• Alternative Hypothesis (H₁): The statement we want to test or prove (e.g., there is a difference or
effect).
When we perform a hypothesis test based on sample data, we can make two correct decisions or two types
of errors:
*Type I Error (False Positive)
A Type I error occurs when the null hypothesis is actually true, but we reject it based on our sample data.
It means we believe there is an effect or difference, but in reality, there isn't. This is also called a false alarm
or false positive.
• Probability of Type I Error = α (significance level)
This is usually set at 0.05 or 5%, meaning we accept a 5% chance of making this error.
*Type II Error (False Negative)
A Type II error happens when the null hypothesis is actually false, but we fail to reject it.
It means we miss detecting a real effect or difference. This is called a false negative or missed detection.
• Probability of Type II Error = β
Power of a test = 1 – β, which represents the ability to correctly detect a true effect.
#Real-Life Example: Medical Test
Let’s say a diagnostic test is used to detect whether a person has a particular disease.
• H₀ (Null Hypothesis): The person does not have the disease.
• H₁ (Alternative Hypothesis): The person has the disease.
Now, consider the possible outcomes:
1. Correct Decision – The test correctly identifies a healthy person as healthy (H₀ is true and not
rejected).
2. Correct Decision – The test correctly identifies a sick person as sick (H₀ is false and rejected).
3. Type I Error – The test says the person has the disease, but they are actually healthy.
This may cause unnecessary stress, treatment, and costs.
4. Type II Error – The test says the person is healthy, but they actually have the disease.
This can be dangerous because the real problem is missed and goes untreated.
3.] What is the difference between one-tailed and two-tailed tests?
Ans: One-Tailed Test:
A one-tailed test is used when you have a specific direction in mind for the change or effect you’re testing.
The alternative hypothesis (H₁) is directional, meaning you're only looking for evidence of a change in one
direction — either greater than or less than a specific value.
• Alternative Hypothesis (H₁): It suggests that the population parameter (like the mean) is greater than
or less than a specific value.
o Right-tailed test: H₁: μ > μ₀ (looking for values larger than μ₀).
o Left-tailed test: H₁: μ < μ₀ (looking for values smaller than μ₀).
• Example:
o Suppose a factory claims that their machine produces bolts with a mean length of 5 cm. You
want to test if the mean length is greater than 5 cm (right-tailed test).
▪ H₀: μ = 5 cm (null hypothesis: no change)
▪ H₁: μ > 5 cm (alternative hypothesis: the machine produces bolts longer than 5 cm)
Two-Tailed Test:
A two-tailed test is used when you want to test for the possibility of an effect in both directions — whether
the parameter is greater than or less than a specific value. This is a more general test where you're concerned
with detecting any significant difference, not just a specific direction.
• Alternative Hypothesis (H₁): It suggests that the population parameter is not equal to a specific value.
o H₁: μ ≠ μ₀ (looking for values either greater than or less than μ₀).
• Example:
o A teacher wants to know if a new teaching method leads to a different average score
compared to the standard method (the teacher isn’t sure whether it will increase or decrease
the scores).
▪ H₀: μ = μ₀ (null hypothesis: no difference in means)
▪ H₁: μ ≠ μ₀ (alternative hypothesis: there is a difference)
Key Differences:
Aspect One-Tailed Test Two-Tailed Test
Tests for a change in one direction (either Tests for a change in either direction (both
Direction of test
greater than or less than) greater than and less than)
Alternative
μ > μ₀ or μ < μ₀ μ ≠ μ₀
Hypothesis (H₁)
Critical Region Only one tail (left or right) Both tails of the distribution
A test for whether the mean is greater A test for whether the mean is different
Example
than a value from a value
When you're testing for a change in a When you're testing for any change,
Use Case
specific direction regardless of direction
In summary:
• One-tailed tests are used when you have a specific direction in mind (either greater or smaller).
• Two-tailed tests are used when you're looking for any difference, without specifying the direction of
the change.
4.] When do you use a Z-test vs. a t-test?
Ans: Z-test:
You should use a Z-test when:
1. The population standard deviation (σ) is known:
If you know the population standard deviation, you can use the Z-test because it assumes that the
distribution of the sample mean follows a normal distribution.
2. The sample size (n) is large (typically n ≥ 30):
For larger sample sizes, the sample mean tends to follow a normal distribution (due to the Central
Limit Theorem), so the Z-test is appropriate, even if you don’t know the population standard
deviation.
3. You are comparing sample means to a known population mean (in the case of a one-sample Z-test),
or comparing means of two independent groups (in the case of a two-sample Z-test with known
standard deviations).
Example:
You want to test whether the average height of a population of students is 170 cm. You know the population
standard deviation is 10 cm, and you have a sample size of 50 students.
• You would use a Z-test because the population standard deviation is known and the sample size is
large.
T-test:
You should use a t-test when:
1. The population standard deviation (σ) is unknown:
If you don't know the population standard deviation, you use the sample standard deviation (s)
instead. This introduces more uncertainty, which is why the t-distribution is used to account for this
variability.
2. The sample size (n) is small (typically n < 30):
When the sample size is small, the t-distribution is more appropriate because it accounts for the
additional uncertainty introduced by estimating the population standard deviation.
3. You are comparing the sample mean to a population mean (one-sample t-test) or comparing the
means of two independent or paired groups (two-sample t-test or paired t-test).
Example 1:
You want to test whether the average exam score of a small class of 15 students is 80%. Since you don’t
know the population standard deviation, you would use a one-sample t-test.
5.] What is a goodness of fit test? Give an example.
Ans: A Goodness of Fit Test is a statistical test used to determine how well a sample data fits a theoretical
distribution or how well the observed frequencies match expected frequencies. It helps us assess whether the
distribution of a categorical variable matches the expected distribution based on a hypothesis
Purpose of Goodness of Fit Test:
The test is used to compare the observed frequency distribution of a variable to a expected frequency
distribution under a specific hypothesis. It's commonly used to see if data follows a specific distribution
(e.g., uniform, normal, Poisson).
Hypotheses:
• Null Hypothesis (H₀): The observed frequencies fit the expected distribution.
• Alternative Hypothesis (H₁): The observed frequencies do not fit the expected distribution.
Test Statistic:
The test statistic for the goodness of fit is the Chi-square statistic (χ²), calculated using the formula:
Where:
• Oi= Observed frequency in category i
• Ei = Expected frequency in category i
• The sum is taken over all categories.
Steps in Conducting a Goodness of Fit Test:
1. State the hypotheses (H₀ and H₁).
2. Calculate the expected frequencies based on the distribution or hypothesis being tested.
3. Compute the Chi-square statistic (χ²) using the observed and expected frequencies.
4. Determine the degrees of freedom: df=k−1, where k is the number of categories.
5. Find the critical value from the Chi-square distribution table based on the chosen significance level
(α) and degrees of freedom.
6. Compare the Chi-square statistic to the critical value: