Math 217 Computer Lab – Non-Parametric Tests

 

Getting the Needed Files

Double click on the My Computer icon on the desktop. Then double click on the campus_share on 'curtis' (U:)  drive and then the Class_Share folder. Finally, double click on the Math folder and then the Math217 folder. Make copies of the AlcoholIntake.MPJ, ReactionTime2.MPJ, and WeightLoss.MPJ files and put them in your account. Then open the WeightLoss.MPJ file from your account

 

Description of WeightLoss.MPJ

These are data we just talked about as a class when I introduced the sign test. They are the weight losses of 10 people (let’s assume a random or representative sample) on a special diet.

 

Wilcoxon Signed Rank Test (Modification of the Sign Test)

Suppose you have a single sample of data (or you have a set of paired data that reduces to a single sample of differences). The Wilcoxon signed tank test has a null hypothesis that the median of the population is a certain number (when dealing with paired data, the null hypothesis is that the median is 0, but only if the two paired distributions have the same shape). The test statistic takes into consideration both the sign and the rank of the sample data differences (this is an improvement over the simple sign test). The null distribution of the test statistic is more complicated than with the simple sign test. Hence, you’ll leave Minitab to do the calculations. This test is the nonparametric equivalent to the one-sample or paired t-test (although it tests different hypotheses).

 

Create a dotplot and a boxplot of the weight loss values. Clearly, there is a strong outlier, which can affect the test results, and brings into question the condition of normality of the population. So we should be hesitant to use the one-sample t-test. One way to handle this situation is to perform both the t-test and the Wilcoxon signed rank test, and see if they agree.

 

First perform the t-test. From the Stat menu select Basic Statistics>1-Sample t. Select Weight Loss as the “Sample in columns:” variable. Then type in 0 as the hypothesized mean (and from the Options button select a one-sided alternative). Now perform the Wilcoxon signed rank test. From the Stat menu select Nonparametrics>1-Sample Wilcoxon. Choose Weight Loss as your variable and 0 as your test median (and greater than as your alternative).

 

Now compare the two results. Note the p-values are quite close, and they both indicate significant results. (That is, we have strong evidence that the average weight loss for everyone on the special diet is greater than 0 pounds.)

 

Description of AlcoholIntake.MPJ

In 1986, a group of researchers studied a social skills training program for alcoholics. Twenty-three “alcohol-dependent” male inpatients at an alcohol treatment center were randomly assigned to two groups. The control group patients were given a traditional treatment program. The treatment group patients were given the traditional treatment program plus a class in social skills training. After being discharged from the program, each patient reported the quantity of alcohol consumed over the next year (reports were verified by other sources). The data are shown in the Minitab worksheet.

 

Mann-Whitney Test (Also called the Wilcoxon Rank Sum test)

Suppose you have independent samples from two different populations. The Mann-Whitney test allows you to test for equality of medians (not means) without the added condition of normality (although it does require a condition of similar shapes for the two distributions—if the condition of similar shapes is not met, then the null hypothesis of the Mann-Whitney test is that the variable values for the two different treatments have the same distribution). The test consists of ranking the entire set of observations (from both populations), and then summing the ranks for the first sample. Again, you will have Minitab do the calculations for you. This test is the nonparametric equivalent to the two-sample t-test (although it tests different hypotheses).

 

Of interest is whether the average alcohol intakes are different for the two groups. Create side-by-side histograms of the two samples of data. Neither of the sample distributions looks extremely non-normal, but you may be concerned about the low value for the treatment group and the high peak for the control group. If so, you can perform both the two-sample t-test and the Mann-Whitney test.

 

First do the t-test. From the Stat menu select Basic Statistics>2-Sample t. Choose “Samples in different columns:” and enter control alcohol intake (ozs) and treatment alchohol intake (ozs) as the two variables, and then click on OK. What does the Minitab output tell you?

 

Now do the Mann-Whitney test. From the Stat menu select Nonparametrics>Mann-Whitney. Enter the two variables as the two samples. Then click on OK. Note the p-value for the Mann-Whitney test is very close to the p-value for the two-sample t-test, and they both indicate significant results. (The average alcohol consumptions are significantly different. Furthermore, based on the data we can see the treatment group drank significantly less on average.)

 

Description of ReactionTime2.MPJ

Suppose an experiment is done where the response variable is the time (in minutes) for a certain chemical reaction to occur and the one factor is temperature (60, 80, or 100 degrees Fahrenheit). The data in this Minitab project are results from this hypothetical experiment.

 

Kruskal-Wallis Test

We’d like to know if there is a difference in reaction times based on temperature. Look at boxplots and numerical summaries of the data (reaction time separately for each temperature). Do the ANOVA conditions appear to be met? The two outliers make both the equal-variance and normality conditions very questionable. Hence, we shouldn’t use the ANOVA analysis.

 

The Kruskal-Wallis test is a non-parametric analog to one-way ANOVA (although it tests different hypotheses). The Kruskal-Wallis test ranks all the responses from all groups together and then applies one-way ANOVA to the ranks rather than to the original observations. The null hypothesis is that the reaction times have the same distribution in all groups (versus the reaction times are systematically higher in some groups than in others). Additionally, if all the population distributions of reaction times follow the same shape (not necessarily normal), then the null hypothesis is that the median reactions times are all the same.

 

To perform the Kruskal-Wallis test, select Nonparametrics>Kruskal-Wallis from the Stat menu. Select Reaction Time as the response and Temperature as the factor. The small p-value indicates that the distribution of reaction times are systematically higher in some groups than in others.

 

Just for kicks, also perform the one-way ANOVA analysis (Stat>ANOVA>One-Way). Notice that the ANOVA analysis does not show a significance difference between groups—most likely because the test is on averages (and requires conditions), which are heavily impacted by outliers.

 

Bottom Line

Suppose you have a one- or two-sample (or ANOVA) problem where you want to do inference on the mean(s). If the normality assumption seems to be met, then use the t-test (when the normality assumption is met, the corresponding nonparametric test is much less powerful than the t-test). If the normality assumption is not met, then perform both the t-test and the corresponding nonparametric test. If the results agree, then you can feel better about using the t-test (and you can report the t-test results, as laypeople will be much more familiar with t-tests than nonparametric tests). If the results do not agree, then it’s probably best to stick with the nonparametric test results.