Non- Parametric test
Median test
Median test is also a Non-Parametric test and it is alternative to Parametric T test. The median test is used when we are interested to check the two independent sample have same median or not. It is useful when data is discrete or continuous and if data is in small size.
Assumptions:
I) the variable under study is ordinal scale
II) the variable is random and Independent.
The stepwise procedure for computation of median test for two independent sample :
Step I :- firstly we define the hypothesis
Null Hypothesis is the two independent sample have same median.
Against
Alternative Hypothesis is the two independent sample have different median.
Step II:- In this step we combine two sample data. And calculating the median of combined data.
Step III:- after that for testing hypothesis we constructing the (2x2) contingency table. For that table we divide the sample into two parts as number of observation above and below to the median for both sample then the formulated table is
|
Sample I |
Sample II |
Total |
No. of observations less then median |
a |
b |
a+b |
No. of observations greater than or
equal to median |
|
d |
c+d |
Total |
a+c |
b+d |
n |
Here we deciding the data first sample as number of observation less than median is a and the number of observations greater then or equal to median is c. In the above table. Similarly for second sample the number of observation in second sample is less than median is b and number of observations are greater than or equal to median is d. Then calculating marginal totals are (a+c), (b+d),(c+d),(a+b).
I .If number of observation (n1+n2) greeter than 40 then use chi-square test.
II. If number of observation (n1+n2) less than 20 then use fishers exact test.
If expected frequency is less than 5 then use corrected formula of chi-Squaee test.
Step IV-
The test statistics is chi-square and it is calculated as
χ2 = {[n (|ad-bc|-(n/2))^2]/ (a+b)x(c+d)x(a+c)x(b+d)} is calculated value
Corrected formula of chi-Squaee - in this step we defining the test statistics as chi-square and it is calculated as
χ2 = {[n (|ad-bc|-(n/2))^2]/ (a+b)x(c+d)x(a+c)x(b+d)} is calculated value
where n = a+b+c+d
Decision Rule:- for taking decision about hypothesis the critical value for test statistics is obtained in table of critical value table of chi-square.
If the calculated chi-square is less than the tabulated chi-square we accept the null hypothesis at ∝ % of level of significance. Otherwise reject the null hypothesis.
critical value for chi-square for 1 degrees of freedom is 3.841 at 5% of level of significance and
6.635 at 1% of level of significance
Small sample test :-
Fisher's Exact Test:
If we are interested to check the two independent sample are drawn from population with unique median or not. In that case we use Media rest but there some conditions to use median test. In this case if the sample size( n1+n2) less than 20 and one or more expected cell frequencies of (2x2) contingency table is less 5 then we use Fisher's exact test.
In test consist of probability associated with all possible combination of (2x2) contingency table.
Assumptions:
I) the sample should be random and Independent.
II) the marginal totals of contingency table is fixed.
For Fisher's exact test follow following procedure:-
Step I :- we are interested to test the two independent sample are drawn from population with unique median or not. Then we use this test and for testing we set hypothesis as Null hypothesis is that the two samples have same median. Against the Alternative hypothesis is the two samples have different median.
Step II -: for performing test firstly we constructing the (2x2) contingency table. (Same as in median test) For that table we divide the sample into two parts as number of observation above and below to the median for both sample then the formulated table is
Sample I | Sample II | Total | |
No. of observations less then median | a | b | a+b |
No. of observations greater than or equal to median | d | c+d | |
Total | a+c | b+d | n |
Here we deciding the data first sample as number of observation less than median is a and the number of observations greater then or equal to median is c. In the above table. Similarly for second sample the number of observation in second sample is less than median is b and number of observations are greater than or equal to median is d. Then calculating marginal totals are (a+c), (b+d),(c+d),(a+b) fixed for each possible combination.
Step III:- this test based on the probability of all possible combinations of(2x2) contingency table. For obtaining all possible combination.
We define ns = smallest marginal Total, this obtained form table. For then if ns= n2= (c+d) then possible combination of (2x2) contingency table are obtained as (i,j) = (0, n2), (1, n2-1) ...........(n2,0) using this combination we prepare table with fixed original marginal Total. And computing the all possible value of table as
Pi j = {(a+b)!x(c+d)!x(b+d)!x(a+c)!}/ {n! x a! x b! x c! x d!}
Step IV:- in this step defining test statistics is P-value and is obtained as adding Pi j all probabilities which are less than or equal to the actual or original Pi j of (2x2) contingency table.
Decision rule : If P-value is less than or equal to ∝ % level of significance then we Reject null hypothesis.
the fisher's exact test is a statistical test used to determining the significance of the association between two categories. the fisher's exact the is particularly used when the sample size is small and the assumption are required for other test, such as the assumptions of chi-square test are not met then fisher's exact test is used. it provides a way to determine if the observed association between two variable is statistically significant, it gives idea about the relation between the variable investigate.
for example : the fisher's exact test is used in clinical research to assess the association between the two categorical variables. e.g. it is used to examine the relation between a specific treatment and its outcome.
Example: 10 boy and 15 girls were observed during the two play session. every children was scored for the degree of aggregation as:
Boy: 56 59 72 65 113 65 141 51 20 65
girl: 55 40 22 56 25 7 58 9 20 46 26 36 50 31 45
use the median test to test there is difference between the score of boys and girl.
Answer: for testing there is difference between the score of boys and girl.
firstly we define the hypothesis
Null Hypothesis : there is no significant difference between the score of boys and girl.
Against
Alternative Hypothesis : there is significant difference between the score of boys and girl.
In this step we combine two sample data. And calculating the median of combined data.
7, 9, 20,20, 22, 25, 26, 31, 36, 40, 45, 46, 50, 51, 55, 56, 56,58, 59, 65, 65, 65, 72, 113, 141.
Median = size of { (n+1) / 2} th observation
= size of 13 th observation
Median = 50
after that for testing hypothesis we constructing the (2x2) contingency table. For that table we divide the sample into two parts as number of observation above and below to the median for both sample then the formulated table is
|
Sample I |
Sample II |
Total |
No. of observations less then median |
1 |
11 |
12 |
No. of observations greater than or
equal to median |
9 |
4 |
13 |
Total |
10 |
15 |
25 |
here n1 + n2 = 25 is between 20 to 40 then we check the expected frequency of table.
|
Sample I |
Sample II |
No. of observations less then median |
(10x12)/25= 4.8 |
(12x15)/25=7.2 |
No. of observations greater than or equal to median |
(13x10)/25=5.2 |
(15x13)/25=7.8 |
the one sell have less than 5 expected frequency then we use chi-square statistics with yates correction for contingency table
χ2 = {[n (|ad-bc|-(n/2))^2]/ (a+b)x(c+d)x(a+c)x(b+d)}
χ2 = {[25 (|99-4|-(25/2))^2]/ 12x10x15x13}
χ2 = 7.271 it id calculated
and table value is 3.841 i.e. χ2 df, with 5% l.o.s.
the calculated chi-square is greater than the tabulated chi-square we Reject the null hypothesis at 5 % of level of significance.
hence there is significant difference between the score of boys and girl.
Fisher's Exact Test Example:
Example 1:- We are interested in two independent sample are drawn from population having identical median or not. For the following given data.
| Sample I | Sample II |
No. of observations less then median | 10 | 2 |
No. of observations greater than or equal to median | 3 | 5 |
Use appropriate test. At 5 % level of significance.
Solution:- for given example we want to test the two sample are drawn from population having identical median or not for testing we setting the Hypothesis as
Null Hypothesis :- the two independent sample drawn from population having identical median.
Alternative Hypothesis:- the two independent sample drawn from population having different median.
for performing test first we calculate marginal total.
Sample I | Sample II | Total | |
No. of observations less then median | 10 | 2 | 12 |
No. of observations greater than or equal to median | 5 | 8 | |
Total | 13 | 7 | 20 |
now we check the expected frequencies.
Sample I | Sample II | |
No. of observations less then median | (12x13)/20= 7.8 | (12x7)/20=4.2 |
No. of observations greater than or equal to median | (13x8)/20=5.2 | (7x8)/20=2.8 |
now we see the two expected frequencies are less then 5. and number of observation are 20, in this situation fisher's exact test is more appropriate.
now we find the ns=smallest marginal total = min(R1,R2,C1,C2)
Where R1 and R2 are total of first and second row respectively.
C1 and C2 are total of first and second column respectively.
Here 7 is smallest marginal Total corresponding to C2
There for we prepare the all possible combination as (0,7 ),(1,6),(2,5),(3,4),(4,3),(5,
Then we calculating Pij for each (2x2) contingency table.
Pij calculated as
Pi j = {(a+b)!x(c+d)!x(b+d)!x(a+c)!}/ {n! x a! x b! x c! x d!}
1) for (0,7)
| Sample I | Sample II | Total |
No. of observations less then median | 12 | 0 | 12 |
No. of observations greater than or equal to median | 1 | 7 | 8 |
Total | 13 | 7 | 20 |
Pi j = {(a+b)!x(c+d)!x(b+d)!x(a+c)!}/ {n! x a! x b! x c! x d!}
2)for (1,6)
| Sample I | Sample II | Total |
No. of observations less then median | 11 | 1 | 12 |
No. of observations greater than or equal to median | 2 | 6 | 8 |
Total | 13 | 7 | 20 |
| Sample I | Sample II | Total |
No. of observations less then median | 10 | 2 | 12 |
No. of observations greater than or equal to median | 3 | 5 | 8 |
Total | 13 | 7 | 20 |
| Sample I | Sample II | Total |
No. of observations less then median | 9 | 3 | 12 |
No. of observations greater than or equal to median | 4 | 4 | 8 |
Total | 13 | 7 | 20 |
| Sample I | Sample II | Total |
No. of observations less then median | 8 | 4 | 12 |
No. of observations greater than or equal to median | 5 | 3 | 8 |
Total | 13 | 7 | 20 |
| Sample I | Sample II | Total |
No. of observations less then median | 7 | 5 | 12 |
No. of observations greater than or equal to median | 6 | 2 | 8 |
Total | 13 | 7 | 20 |
| Sample I | Sample II | Total |
No. of observations less then median | 6 | 6 | 12 |
No. of observations greater than or equal to median | 7 | 1 | 8 |
Total | 13 | 7 | 20 |
| Sample I | Sample II | Total |
No. of observations less then median | 5 | 7 | 12 |
No. of observations greater than or equal to median | 8 | 0 | 8 |
Total | 13 | 7 | 20 |
P-value is sum of all Pi j which are less than or equal to Pi j of original (2x2) contingency table.
Therefore P- value is
P-value = .0.0001 + 0.0102 + 0.0477 + 0.0043= 0.062
For taking Decision we comparing P- value with ∝% level of significance
Here P-value(0.062) is greater than level of significance 0.05 then we accept the null hypothesis and conclude that the two samples are drawn from population have identical median.
Comments
Post a Comment