3 Non Parametric Test

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.

Non parametric test: notes

Parametric vs. non-parametric test

A parametric test assumes the sampled population follows a specific distribution (usually normal) with parameters such as $\mu$ and $\sigma$ that the test estimates and compares; the $Z$-test and $t$-test of the previous chapter are parametric. A non-parametric test (also called a distribution-free test) makes no assumption about the shape of the population distribution, and is typically applied to ranked or ordinal data rather than exact measurements. Non-parametric tests are less powerful than the equivalent parametric test when the parametric assumptions genuinely hold, but they remain valid when those assumptions are violated.

Needs of applying non-parametric tests

Non-parametric tests are needed when the population distribution is unknown or clearly non-normal, when the sample size is too small to invoke the Central Limit Theorem, when the data are only ranked or categorical rather than measured on an interval or ratio scale, or when the data contain outliers that would distort a mean-based test. They require no complicated sampling theory, are quicker and simpler to apply, and can be used on qualitative as well as quantitative data, though they are generally less efficient (they need a somewhat larger sample to achieve the same power as a parametric test) and cannot estimate population parameters directly.

One-sample test: Run test, Binomial test, Kolmogorov-Smirnov test

The run test (Wald-Wolfowitz one-sample test) tests whether a sequence of two types of outcomes occurred in random order. A run is a maximal sequence of identical symbols; $H_0$ states the observations are in random order, against $H_1$ that they are not. With $n_1$ and $n_2$ the counts of the two symbol types and $R$ the observed number of runs, $H_0$ is rejected if $R$ falls outside the tabulated lower and upper limits for $n_1, n_2$ at the chosen significance level (for large $n_1$ or $n_2 > 20$, $Z = \dfrac{R-\mu_R}{\sigma_R}$ is compared with the normal critical value instead). Worked example. A coin is tossed 14 times giving the sequence HTHHHHTHTHTTTH, with $n_1=8$ heads, $n_2=6$ tails, and $R=9$ runs. At the 5% level the tabulated limits for $n_1=8, n_2=6$ are 3 and 12; since $R=9$ lies between them, $H_0$ is not rejected: the sequence is consistent with random order.

The binomial test checks whether two categories occur with equal (or a specified) probability, using the exact binomial distribution rather than a normal approximation, and so suits small samples. With $X_0 = \min(n_1,n_2)$ successes of the less frequent category out of $n=n_1+n_2$ trials, the two-tailed p-value is $2\sum_{x=0}^{X_0}\binom{n}{x}p_0^x q_0^{n-x}$, compared against $\alpha$. Worked example. Out of 11 independent trials, 4 fall in one category and 7 in the other. Testing $H_0: P=0.5$ against $H_1: P \neq 0.5$: with $X_0=4$, the two-tailed p-value is $0.549$, which exceeds $\alpha=0.05$, so $H_0$ is not rejected: the two categories are consistent with being equally likely.

The one-sample Kolmogorov-Smirnov (KS) test checks whether a sample comes from a completely specified distribution, and is an alternative to the chi-square goodness-of-fit test for small samples. It compares the observed cumulative relative frequency $F_o$ against the expected (hypothesized) cumulative relative frequency $F_e$ at every distinct value, using $D_{cal} = \max|F_e - F_o|$, rejecting $H_0$ if $D_{cal}$ exceeds the tabulated $D_{n,\alpha}$. Worked example. Requests are assigned across 5 servers under a hypothesized uniform scheme; out of 50 requests, the observed counts are 12, 8, 11, 9, 10. The observed cumulative proportions are $0.24, 0.40, 0.62, 0.80, 1.00$ against the expected uniform cumulative proportions $0.20, 0.40, 0.60, 0.80, 1.00$, giving $D_{cal}=0.04$. Since this is far below the tabulated critical value for $n=50$ at 5% (approximately 0.19), $H_0$ is not rejected: the requests are consistent with uniform assignment across the servers.

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 marriageLess than or equal to 5 yearsMore than 5 yearsTotal
Below 0.5 year15722
0.5–1.5 years262248
Over 1.5 years191130
Total6040100

[5]

Show solved answer

Chi-Square Test for Association

Given

Observed contingency table:

Acquaintanceship≤ 5 years> 5 yearsTotal
Below 0.5 yr15722
0.5-1.5 yr262248
Over 1.5 yr191130
Total6040100

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}$$

OE$(O-E)^2$$(O-E)^2/E$
1513.23.240.24545
78.83.240.36818
2628.87.840.27222
2219.27.840.40833
1918.01.000.05556
1112.01.000.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.

Open this answer on its own page →

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]

Observed frequencies: Class Favoring Opposing --------------------------- Freshman 125 80 Sophomore 60 140 Junior 50 60 Senior 40 55 Significance level: $\alpha = 0.01$ - $H0$: Opinion on the change is independent of class standing. - $H1$: Opinion is not independent of class standing. Class Favo...

Open this answer on its own page →

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]

18-34 35-64 65+ Row Total --------------- Yes 60 37 14 111 No 40 63 86 189 Col Total 100 100 100 300 Level of significance: $\alpha = 0.05$ - $H0$: There is no difference among age groups regarding use of mobile phones for social networking (independent). - $H1$: There is a difference among age g...

Open this answer on its own page →

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:58276
Group B:91246

[5]

