Statistics II · Unit 2 · 8 hrs
Testing of hypothesis
Exam-focused notes for Testing of hypothesis (Statistics II, STA215): what the TU syllabus asks and how it has actually been tested, with 12 solved past questions from this unit.
Testing of hypothesis in short
Hypothesis testing turns a claim about a population parameter into a formal decision procedure: state two competing hypotheses, compute a test statistic from a sample, and decide which hypothesis the evidence supports.
What this unit covers
- Types of statistical hypotheses
- Power of the test, concept of p-value and use of p-value in decision making
- steps used in testing of hypothesis
- one sample tests for mean of normal population (for known and unknown variance)
- test for single proportion
- test for difference between two means and two proportions
- paired sample t-test
- Linkage between confidence interval and testing of hypothesis
- Problems and illustrative examples related to computer Science and IT
paired sample t-test
2079 · 10 marks
Hypothesis Testing: Type I and Type II Errors
Define Type I and Type II error in testing of hypothesis. A psychologist wishes to verify that a certain drug increases the reaction time to given stimulus. The following reaction times (in tenth of seconds) were recorded before and after injection of the drug for each of four subjects. Test at 5% level of significance to determine whether the drug significantly increases the reaction time.
| Reaction Time | Subject 1 | Subject 2 | Subject 3 | Subject 4 |
|---|---|---|---|---|
| Before | 7 | 2 | 12 | 12 |
| After | 13 | 3 | 18 | 13 |
[10]
one sample tests for mean of normal population
2081 · 5 marks
The mean drying time of a brand of spray paint is known to be 122 seconds. The research division of the company that produces this paint contemplates that adding a new chemical ingredient to the paint accelerate the drying process. To investigate this conjecture, the paint with the chemical additions is sprayed on 50 surfaces and the drying time is recorded. The mean and standard deviation of drying time computed from these recorded are found as 116 seconds and 16.8 seconds respectively. Does these data provide strong evidence that the mean drying time is reduced by the addition of the new chemical? Use 5% level of significance. Also find p-value. [5]
Show solved answerHide answer
Hypothesis Test: Mean Drying Time of Spray Paint
Given Data
- Population (claimed) mean: $\mu_0 = 122$ seconds
- Sample size: $n = 50$
- Sample mean: $\bar{X} = 116$ seconds
- Sample standard deviation: $s = 16.8$ seconds
- Significance level: $\alpha = 0.05$
Step 1: Hypotheses
- $H_0: \mu = 122$ (no reduction)
- $H_1: \mu < 122$ (drying time reduced) - left-tailed test
Step 2: Test Statistic
Since $n = 50 > 30$, use the Z-test: $$Z = \frac{\bar{X} - \mu_0}{s/\sqrt{n}}$$
Step 3: Calculation
$$s/\sqrt{n} = \frac{16.8}{\sqrt{50}} = \frac{16.8}{7.0711} = 2.3759$$
$$Z = \frac{116 - 122}{2.3759} = \frac{-6}{2.3759} = -2.525$$
Step 4: Critical Value
Left-tailed at $\alpha = 0.05$: $Z_{tab} = -1.645$
Step 5: Decision
Since $Z_{cal} = -2.525 < -1.645$, we reject $H_0$.
Step 6: P-value
$$p = P(Z < -2.525) = 1 - P(Z < 2.525) = 1 - 0.9942 = 0.0058$$
Since $p = 0.0058 < \alpha = 0.05$, reject $H_0$.
Conclusion
The data provide strong evidence at the 5% level of significance that the new chemical additive reduces the mean drying time below 122 seconds. The small p-value ($\approx 0.0058$) confirms high significance.
2078 · 5 marks
Hypothesis Testing for Average Age of CSIT Students
Step 1: Set up Hypotheses
- Null Hypothesis (H₀): $\mu = 22$ (The average age of enrolling students is 22 years)
- Alternative Hypothesis (H₁): $\mu < 22$ (The average age is less than 22 years)
This is a left-tailed test at 5% level of significance.
Step 2: Sample Data
| 20 | 19 | 22 | 23 | 19 | 20 | 20 | 21 | 22 | 20 | 19 | 20 |
Sample size: $n = 12$
Step 3: Calculate Sample Statistics
Sample mean: $$\bar{x} = \frac{20 + 19 + 22 + 23 + 19 + 20 + 20 + 21 + 22 + 20 + 19 + 20}{12} = \frac{245}{12} = 20.417$$
Sample standard deviation: $$s = \sqrt{\frac{\sum(x_i - \bar{x})^2}{n-1}} = \sqrt{\frac{26.917}{11}} = \sqrt{2.447} = 1.564$$
Step 4: Test Statistic
Since the population is normally distributed and population standard deviation is unknown, we use the t-test:
$$t = \frac{\bar{x} - \mu_0}{s/\sqrt{n}} = \frac{20.417 - 22}{1.564/\sqrt{12}} = \frac{-1.583}{0.451} = -3.511$$
Step 5: Critical Value
For a left-tailed test with $\alpha = 0.05$ and $df = n - 1 = 11$: $$t_{0.05, 11} = -1.796$$
Step 6: Decision
Since $t = -3.511 < -1.796$, we reject the null hypothesis.
Conclusion: At the 5% level of significance, there is sufficient evidence to support the researcher's doubt that the average age of CSIT enrolling students is less than 22 years. [5]
2077 · 5 marks
A dealer of a DELL company located at New Road claimed that the average lifetime of a multimedia projector produced by Dell Company is greater than 60,000 hours with standard deviation of 6000 hours. In order to test his claim, sample of 100 DELL projectors are taken and the average life time was monitored and it was found to be 55,000 hours. Test the claim of the dealer at 5% level of significance. [5]
test for single proportion
2081 · 5 marks
Discuss the concept of level of significance in hypothesis testing. A manufacturer of laptop provides a particular model in one of three colors. Of the first 100 laptops sold, it is noted that 80 were the first color. Can you conclude that more than two third of all the customers have a preference for the first color? Use 5% level of significance. [5]
Show solved answerHide answer
Level of Significance and Hypothesis Testing
Concept of Level of Significance
The level of significance (denoted α) is the probability of rejecting the null hypothesis $H_0$ when it is actually true. It is the maximum acceptable probability of committing a Type I error.
- Fixed in advance of the test (typically $1%$, $5%$, or $10%$).
- At $5%$ significance, we accept a $5%$ chance of wrongly rejecting a true $H_0$.
- It determines the critical (tabulated) value used to bound the acceptance/rejection regions.
- A smaller $\alpha$ makes the test more conservative (harder to reject $H_0$).
Numerical Solution
Given Data
| Parameter | Value |
|---|---|
| Sample size $n$ | $100$ |
| Number preferring first color $x$ | $80$ |
| Hypothesized proportion $P$ | $2/3 \approx 0.6667$ |
| Level of significance $\alpha$ | $0.05$ |
Sample proportion: $$\hat{p} = \frac{x}{n} = \frac{80}{100} = 0.80$$
Step 1: Hypotheses
- $H_0: P = \dfrac{2}{3}$ (two-thirds prefer the first color)
- $H_1: P > \dfrac{2}{3}$ (more than two-thirds prefer the first color)
This is a right-tailed test.
Step 2: Test Statistic
$$Z = \frac{\hat{p} - P}{\sqrt{\dfrac{P(1-P)}{n}}}$$
Numerator: $$\hat{p} - P = 0.80 - 0.6667 = 0.1333$$
Denominator: $$\sqrt{\frac{0.6667 \times 0.3333}{100}} = \sqrt{\frac{0.2222}{100}} = \sqrt{0.002222} = 0.04714$$
Therefore: $$Z = \frac{0.1333}{0.04714} = 2.83$$
Step 3: Critical Value
For a right-tailed test at $\alpha = 0.05$: $$Z_{tab} = 1.645$$
Step 4: Decision
$$Z_{cal} = 2.83 > Z_{tab} = 1.645$$
Since the calculated value falls in the rejection region, reject $H_0$.
Step 5: Conclusion
At the $5%$ level of significance, there is sufficient evidence to conclude that more than two-thirds of all customers prefer the first color of the laptop.
2080 · 5 marks
Define type I and type II error in testing of hypothesis. It is claimed that Samsung and Huawei mobiles are equally popular in Kathmandu. A random sample of 600 people from Kathmandu showed 350 have Samsung mobile. Test the claim at 5% level of significance. [5]
Show solved answerHide answer
Type I and Type II Errors + Test of Hypothesis on Mobile Popularity
Given Data
- Sample size: $n = 600$
- Number with Samsung: $X = 350$
- Claim: equally popular, so $p_0 = 0.5$
- Level of significance: $\alpha = 0.05$
Part 1: Type I and Type II Error
Type I Error ($\alpha$): Rejecting the null hypothesis $H_0$ when it is actually true. Its probability equals the level of significance $\alpha$.
Type II Error ($\beta$): Accepting the null hypothesis $H_0$ when it is actually false.
| Decision | $H_0$ True | $H_0$ False |
|---|---|---|
| Accept $H_0$ | Correct Decision | Type II Error ($\beta$) |
| Reject $H_0$ | Type I Error ($\alpha$) | Correct Decision |
Part 2: Test of Hypothesis
Step 1: Hypotheses
$$H_0: p = 0.5 \quad \text{(equally popular)}$$ $$H_1: p \neq 0.5 \quad \text{(not equally popular)} \quad \text{(two-tailed test)}$$
Step 2: Sample Proportion
$$\hat{p} = \frac{X}{n} = \frac{350}{600} = 0.5833$$
Step 3: Test Statistic (Z-test for proportion)
$$Z = \frac{\hat{p} - p_0}{\sqrt{\dfrac{p_0 q_0}{n}}}$$
where $q_0 = 1 - 0.5 = 0.5$.
$$\text{S.E.} = \sqrt{\frac{0.5 \times 0.5}{600}} = \sqrt{\frac{0.25}{600}} = \sqrt{0.0004167} = 0.020412$$
$$Z = \frac{0.5833 - 0.5}{0.020412} = \frac{0.0833}{0.020412} = 4.08$$
On the continuity correction: applying it gives $Z_{cal} = 4.04$; without it (the standard approach at this level) $Z = 4.08$. The two are numerically equivalent for the decision. Using the raw count form:
$$Z = \frac{X - np_0}{\sqrt{np_0 q_0}} = \frac{350 - 300}{\sqrt{150}} = \frac{50}{12.247} = 4.08$$
Step 4: Critical Value
At $\alpha = 0.05$, two-tailed:
$$Z_{\alpha/2} = Z_{0.025} = 1.96$$
Step 5: Decision
$$|Z| = 4.08 > 1.96$$
Since the calculated value exceeds the critical value, we reject $H_0$.
Step 6: Conclusion
At the 5% level of significance, there is sufficient evidence to reject the claim that Samsung and Huawei mobiles are equally popular in Kathmandu. The data indicates Samsung is significantly more popular.
Final Result: $Z_{cal} = 4.08$ (without continuity correction) vs $Z_{tab} = 1.96$; reject $H_0$. With the continuity correction $Z_{cal} = 4.04$, and the decision and conclusion are identical.
2079 · 5 marks
It is claimed that Samsung and Redmi mobiles are equally popular in Kathmandu. A random sample of 500 people from Kathmandu showed 300 have Samsung mobile. Test the claim at 5% level of significance. [5]
test for difference between two means and two proportions
2078 · 5 marks
The following are the details of working hours in the classroom per week of male and female faculty working in the area of Computer Science and Information Technology at Tribhuvan University. Apply independent t-test to examine the average working hour in the classroom per week is significantly different between male and female faculty, at 1% level of significance. State also null and alternative hypotheses appropriately.
| Male Faculty | Female Faculty | |
|---|---|---|
| Sample Size | 60 | 30 |
| Average working hours per week | 12 | 9 |
| The standard deviation of a working hour per week | 4 | 3 |
[5]
2078 · 5 marks
In location 1, there are 250 corona-positive cases out of 460 persons, and in location 2, 250 positive cases were reported out of 650 persons. Can it be concluded that the proportion of corona-positive cases is higher in location 1 compared to location 2? Test at a 10% level of significance. [5]
2075 · 10 marks
What do you mean by hypothesis? Describe null and alternative hypothesis. A company claims that its light bulbs are superior to those of the competitor on the basis of study which showed that a sample of 40 of its bulbs had an average life time 628 hours of continuous use with a standard deviation of 27 hours. While sample of 30 bulbs made by the competitor had an average life time 619 hours of continuous use with a standard deviation of 25 hours. Test at 5% level of significance, whether this claim is justified.[10]
Linkage between confidence interval and testing of hypothesis
2077 · 5 marks
Independent t-test and Confidence Interval Analysis
Based on the following information, perform the following:
a. Test whether two means are significantly different (α = 5%) using independent t-test.
b. Compare 95% confidence interval estimation for the difference of means.
c. Show the linkage between testing of hypothesis and confidence interval estimation in this problem.
| Group I | Group B | |
|---|---|---|
| Sample mean | 10 | 15 |
| Sample Standard Deviation | 3 | 5 |
| Sample Size | 49 | 64 |
[5]
Make Unit 2 stick
Practice STA215 with flashcards & quizzes