Uploaded by CHRISBAG EVENTS

NON PARAMETRIC TESTS

advertisement
SMT2106: STATISTICAL INFERENCE
NON-PARAMETRIC TESTS USING CHI-SQUARE TESTS
CONTINUED
2. TEST FOR HOMOGENEITY OF PROPORTIONS
In this test, samples are selected from several different populations and the researcher is
interested in determining whether the proportions of elements that have a common
characteristic are the same for each population.
The sample sizes are specified in advance making either the row totals or column totals in
the contingency table known before the samples are selected. The researcher then
compares the proportion for each group to see if they are equal.
The hypothesis testing procedure follows the following steps:
(i) State the hypotheses and determine the claim.
Ho: P1=P2=P3=…= Pn Or Ho : The proportions for the groups are equal
Ha: At least one proportion is different from others.
(ii) Find the critical value from the chi square table. This is always right tailed with the df = (r1)(c-1)
(iii) Compute the test statistic using the formula
(iv) Make a decision rule and conclude.
2
๐‘‹๐‘๐‘Ž๐‘™
= σ
๐‘‚−๐ธ 2
.
๐ธ
Examples
1. A researcher selected a sample of 50 seniors from each of the 4 area high
schools and asked each of them the question, “ Do you drive to school in a car
owned by either you or your guardians?”
The data are shown in the table below:
Response
School1
School2
School3
School4
Yes
20
22
16
29
No
30
28
34
21
At ∝ = 0.05, can it be concluded that the proportion of students who drive
their own or their guardian cars is the same for all the four schools?
NB:
When the df for a contingency table are equal to 1, i.e., it the
table is 2 ×2, use the correction formula for the test statistic
below:
2
๐‘‹๐‘๐‘Ž๐‘™
= เท
๐‘‚ − ๐ธ − 0.5
๐ธ
2
Where ๐‘‚ − ๐ธ is the absolute value.
This applies to both homogeneity of proportions and
independence of association test.
3. GOODNESS OF FIT TEST
The chi-square can also be used to describe the pattern of responses for a particular
categorical random value.
It is used when one is testing to see whether a frequency distribution fits a specific
pattern. It tests whether a random variable’s response pattern can be matched to a
given probability distribution such as Binomial, Poisson, Normal or some other
probability distribution .
The hypothesis testing procedure follows the following steps:
(i) State the hypotheses and determine the claim. The null hypothesis should be a
statement indicating that there is no difference or change.
(ii) Find the critical value from the chi-square distribution tables. This is always right
tailed, irrespective of whether it is two or one sided, with df = k−m − 1, where k
is the number of classes or categories, m is the number of population
parameters that need to be estimated from the sample data.
(iii) Compute the test statistic using the formula
(iv) Make a decision rule and conclude.
2
๐‘‹๐‘๐‘Ž๐‘™
= σ
๐‘‚−๐ธ 2
.
๐ธ
Examples
1. Suppose a market analyst wished to see whether consumers have only
preference among five flavors of a new fruit soda. A sample of 100 people
provided the following data:
Cherry
Straw berry
Orange
Lime
Grape
29
31
14
10
16
Is there enough evidence to reject the claim that there is no preference in the
selection the fruit soda flavors using the data shown at 5% level?
2. An economist employed by the rail commuter service is studying daily
commuting patterns of workers into the city center. A previous study
conducted in 1974 found that 60% of commuters used trains, 25% used cars
and 15% used buses. The economist’s own recent study of 300 commuters
found out that 120 commuters used trains, 132 used cars and the rest
travelled in buses. Can the economist conclude that commuting patterns into
the city center have not changed since 1974? Take ∝ as 0.05.
NB: When doing test of goodness of fit that include probability distributions, the
population parameters to be estimated for the df calculations are:
Population Distribution
Population Parameter
m
Binomial
๐œ‹
1
Poisson
๐œ‡
1
Normal
๐œ‡ and ๐›ฟ 2
2
3. The quality control procedure that is used by a factory which manufactures light
bulbs is to randomly select a batch of 3 bulbs every hour and subject these bulbs
destructive testing. The quality control department has estimated that each light
bulb has a 25 % chance of failing the test. From records kept, a sample of findings
from each of 200 batches of 3 bulbs examined showed that 65 batches had no
failures, 97 had 1 failure, 29 had 2 failures and all three bulbs failed in the case of
only 9 batches.
The quality controller is of the opinion that the number of light bulb failures per
batch can be described by a binomial distribution.
At 1% level, test the assumption that the number of light bulb failure per batch
follows the binomial process.
4. The manager of a computer facility has collected data on the number of days
that a service to users was interrupted ( due to machine failure) on each day over
the past 100 days.
Interruptions per day
0
1
2
3
Number of days
28
30
23
12
4 or more
7
Can it be assumed that the number of interruptions per day follows a Poisson
distribution with an average interruption rate of 1.5 per day at 10% level?
5. Use chi-square to determine if the marks of 200 students shown in the
frequency distribution table below are normally distributed at ∝ = 0.05.
Marks
Frequency
40 − 49
24
50 − 59
62
60 − 69
72
70 − 79
26
80 − 89
12
90 − 99
4
NON-PARAMETRIC STATISTICS
PART TWO
Statistical tests, such as Z-, t-, and F- tests are called Parametric tests.
This is because they are statistical tests for population parameters like
means, variances and proportions that involve assumptions about the
populations from which the samples were selected. They are normally
distributed in nature.
Statisticians normally use non-parametric statistics or distribution free
statistics to use when the population from which the samples are selected
are not normally distributed.
Some of the non-parametric tests include the Sign test, the Wilcoxon
rank-sum test, Wilcoxon signed rank test, the Runs test, the KruskalWallis test, etc.
Advantages of non-parametric tests
(i) They are used to test population parameters when the variable under
consideration is not normally distributed.
(ii) They are used when the data are nominal or ordinal
(iii) They are used to test hypotheses that do not involve population
parameters.
(iv) In most cases, the computations are easier than those of the parametric
tests.
(v) They are easier to understand.
Disadvantages
(i) They are less sensitive than parametric tests when the assumptions of the
parametric methods are met. Therefore, larger differences are needed before the
null hypotheses can be rejected.
(ii) They tend to use less information than the parametric tests. For example,
the sign test requires the researcher to determine only whether the data values
are above or below the median, not how much above or below the median each
value is.
(iii) They are less efficient than the parametric tests when the assumptions of
parametric methods are met. That is, larger sample sizes are needed to
overcome the loss of information.
THE SIGN TEST
Single sample Sign test.
This test is used to test the value of a median for a specific sample. When using
the sign test, the researcher hypothesizes a specific value for the median of a
population; then he or she selects a sample of data and compares each value
with the median.
If the data value is above the median, it is assigned a positive sign. If it is
below the median, it is assigned a negative sign. If it is exactly the same as the
median, then it is assigned a zero (0).
The number of positive and negative signs are compared. If the null
hypothesis is true or is accepted, then the number of positive signs should be
approximately equal to the number of negative signs.
If the null hypothesis is not true, then there will be a disproportionate number
of positive and negative signs.
Finding the test value:
The test statistic or test value is the smaller of the positive or negative signs.
For example, if there are 10 positive signs and 6 negative signs, then the test
value is 6.
When the sample size is 25 or less, the critical value is obtained from the signs
tables. For a specified value of ∝, if the test value is less than or equal to the
critical value from the table, then the null hypothesis is rejected. Otherwise, it
is accepted.
Example
1. A convenience store owner hypothesizes that the median number of snow
cones he sells per day is 40. A random sample of 20 days yields the following
data for the number of snow cones sold each day:
18,30,39,36,43,29,34,40,32,40,39,34,16,37,45,39,22,36,28,52.
At 5% level, is the store owner’s claim correct?
Solution.
Ho: Median = 40 Claim
Ha: Median ≠ 40.
Finding the critical value
Assign (+) value for each data value greater than 40 and (-) value for each data
value less than 40. Then (0) for the data value equal to the median.
-, -, -, -, +, -, -, 0, -,0,-, -, -, -, +, -, -, -, -, +
Omitting the zeros, the total number of the positive and negative signs is 18.
This implies that n = 18.
For at a two tailed test at
n=18 and ∝ = 0.05,
The critical value = 4
Finding the test statistic.
There are 3 positive signs
and 15 negative signs.
Since 3 is the smaller of
3 and 15, therefore,
the test value is 3.
Decision rule:
Since the test value (3) < the critical value(4), we reject Ho and conclude that
there is enough evidence to reject the claim that the median number of snow
cones sold per day is 40.
When the sample size is 26 and above, the normal approximation can be used
to find the test value using the formula below:
n
Z cal =
X+0.5 − 2
n
2
Where X = Smaller number of positives or negatives and n = the sample size.
Example 2. Based on past experience, a manufacturer claims that the median
lifetime of rubber washer is at least 8 years. A sample of 50 washers showed
that 21 of them lasted for more than 8 years.
At ∝ = 0.05, is there enough evidence to reject the manufacturer’s claim?
The critical value at ∝ = 0.05 is
Solution
Z tab = − 1.645
50
Ho: Median ≥ 8 Claim
21+0.5 −
2
Zcal =
The test value:
50
2
Ha: Median < 8.
Since Zcal is found in the acceptance
n
Z cal =
X+0.5 − 2
n
2
= − 0.9899
region, we accept Ho and conclude that
there is no enough evidence to reject the
claim.
Using the binomial approach to find the test value under the sample sign test
Example 1
The compressive strength of insulating blocks used in the construction of new
houses is tested by a civil engineer. The engineer needs to be certain at the 5%
level of significance that the median compressive strength is at most 1000 .
Twenty randomly selected blocks give the following results:
Test (at the 5% level of significance) the null hypothesis that the median
compressive strength of the insulting blocks is indeed at most 1000 .
Solution The hypotheses are :
H0 : θ ≤ 1000
H1 : θ > 1000
We have 14 plus signs and the required probability value is calculated directly
from the binomial formula as
= 0.05766
Since 0.05 < 0.05766 we conclude that we cannot reject the null hypothesis and that on the basis of the
available evidence, we cannot conclude that the median compressive strength of the insulating blocks is
3.
Solution
= 0.1719
The sign test for paired data
Very often, experiments are designed so that the results occur in matched pairs.
In these cases the sign test can often be applied to decide between two
hypotheses concerning the data. Performing a sign test involves counting the
number of times when, say, the first score is higher then the second −
designated by a “+” sign and the number of times that the first score is lower
than the second − designated by a “−” sign.
Ties
It is, of course, possible that in some cases, the scores will be equal, that is,
they are said to be tied. There are two ways in which tied scores are dealt with.
Method 1
Ties may be counted as minus signs so that they count for the null hypothesis.
The logic of this is that equal scores cannot be used as agents for change.
Method 2
Ties may be discounted completely and not used in any analysis performed.
The logic of this is that ties can sometimes occur because of the way in which
the data are collected. Throughout this Workbook, any ties occurring will be
discounted and ignored in any subsequent analysis.
Example
In an experiment concerning gas cutting of steel for use in off-shore structures,
48 test plates were prepared. Each plate was cut using both oxy-propane cutting
and oxy-natural gas cutting and, in each case, the maximum Vickers hardness
near the cut edge was measured. The results were as follows.
Use a sign test to test the null hypothesis that the mean difference between the
hardnesses produced by the two methods is zero against the alternative that it is
not zero. Use the 1% level of significance.
Solution
We are testing to see whether there is evidence that the media difference
between the hardnesses produced by the two methods is zero. The null and
alternative hypotheses are:
H0 : θdifferences = 0
H1 : θdifferences ≠ 0
We perform a two-tailed test. The signs of the differences (propane minus
natural gas) are shown in the table below.
There are 34 positive differences and 14 negative differences. The probability
of getting 14 or fewer negative differences, if the probability that a difference is
negative is 0.5, is;
= 0.0027576
For a two-sided test at the 1% level we must compare this probability with
0.5%, that is 0.005. We see that, our probability is less than 0.005. We therefore
reject the null hypothesis and conclude that the evidence suggests strongly that
the median of the differences is not zero but is, in fact, positive. Use of propane
tends to result in greater hardness.
So our test statistic is significant at the 1% level.
2.
Automotive development engineers are testing the properties of two anti-lock
braking systems in order to determine whether they exhibit any significant
difference in the stopping median distance achieved by different cars. The
systems are fitted to 10 cars and a test is run ensuring that each system is used
on each car under conditions which are as uniform as possible. The stopping
distances (in yards) obtained are given in the table below:
Solution
We are testing to find any differences in the median stopping distance figures
for each braking system.
The null and alternative hypotheses are:
H0 : θ1 = θ2
or H0 : θdifferences = 0
H1 : θ1 ≠ θ2
or H1 : θdifferences ≠ 0
We perform a two-tailed test.
The signed differences shown by the
two systems are shown in the table
On the side
We have 9 plus signs and the required probability value is calculated directly
from the binomial formula as;
= 0.01074
Since we are performing a two-tailed test, we must compare the calculated
value with the value 0.025. Since 0.01074 < 0.025 we reject the null
hypothesis on the basis of the available evidence and conclude that the
differences in the median stopping distances recorded is significant at the 5%
level.
The Wilcoxon Rank Sum Test
The Wilcoxon rank sum test is a nonparametric test that uses ranks to
determine if two independent samples were selected from populations that have
the same distributions.
In the Wilcoxon rank sum test, the values of the data for both samples are
combined and then ranked. If the null hypothesis is true—meaning that there is
no difference in the population distributions—then the values in each sample
should be ranked approximately the same.
Therefore, when the ranks are summed for each sample, the sums should be
approximately equal, and the null hypothesis will not be rejected. If there is a
large difference in the sums of the ranks, then the distributions are not identical
and the null hypothesis will be rejected. There are two assumptions for this test.
Assumptions for the Wilcoxon Rank Sum Test
1. The samples are random and independent of one another.
2. The size of each sample must be greater than or equal to 10
The formula for the Wilcoxon Rank Sum Test When Samples Are Independent
Note that if both samples are the same
size, either size can be used as n1
Wilcoxon Rank Sum Test Steps
1. State the hypotheses and identify the claim.
2. Find the critical value(s). Use Standard normal tables.
3. Compute the test value.
a. Combine the data from the two samples, arrange the combined data in
order, and rank each value.
b. Sum the ranks of the group with the smaller sample size.
(Note: If both groups have the same sample size, either one can be used.)
c. Use these formulas to find the test value
Where R is the sum of the ranks of the data
in the smaller sample and n1 and n2 are
each greater than or equal to 10.
4. Make the decision.
5. Summarize the results.
Example1. Two independent random samples of army and marine recruits are
selected, and the time in minutes it takes each recruit to complete an obstacle
course is recorded, as shown in the table. At a 0.05, is there a difference in the
times it takes the recruits to complete the course?
H0: There is no difference in the times it takes the recruits to complete the obstacle
course.
H1: There is a difference in the times it takes the recruits to complete the obstacle
course (claim).
Find the critical value.
Since ∝ = 0.05 and this test is a two-tailed test, then Ztab = 1.96
Compute the test value.
a. Combine the data from the two samples, arrange the combined data in
ascending order, and rank each value. Be sure to indicate the group.
Sum the ranks of the group with the smaller sample size. (Note: If both groups
have the same sample size, either one can be used.) In this case, the sample size for
the marines is smaller.
R = 1 + 2 + 3 + 4+ 5 + 7+ 8.5 + 10.5+ 14.5 + 16.5+ 21
= 93
Practice question
The Wilcoxon Signed-Rank Test
When the samples are dependent, as they would be in a before-and-after test using
the same subjects, the Wilcoxon signed-rank test can be used in place of the t test
for dependent samples. Again, this test does not require the condition of normality
The Wilcoxon signed-rank test is a nonparametric test used to test whether two
dependent samples have been selected from two populations having the same
distributions.
However, the following assumptions for the Wilcoxon signed-rank test must be met
before it can be used.
Assumptions for the Wilcoxon Signed-Rank Test
1. The paired data have been obtained from a random sample.
2. The population of differences has a distribution that is approximately
symmetric.
The table is used for the critical values when . Use the column for the critical value
along with the row for the value of n.
To find the test value for the
Wilcoxon signed-rank test,
denoted by ws , rank the
absolute values of the
differences of each pair of data
values.
Assign either a – or + a sign to
each rank according to the
original value of the difference.
Then sum the positive ranks and
the negative ranks separately.
Finally, select the smaller of the
absolute value of the sums as the
test value ws
When , the normal distribution can be used to approximate the Wilcoxon
distribution. The same critical values for the z test are used. The formula is for
calculating the test statistic is given as:
where
n = number of pairs where difference is not 0
ws = smaller sum in absolute value of signed ranks
The steps for the Wilcoxon signed-rank test are given in the Procedure Table below:
EXAMPLE 1 is on Shoplifting Incidents
In a large department store, the owner wishes to see whether the number of
shoplifting incidents per day will change if the number of uniformed security
officers is doubled. A random sample of 7 days before security is increased
and 7 days after the increase shows the number of shoplifting incidents
Is there enough evidence to support the claim, at , that there is a difference in the
number of shoplifting incidents before and after the increase in security?
• SOLUTION
Step 1 :State the hypotheses and identify the claim.
H0: There is no difference in the number of shoplifting incidents before and
after the increase in security.
H1: There is a difference in the number of shoplifting incidents before and
after the increase in security (claim).
Step 2 Find the critical value from Table K because . Since n = 7 and ∝= 0.05
for this two-tailed test, the critical value is 2.
Practice question
Download