Download

# Chapter 21

Télécharger la présentation

## Chapter 21

- - - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - - -
##### Presentation Transcript

1. Chapter 21 Nonparametric Statistics

2. Nonparametric Statistics… • This chapter deals with statistical techniques that deal with ordinal data. • Recall: when the data are ordinal, the mean is not an appropriate measure of central location. Instead, we will test characteristics of populations without referring to specific parameters, hence the term nonparametric. • Rather than testing to determine whether the population means differ, we will test to determine whether the population locations differ…

3. Population Locations… • These two populations have the same location… population 1 population 2

4. Population Locations… • The location of pop’n 1 is to the left of the location of pop’n 2… • The location of pop’n 1 is to the right of the location of pop’n 2… population 1 population 2 population 2 population 1

5. Problem Objectives… • When the problem objective is to compare two populations the null hypothesis will state: • H0: The two population locations are the same. • The alternative hypothesis can take on any one of the following three forms: • u H1: The location of population 1 is different from the location of population 2 • v H1: The location of population 1 is to the right of the location of population 2 • w H1: The location of population 1 is to the left of the location of population 2

6. The Alternative Hypotheses… • u H1: The location of population 1 is different from the location of population 2 •  Used when we want to know whether there is sufficient evidence to infer that there is a difference between the two populations.

7. The Alternative Hypotheses… • v H1: The location of population 1 is to the right of the location of population 2 • Used when we want to know whether we can conclude that the random variable in population 1 is larger in general than the random variable in population 2, and, not surprisingly…

8. The Alternative Hypotheses… • w H1: The location of population 1 is to the left of the location of population 2 • Used when we want to know whether we can conclude that the random variable in population 1 is smaller in general than the random variable in population 2. NOTE: all of our hypotheses are phrased in terms of “1 then 2”. This is for consistency. Rather than state: H1: The location of population 2 is to the left of the location of population 2, we would want to phrase this as: H1: The location of population 1 is to the right of the location of population 2

9. Wilcoxon Rank Sum Test… • We’ll use the Wilcoxon Rank Sum Test for problems where: • — We’re asked to compare two populations, • — The data are ordinal or interval (where the normality requirement is unsatisfied), and • — The samples are independent.

10. Example 21.1 • From these samples: • u: 22, 23, 20 • v: 18, 27, 26 Can we conclude (at 5% confidence level of course) that the location of population 1 is to the left (i.e. “smaller”) that the location of population 2? • That is, we want to test: • H0: The two population locations are the same. • H1: The location of population 1 is to the left of the location of population 2. • We can test this, we just need a test statistic…

11. Test Statistic… • Step #1… rank the observations from smallest to largest, assign a rank number, and add up the “rank sum”… *in the case of “ties” we average the ranks of the tied observations. We arbitrarily select T1 as the test statistic and label it “T”

12. Sampling Distribution of the Test Statistic • A small value of T indicates most of the smaller observations are in sample 1 which was drawn from population 1 — but how small is “small”? Is 9 “small” enough? • We have our test statistic, T=9. We need to compare it to some critical value of “T” to know if we’re in the rejection region for H0 (or not). • So, what then, does the sampling distribution of “ranks” look like?

13. Sampling Distribution of the Test Statistic • We can build up the sampling distribution of the test statistic in much the same way we we built histograms for the outcomes of rolls of 2 and 3 dice… • j Enumerate all possible combinations of ranks • k Calculate ranks sums for the combinations • l The probability of any rank sum is the number of occurrences divided by the total number of combinations…

14. Sampling Distribution of the Test Statistic • Enumerate & k Calculate & l Probabilities… 1 combination 3 combinations Total of 20 combinations

15. Sampling Distribution of the Test Statistic 5% X P(T≤6) = 1/20 = .05 Thus our critical value of T is 6 Since T=9 < TCritical=6, we cannot reject H0…

16. Example 21.1… INTERPRET • We cannot reject the null hypothesis, that is, there is not enough evidence to conclude that the location of population 1 is located to the left of population 2 (at 5% significance).

17. Critical Values: Wilcoxon Rank Sum Test… • For sample sizes smaller than 10 observations (in each sample), refer to the Critical Values in Table 8 (Appendix B) • For sample sizes larger than 10, the test statistic is approximately normally distributed with: • Mean: Hence: • Standard Deviation: ni=size of sample i, i=1,2

