* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
Download CHAPTER 14 – NONPARAMETRIC TESTS
Survey
Document related concepts
Transcript
CHAPTER 14 – NONPARAMETRIC TESTS Everything that we have done up until now in statistics has relied heavily on one major fact: that our data is normally distributed. We have been able to make inferences about population means (one-sample, two-sample z and t tests and analysis of variance), but in each case we assumed that our population was normal. What happens when we want to perform a test on our data, but we have no idea what its true distribution is, and therefore can’t assume that our data are normally distributed? In this case, we use what are called nonparametric tests. These tests do not require any specific form for the distribution of the population. Example #1 Let’s say that Stephen wanted to go hiking through a wooded area and had no idea what types of trees or conditions he might find. So he decided to bring with him a multipurpose pocket knife, which had a can opener, scissors, bottle opener and a few cutting blades. Stephen didn’t know what to expect and in case of an emergency, or if he got trapped, he’d be able to open some of the cans of food and bottles that he had in his bag, and he’d also be able to cut through some material, albeit very slowly. But what if Stephen knew that there would be huge branches that he’d need to cut away in order to cross through the woods? In this case, he’d be much better off with a knife that was more specific to his cutting needs, say an axe. However, if he got trapped by some chance, he wouldn’t be able to open his tins of food as well, nor his bottles. So this example is pretty similar to the idea behind nonparametric tests. When we don’t know what type of conditions we are facing (what type of distribution we are dealing with) it is more beneficial to bring with a multipurpose knife (or to use a nonspecific distribution nonparametric test). However, although this knife might let you do more things, it doesn’t perform as well as a knife made for specific uses. On the other hand, if Stephen were to use an axe in unknown conditions, he wouldn’t be able to use it for many things, and if he were to use the axe to say open his bottle, chances are it would break. However, if Stephen knew that he would only need a knife for a specific condition, say to cut away branches, then his axe would come in very handy and would do the job well. So if we know what distribution we are dealing with, it is much more practical and useful to use a particular test that is designed for your specific purpose and conditions. If we know we are dealing with a normally distributed population, it is more beneficial to use a Z, t, or F test when performing an inference about means, and our results will be more accurate. When we don’t know what population we are dealing with, it is more beneficial to use a test that can work for any type of distribution, because that way you can be sure that you will be ‘prepared’ for any condition. At the same time, though, if your population really was normally distributed and you used a nonparametric test, then your results won’t be as accurate had you used a Z, t or F test. When our data is normally distributed, the mean is equal to the median and we use the mean as our measure of center. However, if our data is skewed, then the median is a much better measure of center. Therefore, just like the Z, t and F tests made inferences about the population mean(s), nonparametric tests make inferences about the population median(s). We are going to be focusing on nonparametric tests which are rank tests. In these types of tests, we rank (or place in order) each observation from our data set. Although we aren’t specifying which distribution our data is from, it must be from a continuous distribution. That is, each distribution must be described by a density curve that allows observations to take on any value in some interval. The following is a table which identifies a particular normal test and its nonparametric (or rank) counterpart. WILCOXON RANK SUM TEST The Wilcoxon Rank Sum test is used to test for a difference between two samples. It is the nonparametric counterpart to the two-sample Z or t test. Instead of comparing two population means, we compare two population medians. Draw an SRS of size n1 from population 1, and then draw an independent SRS of size n2 from population 2. So the total number of observations is N = n1 + n2. The next step in this test is to rank our set of observations. Although we are dealing with two samples, when we rank the observations, we rank them as if they came from one large group. When N is equal to our total sample size, our smallest observation receives a rank of 1, and the largest observation receives a rank of N. Working with ranks instead of numerical outcomes, allows us to abandon specific assumptions about the shape of the distribution. The sum of the ranks of the first sample is W, the Wilcoxon Rank Sum test statistic. If one sample is truly bigger than the other, we’d expect its ranks to be higher than the others. So after we have ranked all of the observations, we sum up the ranks for each of the two samples and we can then compare the two rank sums. If there is no difference between our two samples and our sample sizes are equal, then we’d expect W to be roughly half of N (N/2). If our sample sizes are different, then we’d expect W to be n1( N + 1) roughly equal to its mean/expected value ( µ w = ). When there truly is a 2 difference between the two samples, then W would be a value far from its mean. If both of our samples come from the same continuous distribution, then W has: n1( N + 1) - Mean µw = 2 n1n 2( N + 1) - Standard Deviation σ w = 12 We generally use words, rather than symbols to express the null and alternative hypotheses. As usual, our null hypothesis is that there is no difference between our two populations, and our alternative hypothesis specifies how we think the two populations are different (whether one-sided or two-sided). P-values are calculated by software, or using a normal approximation. We can form another Z statistic by standardizing W. Then once we have our Z statistic, we can find our p-value using the same methods as Stat I. W is standardized by: Z = W − µw σw = n1( N + 1) 2 n1n 2( N + 1) 12 W− Example #2 Many states are considering lowering the blood-alcohol level at which a driver is designated as driving under the influence (DUI) of alcohol. An investigator for a legislative committee designed the following test to study the effect of alcohol on reaction time. Ten participants consumed a specified amount of alcohol. Another group of ten participants consumed the same amount of a nonalcoholic drink, a placebo. The two groups did not know whether they were receiving alcohol or the placebo. The twenty participants’ average reaction times (in seconds) to a series of simulated driving situations are reported in the following table. A boxplot of the two samples show that the population distributions are skewed right. Does it appear that alcohol consumption increases reaction time? Perform a significance test and clearly state your hypotheses, test statistic, p-value and conclusion. Placebo 0.90 0.37 1.63 0.83 0.95 0.78 0.86 0.61 0.38 1.97 Alcohol 1.46 1.45 1.76 1.44 1.11 3.07 0.98 1.27 2.56 1.32 TIES When we find ties in our group of observations (two or more observations have the same value) how do we decide which gets the higher rank? We don’t, and instead we assign the same rank to all of our ties, so that each one contributes the same amount to the sum of the ranks for its group. Therefore, we assign the average of the all of the ranks that the ties occupy to them. For example, Observation: 153 Rank: 1 155 2 158 3.5 158 3.5 161 5 164 6 So in this case, had the two 158s been different, they would have received ranks of 3 and 4. Since they are equal, they each are assigned a rank of the average of 3 and 4 (3.5) and the remaining numbers continue being ranked as if 3 and 4 were assigned. Example #3 Rank this set of observations. Sample 1 5 7 Sample 2 8 9 5 6 9 12 WILCOXON SIGNED RANK TEST The Wilcoxon Signed Rank test is the nonparametric equivalent to the one-sample Z or t test and the matched pairs test. It is used when we want to make inferences about the mean of one population or the mean difference between two populations in a matched pairs setting. Draw an SRS of size n from a population for a matched pairs study and for each pair find the difference between the two responses. Then rank the absolute value of the differences. Then group all of the positive differences and the negative differences separately. The sum of the ranks of the positive differences is W+, the Wilcoxon Signed Rank test statistic. n(n + 1)(2n + 1) n (n + 1) and standard deviation σ W + = . W+ has mean µW + = 24 4 If there is a difference between our matched pairs, then we’d expect W+ to be far from its mean (or the expected value). To find the p-value, we need to standardize W+, which is n( n + 1) W+ − 4 done by finding Z, where Z = . Once we have Z, we can find the n( n + 1)(2n + 1) 24 appropriate p-value. When ties are present among the pairs, we assign average ranks. However, ties that occur within pairs, giving a difference equal to 0 for that pair, don’t add anything to our test statistic and are therefore dropped from our sample. Example #4 Eight subjects were asked to perform a simple puzzle assembly under normal conditions and under conditions of stress. During the stress condition the subjects were told that a mild shock would be delivered 3 minutes after the start of the experiment and every 30 seconds thereafter until the task was completed. Blood pressure readings were taken under both conditions. Data in the accompanying table represent the highest reading during the experiment. Do the data present sufficient evidence to indicate higher blood pressure readings during conditions of stress? Perform a significance test and clearly state your hypotheses, test statistic, p-value and conclusion. Subject Normal Stress 1 126 130 2 117 118 3 115 125 4 118 120 5 118 121 6 128 125 7 125 130 8 120 120 KRUSKAL-WALLIS TEST When we can assume that our data is normally distributed and that the population standard deviations are equal, we can test for a difference among several populations by using the One-way ANOVA F test. However, when our data is not normal, or we aren’t sure if it is, we can use the nonparametric Kruskal-Wallis test to compare more than two populations as long as our data come from a continuous distribution. In the One-way ANOVA F test, we are testing to see if our population means are equal. Since our data might not necessarily be symmetric in the nonparametric setting, it is better to use the median as the measure of center, and so in the Kruskal-Wallis test we are testing to see if our population medians are equal. Recall the analysis of variance idea: we write the total observed variation in the responses as the sum of two parts, one measuring variation among the groups (sum of squares for groups, SSG) and one measuring variation among individual observations within the same group (sum of squares for error, SSE). The ANOVA F test rejects the null hypothesis that the mean responses are equal in all groups if SSG is large relative to SSE. The idea of the Kruskal-Wallis rank test is to rank all the responses from all groups together and then apply one-way ANOVA to the ranks rather than to the original observations. If there are N observations in all, the ranks are always the whole numbers from 1 to N. The total sum of squares for the ranks is therefore a fixed number no matter what the data are. So we do not need to look at both SSG and SSE. Although it isn’t obvious without some unpleasant algebra, the Kruskal-Wallis test statistic is essentially just SSG for the ranks. When SSG is large, that is evidence that the groups differ. Draw independent SRSs of sizes n1,n2,...,nI from I populations. There are N observations in all. Rank all N observations and let Ri be the sum of the ranks for the ith sample. The 12 Ri 2 Kruskal-Wallis statistic is H = ∑ ni − 3( N + 1) N ( N + 1) When the sample sizes ni are large and all I populations have the same continuous distribution, H has approximately the chi-square distribution with I-1 degrees of freedom. The Kruskal-Wallis test rejects the null hypothesis that all populations have the same distribution when H is large. So like the Wilcoxon rank sum statistic, the Kruskal-Wallis test statistic is based on the sums of the ranks for the groups we are comparing. The more different these sums are, the stronger is the evidence that responses are systematically larger in some groups than in others. As usual, we again assign average ranks to tied observations. Example #5 A psychologist is trying to determine if there is a difference in three methods of training six-year-old children to learn a foreign language. A random selection of 10 six-year-old children with similar backgrounds is assigned to each of three different methods. Method 1 uses the traditional teaching format. Method 2 uses repeated listening to tapes of the language along with classroom instruction. Method 3 uses videotapes exclusively. At the end of a 6-week period, the children were given identical, standardized exams. The exams were scored with high scores indicating a better grasp of the language. Because of drop outs, method 1 had 7 students finishing, method 2 had 8, and method 3 only 6. it is, however, important to note that we must assume that children dropped out for reasons unrelated to performance. The data are given in the following table. Please conduct a significance test to determine if there is a difference between the three teaching methods, when we assume our data are not normally distributed. 1 - traditional 78 80 83 86 87 88 90 Teaching Method 2 – tapes + classroom 70 72 73 74 75 78 82 95 n1=7 n2=8 3 - tapes 60 70 71 72 74 76 n3=6