Chapter Contents
Chapter Contents
Previous
Previous
Next
Next
The TTEST Procedure

One-Sample t Test

A one-sample t test can be used to compare a sample mean to a given value. This example, taken from Huntsberger and Billingsley (1989, p. 290), tests whether the mean length of a certain type of court case is 80 days using 20 randomly chosen cases. The data are read by the following DATA step:

   title 'One-Sample t Test';
   data time;
      input time @@;
      datalines;
    43  90  84  87  116   95  86   99   93  92
   121  71  66  98   79  102  60  112  105  98
   ;
   run;

The only variable in the data set, time, is assumed to be normally distributed. The trailing at signs (@@) indicate that there is more than one observation on a line. The following code invokes PROC TTEST for a one-sample t test:

   proc ttest h0=80 alpha=0.1;
      var time;
   run;

The VAR statement indicates that the time variable is being studied, while the H0= option specifies that the mean of the time variable should be compared to the value 80 rather than the default null hypothesis of 0. This ALPHA= option requests 10% confidence intervals rather than the default 5% confidence intervals. The output is displayed in Figure 67.1.

One-Sample t Test

The TTEST Procedure

Statistics
Variable N Lower CL
Mean
Mean Upper CL
Mean
Lower CL
Std Dev
Std Dev Upper CL
Std Dev
Std Err Minimum Maximum
time 20 82.447 89.85 97.253 15.2 19.146 26.237 4.2811 43 121

T-Tests
Variable DF t Value Pr > |t|
time 19 2.30 0.0329

Figure 67.1: One-Sample t Test Results

Summary statistics appear at the top of the output. The sample size (N), the mean and its confidence bounds (Lower CL Mean and Upper CL Mean), the standard deviation and its confidence bounds (Lower CL Std Dev and Upper CL Std Dev), and the standard error are displayed with the minimum and maximum values of the time variable. The test statistic, the degrees of freedom, and the p-value for the t test are displayed next; at the 10% \alpha-level, this test indicates that the mean length of the court cases are significantly different from 80 days (t=2.30, p=0.0329).

Chapter Contents
Chapter Contents
Previous
Previous
Next
Next
Top
Top

Copyright © 1999 by SAS Institute Inc., Cary, NC, USA. All rights reserved.