|The TTEST Procedure|
|One-Sample t Test|
A one-sample 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 more than 80 days by using 20 randomly chosen cases. The data are read by the following DATA step:
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 statements invoke PROC TTEST for a one-sample test:
ods graphics on; proc ttest h0=80 plots(showh0) sides=u alpha=0.1; var time; run; ods graphics off;
The ODS GRAPHICS statement requests graphical output. 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 null value 80 rather than the default of 0. The PLOTS(SHOWH0) option requests that this null value be displayed on all relevant graphs. The SIDES=U option reflects the focus of the research question, namely whether the mean court case length is greater than 80 days, rather than different than 80 days (in which case you would use the default SIDES=2 option). The ALPHA=0.1 option requests 90% confidence intervals rather than the default 95% confidence intervals. The output is displayed in Figure 93.1.
Summary statistics appear at the top of the output. The sample size (N), mean, standard deviation, and standard error are displayed with the minimum and maximum values of the time variable. The 90% confidence limits for the mean and standard deviation are shown next. Due to the SIDES=U option, the interval for the mean is an upper one-sided interval with a finite lower bound (84.1659 days). The limits for the standard deviation are the equal-tailed variety, per the default CI=EQUAL option in the PROC TTEST statement. At the bottom of the output are the degrees of freedom, statistic value, and -value for the test. At the 10% level, this test indicates that the mean length of the court cases is significantly greater than from 80 days .
The summary panel in Figure 93.2 shows a histogram with overlaid normal and kernel densities, a box plot, the 90% confidence interval for the mean, and the null value of 80 days.
The confidence interval excludes the null value, consistent with the rejection of the null hypothesis at .
The Q-Q plot in Figure 93.3 assesses the normality assumption.
The curvilinear shape of the Q-Q plot suggests a possible slight deviation from normality. You could use the UNIVARIATE procedure with the NORMAL option to numerically check the normality assumptions.
Copyright © SAS Institute, Inc. All Rights Reserved.