Group A (n₁ = 5) 5 8 2 7 6 ------------------ Group B (n₂ = 4) 9 12 4 6 - H₀: No significant difference in knowledge scores between the two groups. - H₁: There is a significant difference between the two groups. - Significance level: α = 0.05 (two-tailed). Value Group Rank -------------------- 2 ...

Open this answer on its own page →

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 answer

Chi-Square Test for Association Between Email Account Type and Hacking Status

Given

Email AccountYes (Hacked)No (Not Hacked)Row Total
Yahoo601575
Gmail20120140
Column Total80135215

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}$$

OEO - E(O-E)²(O-E)²/E
6027.90732.0931029.9636.907
1547.093-32.0931029.9621.870
2052.093-32.0931029.9619.771
12087.90732.0931029.9611.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$).

Open this answer on its own page →

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 answer

Chi-Square Test for Association Between Email Account Type and Hacking Status

Given

AccountYes (Hacked)No (Not Hacked)Row Total
Yahoo601575
Gmail20120140
Column Total80135215

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}$$

OE$(O-E)$$(O-E)^2$$(O-E)^2/E$
6027.90732.0931029.9636.906
1547.093-32.0931029.9621.870
2052.093-32.0931029.9619.771
12087.90732.0931029.9611.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.

Open this answer on its own page →

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.

1234
Gadget A50403020
Gadget B40301040

[5]

Gadget A (n₁ = 4): 50, 40, 30, 20 Gadget B (n₂ = 4): 40, 30, 10, 40 Level of significance: α = 0.05 - H₀: No significant difference in satisfaction scores between Gadget A and Gadget B. - H₁: There is a significant difference (two-tailed test). Combined sorted data (N = 8): Position Score Group R...

Open this answer on its own page →

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]

Type of Feed Normal Defective Row Total ------------ Breast 18 12 30 Bottle 2 13 15 Column Total 20 25 N = 45 --- - $H0$: Type of feeding and nature of teeth are independent. - $H1$: Type of feeding and nature of teeth are dependent. - $\alpha = 0.05$ --- $$E{ij} = \frac{Ri \times Cj}{N}$$ $$E{11...

Open this answer on its own page →

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.

1234567
Missile system I22.316.722.719.318.5
Missile system II23.419.517.520.816.019.9
Missile system III18.419.517.818.019.622.817.1

[10]

Show solved answer

Kruskal-Wallis Test for Missile System Propellant Burning Rates

Given

System I (n₁=5)System II (n₂=6)System III (n₃=7)
22.323.418.4
16.719.519.5
22.717.517.8
19.320.818.0
18.516.019.6
19.922.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)

ValueSystemRank
16.0II1
16.7I2
17.1III3
17.5II4
17.8III5
18.0III6
18.4III7
18.5I8
19.3I9
19.5II10.5
19.5III10.5
19.6III12
19.9II13
20.8II14
22.3I15
22.7I16
22.8III17
23.4II18

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.

Open this answer on its own page →

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.

CatalystAlcohol (in cc)
C1380430410
C2290350270250270
C3400380450

[5]

Catalyst Alcohol yield (cc) Sample size ------------------------------------------- C1 380, 430, 410 $n1 = 3$ C2 290, 350, 270, 250, 270 $n2 = 5$ C3 400, 380, 450 $n3 = 3$ Total: $N = 3 + 5 + 3 = 11$, significance level $\alpha = 0.05$. - $H0$: There is no significant difference between the three...

Open this answer on its own page →

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 answer

Short Notes on Any Two


a. Difference Between Parametric and Non-Parametric Test

BasisParametric TestNon-Parametric Test
AssumptionRequires strict assumptions about population distribution (usually normality)Does not require assumptions about population distribution
Data TypeWorks on interval or ratio scale dataWorks on nominal or ordinal scale data
Population ParameterMakes inferences about population parameters (mean, variance)Makes inferences without reference to specific population parameters
Sample SizeRequires relatively large sample sizeCan be used with small sample sizes
PowerMore powerful when assumptions are metLess powerful compared to parametric tests
Examplest-test, F-test, Z-testMann-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.


Open this answer on its own page →

2079 · 5 marks

What do you mean by non parametric test? Write down advantages of non parametric test over parametric tests? [5]

A non-parametric test (also called a distribution-free test) is a statistical test that does not require any assumption about the population distribution from which the sample is drawn. Unlike parametric tests, these tests do not involve estimation or testing of population parameters such as mean...

Open this answer on its own page →

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]

Sequence (30 customers): 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 - Total observations $n = 30$ - Level of significance $\alpha = 0.005$ --- Count carefully. Positions 1-30: 1:M 2:M 3:F 4:M 5:M 6:F 7:M 8:F 9:M 10:F 11:M 12:F 13:M 14:F 15:M 16:F 17:M 18:F 19:M 20:F 21:M 22:F 23:...

Open this answer on its own page →

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]

--- Non-parametric statistical tests (also called distribution-free tests) are statistical methods that do not require assumptions about the underlying population distribution (e.g., normality). 1. No assumption about population distribution: When the population distribution is unknown or clearly...

Open this answer on its own page →

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]

--- Non-parametric statistical methods (also called distribution-free methods) are statistical tests that do not require assumptions about the population distribution from which the sample is drawn. The need for non-parametric methods arises due to the following reasons: 1. No assumption about po...

Open this answer on its own page →