Chapter3 Lesson 2 Non - Parametric
Chapter3 Lesson 2 Non - Parametric
Specific objectives:
101
distribution. Chi-Square goodness of fit test determines how well theoretical
distribution (such as normal, binomial, or Poisson) fits the empirical distribution. In
Chi-Square goodness of fit test, sample data is divided into intervals. Then the
numbers of points that fall into the interval are compared, with the expected
numbers of points in each interval.
5. Compute: Ei = n ×𝝁𝒊
where Ei = expected value per row
n = sample size
𝜇𝑖 = assumed distribution
(𝑶− 𝑬)𝟐
x2 =∑ [ 𝑬
]
Degree of freedom:
In Chi-Square goodness of fit test, the degree of freedom depends on the
distribution of the sample. The following table shows the distribution and an
associated degree of freedom:
102
Type of distribution No of constraints Degree of freedom
Binominal distribution 1 n-1
Poisson distribution 2 n-2
Normal distribution 3 n-3
6. State your decision based on the decision criterion and the t-computed.
7. State your conclusion.
Example:
Table 3.2.1.a shows the distribution of various ethnic groups in the
population of Sultan Kudarat province based on the Philippine Statistics Authority
(PSA) census. Five years later a random sample of 2,500 residents of the province
was taken, with the results given in the table 3.2.1.b (along with the probability
distribution from the census year). Test at 1% level of significance whether there is
sufficient evidence in the sample to conclude that the distribution of ethnic groups
in the province five years after the census had changed from that in the census
year.
Table 3.2.1.b: Sample Data Five Years After the Census Year
Solution:
1. Ho: The distribution of ethnic group has not changed.
H1: The distribution of ethnic group has changed.
2. Test-statistic: Use x2 one sample test.
103
3. Level of significance: Use 𝛼 = 0.01 level of significance.
4. Decision Criterion: Reject Ho if 𝒙𝟐𝒄 ≥ 𝒙𝟐𝒕(𝟔−𝟏)𝒅𝒇 = 15.09 (refer Appendix
Table B).
5. Computation:
Compute the expected number of each row using the formula Ei = n ×𝝁𝒊
with n – 2500.
E1 = 2500 × 0.743 = 1857
E2 = 2500 × 0.216 = 540
E3 = 2500 × 0.012 = 30
E4 = 2500 × 0.012 = 30
E5 = 2500 × 0.008 = 20
E6 = 2500 × 0.009 = 22.5
Observed and Expected Frequencies Five Years After the Census Year
(𝑶− 𝑬)𝟐
x2 =∑ [ 𝑬
]
= 651.881
104
Sign Test Wilcoxon Matched -Paired Signed-Ranks Test
The Wilcoxon Sign Test is used to determine whether the mean ranks of
two dependent, or matched, samples are different from each other. This is the
non-parametric alternative to the dependent sample t-test. Technically, it tests if
the average difference of a continuous variable that is measured twice is zero.
The test statistic for the Wilcoxon Signed Rank Test is W, defined as the
smaller of 𝑊+ (sum of the positive ranks) and 𝑊− (sum of the negative ranks). If
the null hypothesis is true, we expect to see similar numbers of lower and higher
ranks that are both positive and negative (i.e., 𝑊+ and 𝑊− would be similar). If
the research hypothesis is true, we expect to see more higher and positive ranks.
𝑛(𝑛+1)
If the number of observations/pairs 2
is greater than 20, use the normal
approximation.
In computing for the test statistic, we use the formula:
𝒏(𝒏−𝟏)
𝑾−
𝟒
Z= 𝒏(𝒏+𝟏)(𝟐𝒏+𝟏)
√
𝟐𝟒
Example:
The researcher assesses the effectiveness of a new drug designed to
reduce repetitive behaviors in children affected with autism. A total of 8 children
with autism enroll in the study and the amount of time that each child is engaged
in repetitive behavior during three hours observation periods are measured both
before treatment and then again after taking the new medication for a period of 1
week. The data are shown below.
105
7 55 40
8 20 25
Solution:
2. Test statistic: Use Wilcoxon Signed Rank Test for dependent sample
3. Level of significance: Use 𝛼 = 0.05
4. Decision Criterion: Reject Ho if 𝑤𝑐 ≤ 𝑤𝑡(0.05) = 6.
5. Computation:
First, solve for the difference between before treatment (a) and after
treatment (b)
Using the formula: 𝐷𝑖 = 𝑎 - b
Difference
After 1 week of
Child Before Treatment (a) (Before and
Treatment (b)
After) 𝑫𝒊
1 85 75 10
2 70 50 20
3 40 50 -10
4 65 40 25
5 80 20 60
6 75 65 10
7 55 40 15
8 20 25 -5
The next step is to rank the difference scores. We first order the absolute
values of the difference scores and assign rank from 1 through n to the smallest
through largest absolute values of the difference scores, and assign the mean rank
when there are ties in the absolute values of the difference scores.
Observed Ordered absolute Values of
Ranks
Difference Difference
10 -5 1
20 10 3
-10 -10 3
25 10 3
60 15 5
106
10 20 6
15 25 7
-5 60 8
The final step is to attach the signs ("+" or "-") of the observed differences
to each rank as shown below.
Observed Ordered absolute Signed Ranks
Ranks
Difference Values of Difference
10 -5 1 -1
20 10 3 3
-10 -10 3 -3
25 10 3 3
60 15 5 5
10 20 6 6
15 25 7 7
-5 60 8 8
𝑊+ = 3 +3 +5 + 6 + 7 + 8 = 32
𝑊− = 1 + 3 = 4
In this example, 𝑊+ = 32 and 𝑊− = 4. Recall that the sum of the ranks (ignoring
𝒏𝟏 (𝒏𝟏 +𝟏)
the signs) will always equal . As a check on our assignment of ranks, we
𝟐
𝒏𝟏 (𝒏𝟏 +𝟏) 𝟖(𝟖+𝟏)
have 𝟐
= 𝟐
= 36 which is equal to 32+4. The test statistic is W = 4. (see
107
sometimes called the Mann Whitney Wilcoxon Test or the Wilcoxon Rank Sum
Test, is used to test whether two samples are likely to derive from the same
population (i.e., that the two populations have the same shape). Some
investigators interpret this test as comparing the medians between the two
populations.
Methods:
Case1. When the sample sizes are equal, 𝑛1 = 𝑛2 .
i. Put all observations in single array tagging each observation to differentiate
the origin of each observation.
ii. Rank the observations in the combined array.
iii. Assign the average rank in case of ties.
iv. Sum the rank of the first sample 𝑀1 and the rank of the second sample 𝑀2
and compute M = min (𝑀1 , 𝑀2 ).
v. Compare M with tabular value (Appendix Table B).
vi. Decision Criterion: Reject 𝐻𝑜 if M≤ 𝑀𝑡 .
Example:
Placebo (P) 7 5 6 4 12
New Drug (ND) 3 6 4 2 1
108
Is there a difference in the number of episodes of shortness of breath over
a 1-week period in participants receiving the new drug as compared to those
receiving the placebo? By inspection, it appears that participants receiving the
placebo have more episodes of shortness of breath, but is this statistically
significant?
Solution:
𝑀1 = 1 + 2 + 3 + 4.5 + 7.5 = 18
𝑀2 = 4.5 + 6 + 7.5 + 9 + 10 = 37
M = min(𝑀1 , 𝑀2 )
= min(18, 37)
= 18
6. Decision: Since 𝑀𝑐 = 18 > 𝑀𝑡 (0.05) = 17, accept 𝐻𝑜 .
7. Conclusion: Therefore, we can conclude that the new drug is not effective
in reducing symptoms of asthma.
109
categories of the second nominal variable. The data can be displayed in a
contingency table where each row represents a category for one variable and each
column represents a category for the other variable.
To calculate the chi-squared statistic, take the difference between a pair of
observed (O) and expected values (E), square the difference, and divide
that squared difference by the expected value. Repeat this process for all cells in
your contingency table and sum those values.
𝒓 𝒌
𝟐
(𝑶𝒊𝒋 − 𝑬𝒊𝒋 )𝟐
𝑿 = ∑ ∑
𝑬𝒊𝒋
𝒊=𝟏 𝒋=𝟏
Procedure:
First, calculate the expected value of the two nominal variables. We can calculate
the expected value of the two nominal variables by using this formula:
∑𝒄𝒌=𝟏 𝑶𝒊𝒋 ∑𝒓𝒌=𝟏 𝑶𝒌𝒋
𝑬𝒊𝒋 =
𝑵
Where
𝑬𝒊𝒋 = expected value
∑𝒄𝒌=𝟏 𝑶𝒊𝒋 = Sum of the ith column
∑𝒓𝒌=𝟏 𝑶𝒌𝒋 = Sum of the kth row
N = total number
After calculating the expected value, we will apply the following formula to calculate
the value of the Chi-Square test of Independence:
(𝑶𝒊𝒋 − 𝑬𝒊𝒋 )𝟐
𝑿𝟐 = ∑𝒓𝒊=𝟏 ∑𝒌𝒋=𝟏
𝑬𝒊𝒋
110
= Chi-Square test of Independence
𝑶𝒊𝒋 = Observed value of two nominal variables
𝑬𝒊𝒋 = Expected value of two nominal variables
Example:
Solution:
111
1. Ho: There is no significant relationship between exercise and student’s living
arrangement.
H1: There is a significant relationship between exercise and student’s living
arrangement.
2. Test-statistic: Use the Chi square Test
3. Level of significance: Use 𝛼 = 0.05 level of significance.
4. Decision Criterion: Reject Ho if 𝑋𝑐2 ≥ 𝑋(2𝛼=.05)(3−1)(4−1)𝑑𝑓 = 12.59 (refer
Appendix Table B).
5. Computation:
(𝑅𝑜𝑤 𝑇𝑜𝑡𝑎𝑙 × 𝐶𝑜𝑙𝑢𝑚𝑛 𝑇𝑜𝑡𝑎𝑙)
Expected Frequency =
𝑁
90 ×255
= = 48.8
470
112
6. Decision: Since 𝑋𝑐2 = 𝟔𝟎. 𝟓 > 𝑋(2𝛼=.05)(3−1)(4−1)𝑑𝑓 = 12.59, reject Ho.
Example:
An opinion poll was given to students. Their opinions were expressed by
using Likert scale with 5 choices. (1) strongly disagree, (2) disagree, (3) neutral,
(4) agree, (5) strongly agree. A researcher claims that the distributions for student’s
response to three of the questions in the poll: Q1, Q2, and Q3 are the same. Ten
students’ responses were randomly selected. Their responses to three questions
are listed below. Let 𝛼 = 0.10, using the Kruskal-Wallis Test, can you reject the
researcher’s claim?
113
Student Q1 Q2 Q3
1 3 4 4
2 4 4 5
3 4 4 4
4 4 4 4
5 4 3 3
6 5 3 5
7 3 2 3
8 2 3 3
9 3 3 2
10 3 3 4
Solution:
1. Ho: The responses of students in the three questions are the same.
H1: At least two of the students’ responses to three questions are not the
same.
2. Test-statistic: Use the Chi-square test
3. Level of significance: Use 𝛼 = 0.10 level of significance.
4. Decision Criterion: Reject Ho if 𝑲𝑾≤ 𝑲𝑾(.𝟏𝟎)(𝟑−𝟏)𝒅𝒇 = 𝟒. 𝟔𝟏(refer Appendix
Table B).
5. Computation:
a. Rank the combine samples from lowest to the highest
b. For each individual sample, find the number of observations and the
sum of the ranks.
𝟏𝟐 𝑹𝟐𝒋
𝑲𝑾 = [∑𝒌𝒋=𝟏 𝒏 ] − 𝟑(𝒏 + 𝟏)
𝒏(𝒏+𝟏) 𝒋
114
𝟏𝟐 𝟏𝟓𝟕.𝟗𝟒𝟐 𝟏𝟒𝟓.𝟎𝟖𝟐 𝟏𝟕𝟔.𝟗𝟒𝟐
= 𝟑𝟎(𝟑𝟎+𝟏) [ + + ] − 𝟑(𝟑𝟎 + 𝟏)
𝟏𝟎 𝟏𝟎 𝟏𝟎
correlation:
115
𝒏𝒄 − 𝒏𝒅 𝑪−𝑫
𝝉= 𝒏(𝒏−𝟏) or Kendall tau = 𝑪 + 𝑫
𝟐
Example:
The architectural drafting students exhibits 8 artworks during University Day.
The artwork ranked by two committee: the faculty and administrators. Determine
the degree of relationship between the faculty and administrator’s rank.
Faculty Rank Admin. Rank Concordant Discordant
1 2 6 1
2 1 6 0
3 5 3 2
4 4 3 1
5 3 3 0
6 7 1 1
7 6 1 0
8 8
TOTAL 23 5
116
𝑪−𝑫
Kendall tau = 𝑪 + 𝑫
𝟐𝟑−𝟓 𝟏𝟖
= 𝟐𝟑+𝟓 = 𝟐𝟖 = 0.6429
117
Summary:
✓ Chi-Square goodness of fit test is a non-parametric test that is used to find out
how the observed value of a given phenomenon is significantly different from
the expected value. In Chi-Square goodness of fit test, the term goodness of
fit is used to compare the observed sample distribution with the expected
probability distribution.
✓ The Wilcoxon Sign Test is used to determine whether the mean ranks of two
dependent, or matched, samples are different from each other. This is the non-
parametric alternative to the dependent sample t-test.
✓ The Mann Whitney U test, sometimes called the Mann Whitney Wilcoxon Test
or the Wilcoxon Rank Sum Test, is used to test whether two samples are likely
to derive from the same population (i.e., that the two populations have the same
shape). Some investigators interpret this test as comparing the medians
between the two populations.
✓ The Chi-Square test of independence is used to determine if there is a
significant relationship between two nominal (categorical) variables. The
frequency of each category for one nominal variable is compared across the
categories of the second nominal variable. The data can be displayed in a
contingency table where each row represents a category for one variable and
each column represents a category for the other variable.
✓ The Kruskal-Wallis H test (sometimes also called the "one-way ANOVA on
ranks") is a rank-based nonparametric test that can be used to determine if
there are statistically significant differences between two or more groups of an
independent variable on a continuous or ordinal dependent variable. It is
considered the nonparametric alternative to the one-way ANOVA, and an
extension of the Mann-Whitney U test to allow the comparison of more than two
independent groups.
✓ The Kendall rank correlation coefficient or Kendall's tau statistic is used to
estimate a rank-based measure of association. This test may be used if the
data do not necessarily come from a bivariate normal distribution. Tau is
the Kendall correlation coefficient.
118
ASSESSMENT TASK
Exercise 3.2 - a
Chi Square Test
Expected Philippine
Age Class (Years) Obese (Percentage)
Average (Percentage)
20–30 75.0 32.6
31–40 26.5 32.6
41–50 13.6 36.6
51–60 21.9 36.6
61–70 21.0 39.7
119
ASSESSMENT TASK
Exercise 3.2 - b
Sign Test Wilcoxon Matched -Paired Signed-Ranks Test
120
ASSESSMENT TASK
Exercise 3.2 -c
Mann – Whitney U Test
Usual Care 8 7 6 2 5 8 7 3
New Program 9 9 7 8 10 9 6
121
ASSESSMENT TASK
Exercise 3.2 - d
X2 Test for k Independent Samples
122
ASSESSMENT TASK
Exercise 3.2 -e
Kruskal – Wallis Test One-way ANOVA by Ranks
1. Here is a group of six different rats with their swim speeds on different days
as a result of a change in the water temperature. The question is whether
or not changing the water temperature in the maze affects the swimming
speed.
Animal 20 oC 24 oC 27 oC 32oC
1 39 38 34 31
2 29 27 24 22
3 36 37 29 19
4 25 29 18 24
5 31 27 20 20
6 24 33 30 33
123
ASSESSMENT TASK
Exercise 3.2 - f
Kendall Rank Correlation Coefficient: r
1. Ten teachers are being ranked for promotion by the University President
and Representative from Faculty Association. The data are presented
below. Determine the degree of relationship between the two.
Representative from Faculty
University President
Association
1 5
2 4
3 10
4 9
5 1
6 2
7 6
8 7
9 8
10 3
124
References:
125
11. Friedman Test. Retrieve from
https://www.sciencedirect.com/topics/medicine-and-dentistry/friedman-
test#:~:text=The%20Friedman%20test%20is%20an,treatments%20have%
20the%20same%20distributions.&text=Rank%20the%20data%20within%2
0each,treatment%20outcomes%20for%20each%20patient).
12. Kruskal – Wallis Test. Retrieved from https://statistics.laerd.com/spss-
tutorials/kruskal-wallis-h-test-using-spss-statistics.php
13. Chi square Test for Independent k sample. Retrieved from
https://www.statisticssolutions.com/non-parametric-analysis-chi-square/
14. Chi square Test for Independent k sample. Retrieved from
https://sphweb.bumc.bu.edu/otlt/MPH-
Modules/BS/BS704_HypothesisTesting-
ChiSquare/BS704_HypothesisTesting-ChiSquare3.html
126