T Tests Task: One-Sample t Test

About the One-Sample t Test Task

A one-sample t test compares the mean of the sample to the null hypothesis mean.
To compare an individual mean with a sample size of n to a value m, use t equals . fraction x with macron above , negative m , over fraction s , over square root of n end fraction end fraction. Click image for alternative formats. where x with macron above. Click image for alternative formats. is the sample mean of the observations and s2 is the sample variance of the observations.
For example, you want to perform a one-sample t test on the horsepower values in the Sashelp.Cars data set. The null hypothesis is 300.
To run a one-sample t test, open the T Tests task. From the T test drop-down list, select One-sample test.
Note: You must have SAS/STAT to use this task.

Example: One-Sample t Test for Horsepower

To create this example:
  1. In the Tasks section, expand the Statistics folder and double-click T Tests. The user interface for the T Tests task opens.
  2. On the Data tab, select the SASHELP.CARS data set.
  3. From the T test drop-down list, select One-sample test.
  4. To the Analysis variable role, assign the Horsepower column.
  5. On the Options tab, enter 300 in the Alternative hypothesis field.
  6. To run the task, click Submit SAS Code.
Here is a subset of the results:
Tabular Results for One-Sample t Test
Distribution of Horsepower

Assigning Data to Roles

To run a one-sample t test, select One-sample test from the T test drop-down list. Assign a numeric column to the Analysis variable role.

Setting Options

Option Name
Description
Tests
Tails
specifies the number of sides (or tails) and direction of the statistical tests and test-based confidence intervals. You can choose from these options:
  • Two-tailed test specifies two-sided tests and confidence intervals for means.
  • Upper one-tailed test specifies upper one-sided tests in which the alternative hypothesis indicates a mean greater than the null value, and upper one-sided confidence intervals between the lower confidence limit and infinity.
  • Lower one-tailed test specifies lower one-sided tests in which the alternative hypothesis indicates a mean less than the null value, and lower one-sided confidence intervals between minus infinity and the upper confidence limit.
Alternative hypothesis
specifies the value of the null hypothesis. By default, the null hypothesis has a value of 0.
Normality Assumption
Tests for normality
runs tests for normality that include a series of goodness-of-fit tests based on the empirical distribution function. The table provides test statistics and p-values for the Shapiro-Wilk test (provided the sample size is less than or equal to 2000), the Kolmogorov-Smirnov test, the Anderson-Darling test, and the Cramér-von Mises test.
Nonparametric Tests
Note: This option is available only for a two-tailed test.
Sign test and Wilcoxon signed rank test
generates the results from these tests:
  • The sign test statistic is m equals open , n to the plus , minus , n to the minus , close slash 2. Click image for alternative formats. , where n+ is the number of values that are greater than mu sub 0. Click image for alternative formats., and n- is the number of values that are less than mu sub 0. Click image for alternative formats.. Values equal to mu sub 0. Click image for alternative formats. are discarded.
  • The Wilcoxon signed rank statistic S is calculated as s equals . sum , from , i colon vertical line , x sub i , minus , mu sub 0 , vertical line greater than 0 , to , white square , of . r with subscript i , and with superscript plus , end sub-superscript , minus . fraction n sub t , open , n sub t , plus 1 close , over 4 end fraction. Click image for alternative formats. , where r+i is the rank of x sub i , minus , mu sub 0. Click image for alternative formats. after discarding values of x sub i , minus , mu sub 0. Click image for alternative formats. , and nt is the number of xi values not equal to mu sub 0. Click image for alternative formats.. Average ranks are used for tied values.
Plots
Histogram and box plot
creates a histogram and box plot together in a single panel, sharing common X axes.
Normality plot
creates a normal quantile-quantile (Q-Q) plot.
Confidence interval plot
creates a plot of the confidence interval for the means.