Download Presentation
## Chapter 21

- - - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - - -

**Chapter 21**Nonparametric Statistics**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…**Population Locations…**• These two populations have the same location… population 1 population 2**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**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**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.**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…**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**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.**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…**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”**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?**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…**Sampling Distribution of the Test Statistic**• Enumerate & k Calculate & l Probabilities… 1 combination 3 combinations Total of 20 combinations**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…**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).**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**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.**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.**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…**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…**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”**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…**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.**Identifying Factors…**• Factors that identify the Wilcoxon Rank Sum…**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…**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?**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**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**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?**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**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.”**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**Checking the Required Conditions…**• The sign test requires: • The populations be similar in shape and spread: • The sample size exceeds 10 (n=23).**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…**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:**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.**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.**Example 21.4…**COMPUTE ranks of +ve differences… ranks of -ve differences… The Original Data Rank Sums Sorted ascending by |difference|**Example 21.4…**COMPUTE • We compute our test statistic as follows… • Our rejection region is…**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**Identifying Factors I…**• Factors that Identify the Sign Test…**Identifying Factors II…**• Factors that Identify the Wilcoxon Signed Rank Sum Test…**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.**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):**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:**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…**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**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…**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.