18. Example 21.2… • A drug company is trialing a new painkiller. 30 people were selected at random, half were given the new drug, half given aspirin, and all were told to rate the effectiveness on a five point scale (hence ordinal data): • 5 = The drug was extremely effective. • 4 = The drug was quite effective. • 3 = The drug was somewhat effective. • 2 = The drug was slightly effective. • 1 = The drug was not at all effective.

19. Example 21.2… IDENTIFY • The data were recorded. Can we conclude (at 5% significance) that the new painkiller is perceived to be more effective? • Its important to note here that “5” is a “good” score, so if the drug is effective, we’d likely see its location “greater than” the location of aspirin users, hence: • H1: The location of population 1 is to the right of the location of population 2, and so: • H0: The two population locations are the same.

20. Example 21.2… IDENTIFY • The data looks like: These three ones would occupy ranks 1, 2, & 3 — we average them (2) and each is assigned that rank… These five twos would occupy ranks 4,5,6,7, & 8 — again, average them to (4+5+6+7+8)/5 = 6 and so on and so forth…

21. Example 21.2… COMPUTE • (though not shown here) The rank sum for the new painkiller is T1=276.5, and the rank sum for aspirin: T2=188.5 • Set T= T1=276.5, and begin calculating…

22. Example 21.2… COMPUTE • The p-value of the test is: • p-value = P(Z > 1.83) = .5 - .4664 = .0336 • (or Z=1.83 > ZCritical=1.645), hence: • “There is sufficient evidence to infer that the new painkiller is perceived to be more effective than aspirin”

23. Example 21.2… COMPUTE • We can use the Wilcoxon Rank Sum Test in the Data Analysis Plus set of tools to come to the same conclusion… p-value compare…

24. Required Conditions… • The Wilcoxon rank sum test actually tests to determine whether the population distributions are identical. This means that it tests not only for identical locations, but for identical spreads (variances) and shapes (distributions) as well. • The rejection of the null hypothesis may be due instead to a difference in distribution shapes and/or spreads. • To avoid this problem, we will require that the two probability distributions be identical except with respect to location.

25. Identifying Factors… • Factors that identify the Wilcoxon Rank Sum…

26. Tests for Matched Pairs Experiments… • We will now look at two nonparametric techniques (Sign Test and Wilcoxon Signed Rank Sum Test) that test hypotheses in problems with the following characteristics: • — We want to compare two populations, • — The data are either ordinal or interval (nonnormal), • — and the samples are matched pairs. • As before, we’ll compute matched pair differences and work from there…

27. The Sign Test… • We can use the Sign Test when we’re dealing with two populations of ordinal data in a matched pairs experiment. • For each matched pair, take the differences and count up the number of positive differences and negative differences. • If population locations are the same (say), we’d expect the number of positives and negatives to net out to zero. If we have more positives than negatives (or vice versa) what can we learn? Again, how many is enough to make a difference?

28. Sign Test… • We can think of the sign test in terms of a binomial experiment, getting a positive sign is like flipping heads on a coin. We use this notion along with previously developed statistics to come up with our standardized test statistic (assuming the null hypothesis is true): • Our null hypothesis: • H0: the two population locations are the same • is equivalent to: • H0: p = .5 (i.e. equal proportions of +’s & –’s) n≥10

29. Sign Test Hypotheses… • Since our null hypothesis is: • H0: the two population locations are the same (i.e. p=.5) • Our research hypothesis must be: • H1: the two population locations are different • which is the same as: • H1: p ≠ .5

30. Example 21.3… • 25 people were asked to ride in a European car (and rate the ride) then ride in a North American car (and again, rate the ride). The ratings were ordinal, from 1 – very uncomfortable to 5 – very comfortable, and it’s a matched pairs experiment since the same rider tried both cars. [Xm21-03.xls] • Can we conclude (at 5% significance) that the European car is perceived to be more comfortable than the North American car?

31. Example 21.3… COMPUTE • The data was analyzed… We had 5 negative responses. We had 25 pairs of data initially, two pairs gave identical ratings (i.e. delta = zero) so these data points are dropped, hence n=23 We had 18 positive responses, thus x=18

