Statistics II · Unit 3 · 8 hrs
Non parametric test
Exam-focused notes for Non parametric test (Statistics II, STA215): what the TU syllabus asks and how it has actually been tested, with 15 solved past questions from this unit.
Non parametric test in short
When a sample cannot be assumed to come from a normal population, or when data are only ranks or categories rather than measured quantities, a separate family of tests, free of distributional assumptions, is used instead of the $Z$ and $t$ tests of the previous chapter.
What this unit covers
- Parametric vs. non-parametric test
- Needs of applying non-parametric tests
- One-sample test: Run test, Binomial test, Kolmogorov–Smirnov test
- Two independent sample test: Median test, Kolmogorov-Smirnov test, Wilcoxon Mann Whitney test, Chi-square test
- Paired-sample test: Wilcoxon signed rank test
- Cochran's Q test
- Friedman two way analysis of variance test
- Kruskal Wallis test
- Problems and illustrative examples related to computer Science and IT
Two independent sample test
2081 · 5 marks
Chi-Square Test of Independence
Based on interviews of couples seeking divorce, a social worker compiles the following data related to the period of acquaintanceship before marriage and the duration of marriage. Perform a test to determine if the data substantiate an association between the duration of a marriage and the acquaintanceship prior to marriage. Use 5% level of significance.
| Acquaintanceship before marriage | Less than or equal to 5 years | More than 5 years | Total |
|---|---|---|---|
| Below 0.5 year | 15 | 7 | 22 |
| 0.5–1.5 years | 26 | 22 | 48 |
| Over 1.5 years | 19 | 11 | 30 |
| Total | 60 | 40 | 100 |
[5]
Show solved answerHide answer
Chi-Square Test for Association
Given
Observed contingency table:
| Acquaintanceship | ≤ 5 years | > 5 years | Total |
|---|---|---|---|
| Below 0.5 yr | 15 | 7 | 22 |
| 0.5-1.5 yr | 26 | 22 | 48 |
| Over 1.5 yr | 19 | 11 | 30 |
| Total | 60 | 40 | 100 |
Significance level $\alpha = 0.05$.
Step 2: Hypotheses
- $H_0$: No association between duration of marriage and acquaintanceship period (independent).
- $H_1$: There is an association.
Step 3: Expected Frequencies
$$E_{ij} = \frac{R_i \times C_j}{N}$$
| Cell | $E$ |
|---|---|
| (Below 0.5, ≤5) | $\frac{22 \times 60}{100} = 13.2$ |
| (Below 0.5, >5) | $\frac{22 \times 40}{100} = 8.8$ |
| (0.5-1.5, ≤5) | $\frac{48 \times 60}{100} = 28.8$ |
| (0.5-1.5, >5) | $\frac{48 \times 40}{100} = 19.2$ |
| (Over 1.5, ≤5) | $\frac{30 \times 60}{100} = 18.0$ |
| (Over 1.5, >5) | $\frac{30 \times 40}{100} = 12.0$ |
Step 4: Chi-Square Statistic
$$\chi^2 = \sum \frac{(O-E)^2}{E}$$
| O | E | $(O-E)^2$ | $(O-E)^2/E$ |
|---|---|---|---|
| 15 | 13.2 | 3.24 | 0.24545 |
| 7 | 8.8 | 3.24 | 0.36818 |
| 26 | 28.8 | 7.84 | 0.27222 |
| 22 | 19.2 | 7.84 | 0.40833 |
| 19 | 18.0 | 1.00 | 0.05556 |
| 11 | 12.0 | 1.00 | 0.08333 |
$$\chi^2_{cal} = 0.24545 + 0.36818 + 0.27222 + 0.40833 + 0.05556 + 0.08333 = 1.4331$$
Step 5: Degrees of Freedom and Critical Value
$$df = (r-1)(c-1) = (3-1)(2-1) = 2$$
$$\chi^2_{0.05,,2} = 5.991$$
Step 6: Decision
$$\chi^2_{cal} = 1.433 < \chi^2_{tab} = 5.991$$
Fail to reject $H_0$.
Step 7: Conclusion
At the 5% level of significance, there is no significant association between the duration of marriage and the period of acquaintanceship before marriage. The data do not substantiate an association.
2080 · 5 marks
Test of Independence: Opinion on Core Curriculum Change vs. Class Standing
A random sample of students is asked their opinion on proposed core curriculum change. The results are as follows. Test the hypothesis that opinion on the change is independent of class standing. Use 0.01 significance level.
$$\begin{array}{|c|c|c|} \hline \text{Class} & \text{Favoring} & \text{Opposing} \ \hline \text{Freshman} & 125 & 80 \ \text{Sophomore} & 60 & 140 \ \text{Junior} & 50 & 60 \ \text{Senior} & 40 & 55 \ \hline \end{array}$$
[5]
2079 · 5 marks
A study showed the following results for the different age groups. At the 0.05 level of significance, is there evidence of a difference among the age groups with respect to use of mobile phones for accessing social networking?
$$\begin{array}{|c|c|c|c|} \hline \text{Use mobile phones to access social networking?} & \text{18-34} & \text{35-64} & \text{65+} \ \hline \text{Yes} & 60 & 37 & 14 \ \text{No} & 40 & 63 & 86 \ \hline \end{array}$$
[5]
2078 · 5 marks
Apply the Mann-Whitney U test for examining the following knowledge score on IT among two groups of IT workers at a 5% level of significance.
| Group A: | 5 | 8 | 2 | 7 | 6 |
|---|---|---|---|---|---|
| Group B: | 9 | 12 | 4 | 6 |
[5]
2078 · 5 marks
Chi-Square Test for Association Between Email Account Type and Hacking Status
A survey was conducted to see the association between hacking status of the email and the type of email account. The survey has reported the following cross tabulation. Do the information provide sufficient evidence to conclude that the type email account and the hacking status is associated? Use Chi-square test at 1% level of significance.
$$\begin{array}{|c|c|c|} \hline \text{Type of e-mail account} & \text{Hacking status Yes} & \text{Hacking status No} \ \hline \text{Yahoo} & 60 & 15 \ \text{Gmail} & 20 & 120 \ \hline \end{array}$$
[5]
Show solved answerHide answer
Chi-Square Test for Association Between Email Account Type and Hacking Status
Given
| Email Account | Yes (Hacked) | No (Not Hacked) | Row Total |
|---|---|---|---|
| Yahoo | 60 | 15 | 75 |
| Gmail | 20 | 120 | 140 |
| Column Total | 80 | 135 | 215 |
Level of significance: $\alpha = 0.01$
Step 2 - Hypotheses
- $H_0$: Email account type and hacking status are independent (not associated)
- $H_1$: Email account type and hacking status are associated
Step 3 - Expected Frequencies
$$E_{ij} = \frac{(\text{Row Total}_i)(\text{Column Total}_j)}{\text{Grand Total}}$$
$$E_{11} = \frac{75 \times 80}{215} = 27.907$$ $$E_{12} = \frac{75 \times 135}{215} = 47.093$$ $$E_{21} = \frac{140 \times 80}{215} = 52.093$$ $$E_{22} = \frac{140 \times 135}{215} = 87.907$$
Step 4 - Test Statistic
$$\chi^2 = \sum \frac{(O - E)^2}{E}$$
| O | E | O - E | (O-E)² | (O-E)²/E |
|---|---|---|---|---|
| 60 | 27.907 | 32.093 | 1029.96 | 36.907 |
| 15 | 47.093 | -32.093 | 1029.96 | 21.870 |
| 20 | 52.093 | -32.093 | 1029.96 | 19.771 |
| 120 | 87.907 | 32.093 | 1029.96 | 11.717 |
$$\chi^2_{cal} = 36.907 + 21.870 + 19.771 + 11.717 = 90.27$$
(Small rounding differences; approximately $90.2$-$90.3$.)
Step 5 - Degrees of Freedom
$$df = (r-1)(c-1) = (2-1)(2-1) = 1$$
Step 6 - Critical Value
$$\chi^2_{0.01,,1} = 6.635$$
Step 7 - Decision
Since $\chi^2_{cal} = 90.27 > \chi^2_{tab} = 6.635$, we reject $H_0$.
Conclusion
At the 1% level of significance, there is sufficient evidence to conclude that the type of email account and the hacking status are associated. Yahoo accounts show a markedly higher hacking rate (60/75 = 80%) than Gmail accounts (20/140 ≈ 14%).
Note (optional): For a $2\times2$ table, Yates' continuity correction may be applied: $$\chi^2_{Yates} = \sum \frac{(|O-E| - 0.5)^2}{E} \approx 87.5$$ Either way, the conclusion is unchanged (reject $H_0$).
2077 · 5 marks
Chi-Square Test for Association Between Email Account Type and Hacking Status
A survey was conducted to see the association between hacking status of the email and the type of email account. The survey has reported the following cross tabulation. Do the information provide sufficient evidence to conclude that the type email account and the hacking status is associated? Use Chi-square test at 1% level of significance.
$$\begin{array}{|c|c|c|} \hline \text{Type of e-mail account} & \text{Hacking status Yes} & \text{Hacking status No} \ \hline \text{Yahoo} & 60 & 15 \ \text{Gmail} & 20 & 120 \ \hline \end{array}$$
[5]
Show solved answerHide answer
Chi-Square Test for Association Between Email Account Type and Hacking Status
Given
| Account | Yes (Hacked) | No (Not Hacked) | Row Total |
|---|---|---|---|
| Yahoo | 60 | 15 | 75 |
| Gmail | 20 | 120 | 140 |
| Column Total | 80 | 135 | 215 |
Level of significance: $\alpha = 0.01$
Step 2 - Hypotheses
- $H_0$: Type of email account and hacking status are independent (not associated).
- $H_1$: Type of email account and hacking status are associated.
Step 3 - Expected Frequencies
$$E_{ij} = \frac{\text{Row Total} \times \text{Column Total}}{\text{Grand Total}}$$
$$E_{11} = \frac{75 \times 80}{215} = 27.907$$
$$E_{12} = \frac{75 \times 135}{215} = 47.093$$
$$E_{21} = \frac{140 \times 80}{215} = 52.093$$
$$E_{22} = \frac{140 \times 135}{215} = 87.907$$
Step 4 - Chi-Square Statistic
$$\chi^2 = \sum \frac{(O-E)^2}{E}$$
| O | E | $(O-E)$ | $(O-E)^2$ | $(O-E)^2/E$ |
|---|---|---|---|---|
| 60 | 27.907 | 32.093 | 1029.96 | 36.906 |
| 15 | 47.093 | -32.093 | 1029.96 | 21.870 |
| 20 | 52.093 | -32.093 | 1029.96 | 19.771 |
| 120 | 87.907 | 32.093 | 1029.96 | 11.717 |
$$\chi^2 = 36.906 + 21.870 + 19.771 + 11.717 = 90.264 \approx 90.26$$
Step 5 - Degrees of Freedom
$$df = (r-1)(c-1) = (2-1)(2-1) = 1$$
Step 6 - Critical Value
$$\chi^2_{tab,,0.01,,1} = 6.635$$
Step 7 - Decision
Since $\chi^2_{cal} = 90.26 > \chi^2_{tab} = 6.635$, we reject $H_0$.
Conclusion
At the 1% level of significance, there is sufficient evidence to conclude that the type of email account and hacking status are significantly associated. (Yahoo accounts show a much higher hacking rate than Gmail accounts.)
Note: For a 2×2 table Yates' continuity correction is sometimes applied, giving $\chi^2 \approx 87.6$, but the conclusion (reject $H_0$) remains unchanged.
2077 · 5 marks
Use Mann-Whitney U test to assess whether the following satisfaction scores based on the performance of two different special types of gadgets at 5% level of significance.
| 1 | 2 | 3 | 4 | |
|---|---|---|---|---|
| Gadget A | 50 | 40 | 30 | 20 |
| Gadget B | 40 | 30 | 10 | 40 |
[5]
2075 · 5 marks
Chi-Square Test for Independence
The following data related to the number of children classified according to the type of feeding and nature of teeth. Do the information provide sufficient evidence to conclude that type of feeding and nature of teeth are dependent? Use chi square test at 5% level of significance.
$$\begin{array}{|c|c|c|} \hline \text{Type of feed} & \text{Normal} & \text{Defective} \ \hline \text{Breast} & 18 & 12 \ \text{Bottle} & 2 & 13 \ \hline \end{array}$$
[5]
Kruskal Wallis test
2080 · 10 marks
Kruskal-Wallis Test for Propellant Burning Rates
In an experiment to determine which of three different missile systems is preferable, the propellant burning rate is measured. The data after coding are given in the table. Use Kruskal-Wallis test (significance level of 0.01) to test the hypothesis that the propellant burning rates are same for three missile systems.
| 1 | 2 | 3 | 4 | 5 | 6 | 7 | |
|---|---|---|---|---|---|---|---|
| Missile system I | 22.3 | 16.7 | 22.7 | 19.3 | 18.5 | ||
| Missile system II | 23.4 | 19.5 | 17.5 | 20.8 | 16.0 | 19.9 | |
| Missile system III | 18.4 | 19.5 | 17.8 | 18.0 | 19.6 | 22.8 | 17.1 |
[10]
Show solved answerHide answer
Kruskal-Wallis Test for Missile System Propellant Burning Rates
Given
| System I (n₁=5) | System II (n₂=6) | System III (n₃=7) |
|---|---|---|
| 22.3 | 23.4 | 18.4 |
| 16.7 | 19.5 | 19.5 |
| 22.7 | 17.5 | 17.8 |
| 19.3 | 20.8 | 18.0 |
| 18.5 | 16.0 | 19.6 |
| 19.9 | 22.8 | |
| 17.1 |
Total $N = 5 + 6 + 7 = 18$
Step 2: Hypotheses
- $H_0$: The propellant burning rates are the same for all three missile systems.
- $H_1$: At least one system differs.
Step 3: Rank All 18 Observations (ascending)
| Value | System | Rank |
|---|---|---|
| 16.0 | II | 1 |
| 16.7 | I | 2 |
| 17.1 | III | 3 |
| 17.5 | II | 4 |
| 17.8 | III | 5 |
| 18.0 | III | 6 |
| 18.4 | III | 7 |
| 18.5 | I | 8 |
| 19.3 | I | 9 |
| 19.5 | II | 10.5 |
| 19.5 | III | 10.5 |
| 19.6 | III | 12 |
| 19.9 | II | 13 |
| 20.8 | II | 14 |
| 22.3 | I | 15 |
| 22.7 | I | 16 |
| 22.8 | III | 17 |
| 23.4 | II | 18 |
Tie at 19.5: average rank $= (10+11)/2 = 10.5$
Step 4: Rank Sums
System I: $R_1 = 2 + 8 + 9 + 15 + 16 = 50$
System II: $R_2 = 1 + 4 + 10.5 + 13 + 14 + 18 = 60.5$
System III: $R_3 = 3 + 5 + 6 + 7 + 10.5 + 12 + 17 = 60.5$
Check: $50 + 60.5 + 60.5 = 171 = \dfrac{N(N+1)}{2} = \dfrac{18(19)}{2} = 171$ ✓
Step 5: Test Statistic
$$H = \frac{12}{N(N+1)} \sum \frac{R_i^2}{n_i} - 3(N+1)$$
$$\frac{50^2}{5} = 500, \quad \frac{60.5^2}{6} = \frac{3660.25}{6} = 610.042, \quad \frac{60.5^2}{7} = \frac{3660.25}{7} = 522.893$$
Sum $= 500 + 610.042 + 522.893 = 1632.935$
$$H = \frac{12}{18 \times 19}(1632.935) - 3(19) = \frac{12}{342}(1632.935) - 57$$
$$H = 0.035088 \times 1632.935 - 57 = 57.296 - 57 = 0.296 \approx 0.30$$
Correction for ties (optional, one tie group of size 2):
$$C = 1 - \frac{\sum(t^3 - t)}{N^3 - N} = 1 - \frac{2^3 - 2}{18^3 - 18} = 1 - \frac{6}{5814} = 1 - 0.001032 = 0.99897$$
$$H_{corrected} = \frac{0.296}{0.99897} \approx 0.296$$
The tie correction is negligible.
Step 6: Critical Value
$H$ follows $\chi^2$ with $df = k - 1 = 2$.
$$\chi^2_{0.01, 2} = 9.210$$
Step 7: Decision
$$H = 0.30 < 9.210$$
Fail to reject $H_0$.
Conclusion
At the 1% significance level, there is insufficient evidence to conclude that the propellant burning rates differ among the three missile systems. The burning rates may be considered the same.
2075 · 5 marks
Kruskal-Wallis H Test for Catalyst Comparison
A chemist uses three catalysts for distilling alcohol and the results were tabulated below. Are there any significant differences between catalysts? Test at 5% level of significance. Use Kruskal-Wallis H test.
| Catalyst | Alcohol (in cc) | ||||
|---|---|---|---|---|---|
| C1 | 380 | 430 | 410 | ||
| C2 | 290 | 350 | 270 | 250 | 270 |
| C3 | 400 | 380 | 450 |
[5]
Parametric vs. non-parametric test
2080 · 5 marks
Write short notes on any two: a. Difference between parametric and non-parametric test. b. Required assumptions for linear regression model. c. Stochastic process. [5]
Show solved answerHide answer
Short Notes on Any Two
a. Difference Between Parametric and Non-Parametric Test
| Basis | Parametric Test | Non-Parametric Test |
|---|---|---|
| Assumption | Requires strict assumptions about population distribution (usually normality) | Does not require assumptions about population distribution |
| Data Type | Works on interval or ratio scale data | Works on nominal or ordinal scale data |
| Population Parameter | Makes inferences about population parameters (mean, variance) | Makes inferences without reference to specific population parameters |
| Sample Size | Requires relatively large sample size | Can be used with small sample sizes |
| Power | More powerful when assumptions are met | Less powerful compared to parametric tests |
| Examples | t-test, F-test, Z-test | Mann-Whitney U-test, Median test, Kruskal-Wallis test |
**Note ** The Mann-Whitney U-test is a non-parametric test used as an alternative to the T-test when T-test fails to satisfy the normality assumptions. This clearly illustrates the key distinction: parametric tests demand distributional assumptions, while non-parametric tests do not.
b. Required Assumptions for Linear Regression Model
For a linear regression model to produce valid and reliable results, the following assumptions must be satisfied:
1. Linearity The relationship between the dependent variable (Y) and independent variable(s) (X) must be linear in nature.
2. Independence of Errors The error terms (residuals) must be independent of each other. There should be no autocorrelation among residuals.
3. Normality of Errors The error terms should follow a normal distribution with mean zero:
$$E(\varepsilon_i) = 0$$
4. Homoscedasticity (Constant Variance) The variance of error terms should be constant across all levels of the independent variable:
$$Var(\varepsilon_i) = \sigma^2 \text{ (constant)}$$
5. No Multicollinearity (for multiple regression) In multiple regression, the independent variables (X1, X2, ...) should not be highly correlated with each other. In multiple regression with variables X1 and X2, each variable is tested separately for its contribution, implying they should be independently contributing.
6. No Measurement Error The independent variables are assumed to be measured without error.
7. Significance of Regression Coefficients The regression coefficients (b1, b2, ...) should be significantly different from zero, tested using the t-test:
$$t_{cal} = \frac{b_i}{S_{b_i}}$$
**Example ** With n=20, b1=4, Sb1=1.2, the calculated t = 3.33 > t-tab = 2.110, confirming a significant linear relationship between Y and X1, validating the regression model assumption.
2079 · 5 marks
What do you mean by non parametric test? Write down advantages of non parametric test over parametric tests? [5]
One-sample test
2079 · 5 marks
Bank of Nepal recorded the sex of first 30 customers who appeared last Monday with notation M M F M M F M F M F M F M F M F M F M F M F M F M F M F M F. At the 0.005 level of significance, test the randomness of this sequence. [5]
Needs of applying non-parametric tests
2078 · 5 marks
Write short notes on the following: I. The rationale of using the non-parametric statistical test II. Estimation of minimum size for the given proportion [5]
2075 · 5 marks
Write short notes of the following: a. Need of non parametric statistical methods. b. Efficiency of Randomized Block Design relative to Completely Randomized Design [5]
Make Unit 3 stick
Practice STA215 with flashcards & quizzes