Software to Simplify Statistical Practice ...

One-sample t Test - Example



This data set was collected by Bob Zarr of NIST in January, 1990 from a heat flow meter calibration and stability analysis. The response variable is a calibration factor. The motivation for studying this data set is to illustrate a well-behaved process where the underlying assumptions hold and the process is in statistical control.





  1. Open the DataBook compare.vstz
    open this data file via the Help / Open Examples menu; it is in the Sample Data
  2. Select the sheet zarr13
  3. Choose the menu Analyze and the command One t-Test
  4. In Variables, select Calib.
  5. In Hypothesized mean, enter 5.
  6. Click OK




By default, R code is printed after parsing and before evaluation.
You can avoid this in File / Option / Advanced menu.

DataSheet is converted to DataFrame, in the form DataBook.DataSheet

> ## Summary Statistics:
> summary.vst(zarr13.Sheet1[,c('Calib')], statistics = c('mean','semean','sd','nobs'))
 nobs     mean        sd     semean
  195 9.261461 0.0227888 0.00163194

> ## Perform one sample t-test:
> t.test(zarr13.Sheet1$Calib, alternative = 'two.sided', mu = 5, conf.level = 0.95)

	One Sample t-test

data:  zarr13.Sheet1$Calib
t = 2611.286, df = 194, p-value < 2.2e-16
alternative hypothesis: true mean is not equal to 5
95 percent confidence interval:
 9.258242 9.264679
sample estimates:
mean of x 

> ## Find two-tailed critical values:
> qt(0.975,194)
[1] 1.972268




We are testing the null hypothesis that the population mean is 5. The alternative hypothesis is that the population mean is not equal to 5. The test statistic t is calculated as 2611.286

We reject the null hypotheses for our two-tailed t-test because the absolute value of the test statistic is greater than the critical value.

The confidence interval provides an alternative to the hypothesis test. If the confidence interval contains 5, then null hypotheses cannot be rejected. In our example, the confidence interval (9.258242, 9.264679) does not contain 5, indicating that the population mean does not equal 5 at the 0.05 level of significance.