Lesson 28: T-tests and Nonparametric Comparisons

Lesson 28: T-tests and Nonparametric Comparisons

Overview

In this lesson, we learn how to use the TTEST procedure for comparing the population means of two groups when there is reason to believe that the sampling distribution of the means is at least approximately normally distributed. In the cases in which we wouldn't be able to sleep at night making that assumption, we learn how to use the NPAR1WAY procedure for comparing the medians of the two groups. We also learn how to use SAS to randomly assign our experimental units (often, which are people!) to one of two treatment groups.

Objectives

Upon completion of this lesson, you should be able to:

  • use the TTEST procedure to conduct a two-sample t-test
  • know how a data set must be structured in order to use the TTEST procedure to conduct a two-sample t-test
  • use the TTEST procedure to conduct a paired t-test
  • know how a data set must be structured in order to use the TTEST procedure to conduct a paired t-test
  • read the basic output that arises from invoking the TTEST procedure
  • use the NPAR1WAY procedure to conduct a Wilcoxon rank-sum test
  • read the basic output that arises from invoking the NPAR1WAY procedure
  • use the RANUNI function to randomly assign our experimental units (often, which are people!) to one of two treatment groups

Textbook Reference

 Chapter 6 of the textbook.


28.1 - Lesson Notes

28.1 - Lesson Notes

B. T-test and Testing Differences Between Two Means

Page 183. Often, you'll see the null and alternative hypotheses stated simply as:

  • Null: The means of the two populations are the same.
  • Alternative: The means of the two populations differ ...or the mean of population A is greater than the mean of population B ...or the mean of population A is less than the mean of population B

Page 185. Pay particular attention to the structure of the input data set. You can not use the TTEST procedure to analyze a "fat" data set containing two columns as appears on page 184 (unless, as we'll see later in Section F, you are conducting a paired t-test). Instead, you have to enter the data as a "tall" data set, in which one of the variables is a grouping (or "class") variable and the other variable is the response variable. This is just one example of why we spent time in Stat 480 and Stat 481 learning how to transpose fat data sets to tall data sets and tall data sets to fat data sets.

C. Random Assignment of Subjects

We'll spend lots more time in Lesson #34 learning about random number generators and how they can help (1) randomly assign subjects to groups and (2) randomly select subjects from a larger population.

Page 187. In practice, researchers should supply their own seed to the RANUNI function so that the random assignment list can be created again. It is highly unlikely that a researcher could re-create his/her random assignment list using the computer clock. In the program on this page, a seed of 123 is used. If you run the program again with the same seed, you'll see that you'll get the same random assignment as the authors obtained on page 188.

Page 189. In the program on this page, a seed of 0 is used. Therefore, SAS uses the computer clock to start the random number generation. If you run the program again with the same seed, it is very unlikely that you'll get the same random assignment as the authors.

D. Two Independent Samples: Distribution-Free Tests

Page 191. Note that tie values are assigned an average rank. For example, the first two mass values are both 0.0, so they share the average of rank 1 and 2, which is rank 1.5.

F. Paired T-tests (Related Samples)

Page 195. Again, pay particular attention to the structure of the input data set. To use the TTEST procedure to conduct a paired t-test, you have to enter the data as a "fat" data set containing two columns, not a "tall" data set containing a class variable and a response variable.


28.2 - Summary

28.2 - Summary

In this lesson, we learned how to use the TTEST and NPAR1WAY procedures for comparing two groups. We also learned how to use SAS to randomly assign our experimental units to one of two treatment groups.

The homework for this lesson will give you more practice with these methods.


Legend
[1]Link
Has Tooltip/Popover
 Toggleable Visibility