32. Example 21.3… INTERPRET • The p-value is P(Z > 2.71) = .0034, hence we reject H0 in favor of H1, and conclude: • H1: the two population locations are different • Or, in the context of this problem… • “There is relatively strong evidence to indicate that people perceive the European car to provide a more comfortable ride than the North American car.”

33. Example 21.3… COMPUTE • Again, we can leverage Excel to reduce the amount of work that we have to do to perform the Sign Test* p-value compare… *Data Analysis Plus

34. Checking the Required Conditions… • The sign test requires: •  The populations be similar in shape and spread: •  The sample size exceeds 10 (n=23).

35. Wilcoxon Signed Rank Sum Test… • We’ll use Wilcoxon Signed Rank Sum test when we want to compare two populations of interval (but not normally distributed) date in a matched pairs type experiment. • j Compute paired differences, discard zeros. • k Rank absolute values of differences smallest (1) to largest (n), averaging ranks of tied observations. • l Sum the ranks of positive differences (T+) and of negative differences (T–). • m Use T=T+ as our test statistic…

36. Wilcoxon Signed Rank Sum Test… • Now we have a test statistic, but what to compare it against? • For small sample sizes, i.e. n ≤ 30, critical values of T can be read from Table 9 in Appendix B. • For large sample sizes, i.e. n > 30, T is approximately normally distributed, so we have:

37. Example 21.4… IDENTIFY • Do travel times to the office vary between an 8:00 am start and a “flextime” start? 32 workers recorded their travel times • We want to research this hypothesis: • H1: the two population locations are different • Thus we require: • H0: the two population locations are the same.

38. Example 21.4… IDENTIFY • The data are interval (i.e. times) and were produced by a matched pairs experiment (same drivers, same day of the week – Wednesday). Why aren’t we using a t-test for ? • A histogram of the paired differences reveals a non-normal distribution, hence we must use a non-parametric technique.

39. Example 21.4… COMPUTE ranks of +ve differences… ranks of -ve differences… The Original Data Rank Sums Sorted ascending by |difference|

40. Example 21.4… COMPUTE • We compute our test statistic as follows… • Our rejection region is…

41. Example 21.4… INTERPRET • The Wilcoxon Signed Rank Sum Test tool in Data Analysis Plus yields the same result: there is not enough evidence to infer that flextime commute times differ from 8:00 am start commute times. compare… p-value

42. Identifying Factors I… • Factors that Identify the Sign Test…

43. Identifying Factors II… • Factors that Identify the Wilcoxon Signed Rank Sum Test…

44. Kruskal-Wallis Test… • So far we’ve been comparing locations of two populations, now we’ll look at comparing two or more populations. • The Kruskal-Wallis test is applied to problems where we want to compare two or more populations or ordinal or interval (but nonnormal) data from independent samples. • Our hypotheses will be: • H0: The locations of all k populations are the same. • H1: At least two population locations differ.

45. Test Statistic… • In order to calculate the Kruskal-Wallis test statistic, we need to: • j Rank all the observations from smallest (1) to largest (n), and average the ranks in the case of ties. • k We calculate rank sums for each sample: T1, T2, …, Tk • l Lastly, we calculate the test statistic (denoted H):

46. Sampling Distribution of the Test Statistic: • For sample sizes greater than or equal to 5, the test statistic H is approximately Chi-squared distributed with k–1 degrees of freedom. • Our rejection region is: • And our p-value is:

47. Example 21.5… IDENTIFY • Can we compare customer ratings (4=good … 1=poor) for “speed of service” across three shifts in a fast food restaurant? Our hypotheses will be: • H0: The locations of all 3 populations are the same. • (that is, there is no difference in service between shifts), and • H1: At least two population locations differ. • Customer ratings for service were recorded…

48. Example 21.5… COMPUTE • One way to solve the problem is to take the original data, • “stack” it, and then • sort by customer response • & rank bottom to top… sorted by response

49. Example 21.5… COMPUTE • Once its in “stacked” format, put in straight rankings from 1 to 30, average the rankings for the same response, then parse them out by shift to come up with rank sum totals…

50. Example 21.5… COMPUTE • Our critical value of Chi-squared (5% significance and k–1=2 degrees of freedom) is 5.99147, hence there is not enough evidence to reject H0.