Our tutorials reference a dataset called "sample" in many examples. If you'd like to download the sample dataset to work through the examples, choose one of the files below:
The One Sample t Test determines whether the sample mean is statistically different from a known or hypothesized population mean. The One Sample t Test is a parametric test.
This test is also known as:
The variable used in this test is known as:
In a One Sample t Test, the test variable is compared against a "test value", which is a known or hypothesized value of the mean in the population.
The One Sample t Test is commonly used to test the following:
Note: The One Sample t Test can only compare a single sample mean to a specified constant. It can not compare sample means between two or more groups. If you wish to compare the means of multiple groups to each other, you will likely want to run an Independent Samples t Test (to compare the means of two groups) or a One-Way ANOVA (to compare the means of two or more groups).
Your data must meet the following requirements:
The null hypothesis (H_{0}) and (two-tailed) alternative hypothesis (H_{1}) of the one sample T test can be expressed as:
H_{0}: µ = x ("the sample mean is equal to the [proposed] population mean")
H_{1}: µ ≠ x ("the sample mean is not equal to the [proposed] population mean")
where µ is a constant proposed for the population mean and x is the sample mean.
The test statistic for a One Sample t Test is denoted t, which is calculated using the following formula:
$$ t = \frac{\overline{x}-\mu{}}{s_{\overline{x}}} $$
where
$$ s_{\overline{x}} = \frac{s}{\sqrt{n}} $$
where
\(\mu\) = Proposed constant for the population mean
\(\bar{x}\) = Sample mean
\(n\) = Sample size (i.e., number of observations)
\(s\) = Sample standard deviation
\(s_{\bar{x}}\) = Estimated standard error of the mean (s/sqrt(n))
The calculated t value is then compared to the critical t value from the t distribution table with degrees of freedom df = n - 1 and chosen confidence level. If the calculated t value > critical t value, then we reject the null hypothesis.
Your data should include one continuous, numeric variable (represented in a column) that will be used in the analysis. The variable's measurement level should be defined as Scale in the Variable View window.
To run a One Sample t Test in SPSS, click Analyze > Compare Means > One-Sample T Test.
The One-Sample T Test window opens where you will specify the variables to be used in the analysis. All of the variables in your dataset appear in the list on the left side. Move variables to the Test Variable(s) area by selecting them in the list and clicking the arrow button.
A Test Variable(s): The variable whose mean will be compared to the hypothesized population mean (i.e., Test Value). You may run multiple One Sample t Tests simultaneously by selecting more than one test variable. Each variable will be compared to the same Test Value.
B Test Value: The hypothesized population mean against which your test variable(s) will be compared.
C Options: Clicking Options will open a window where you can specify the Confidence Interval Percentage and how the analysis will address Missing Values (i.e., Exclude cases analysis by analysis or Exclude cases listwise). Click Continue when you are finished making specifications.
Click OK to run the One Sample t Test.
According to the CDC, the mean height of adults ages 20 and older is about 66.5 inches (69.3 inches for males, 63.8 inches for females). Let's test if the mean height of our sample data is significantly different than 66.5 inches using a one-sample t test. The null and alternative hypotheses of this test will be:
H_{0}: 66.5 = µ_{Height} ("the mean height of the sample is equal to 66.5")
H_{1}: 66.5 ≠ µ_{Height} ("the mean height of the sample is not equal to 66.5")
where 66.5 is the CDC's estimate of average height for adults, and x_{Height} is the mean height of the sample.
In the sample data, we will use the variable Height, which a continuous variable representing each respondent’s height in inches. The heights exhibit a range of values from 55.00 to 88.41 (Analyze > Descriptive Statistics > Descriptives).
Let's create a histogram of the data to get an idea of the distribution, and to see if our hypothesized mean is near our sample mean. Click Graphs > Legacy Dialogs > Histogram. Move variable Height to the Variable box, then click OK.
To add vertical reference lines at the mean (or another location), double-click on the plot to open the Chart Editor, then click Options > X Axis Reference Line. In the Properties window, you can enter a specific location on the x-axis for the vertical line, or you can choose to have the reference line at the mean or median of the sample data (using the sample data). Click Apply to make sure your new line is added to the chart. Here, we have added two reference lines: one at the sample mean (the solid black line), and the other at 66.5 (the dashed red line).
From the histogram, we can see that height is relatively symmetrically distributed about the mean, though there is a slightly longer right tail. The reference lines indicate that sample mean is slightly greater than the hypothesized mean, but not by a huge amount. It's possible that our test result could come back significant.
To run the One Sample t Test, click Analyze > Compare Means > One-Sample T Test. Move the variable Height to the Test Variable(s) area. In the Test Value field, enter 66.5, which is the CDC's estimation of the average height of adults over 20.
Click OK to run the One Sample t Test.
T-TEST
/TESTVAL=66.5
/MISSING=ANALYSIS
/VARIABLES=Height
/CRITERIA=CI(.95).
Two sections (boxes) appear in the output: One-Sample Statistics and One-Sample Test. The first section, One-Sample Statistics, provides basic information about the selected variable, Height, including the valid (nonmissing) sample size (n), mean, standard deviation, and standard error. In this example, the mean height of the sample is 68.03 inches, which is based on 408 nonmissing observations.
The second section, One-Sample Test, displays the results most relevant to the One Sample t Test.
A Test Value: The number we entered as the test value in the One-Sample T Test window.
B t Statistic: The test statistic of the one-sample t test, denoted t. In this example, t = 5.810. Note that t is calculated by dividing the mean difference (E) by the standard error mean (from the One-Sample Statistics box).
C df: The degrees of freedom for the test. For a one-sample t test, df = n - 1; so here, df = 408 - 1 = 407.
D Sig. (2-tailed): The two-tailed p-value corresponding to the test statistic.
E Mean Difference: The difference between the "observed" sample mean (from the One Sample Statistics box) and the "expected" mean (the specified test value (A)). The sign of the mean difference corresponds to the sign of the t value (B). The positive t value in this example indicates that the mean height of the sample is greater than the hypothesized value (66.5).
F Confidence Interval for the Difference: The confidence interval for the difference between the specified test value and the sample mean.
Since p < 0.001, we reject the null hypothesis that the sample mean is equal to the hypothesized population mean and conclude that the mean height of the sample is significantly different than the average height of the overall adult population.
Based on the results, we can state the following: