One-sample tests are not used too often, but are useful to compare a set of values to a given default value. For example, one might ask if a set of student scores are significantly different from a “default” or “neutral” score of 75.

##### Appropriate data

• One-sample data

• Data are interval/ratio, and are continuous

• Data are normally distributed

• Moderate skewness is permissible if the data distribution is unimodal without outliers

##### Hypotheses

• Null hypothesis: The mean is equal to the default value.

• Alternative hypothesis (two-sided): The mean is not equal to the default value.

##### Interpretation

Reporting significant results as, e.g., “Mean score for Variable A was significantly different from a default value of 75” is acceptable.

##### Other notes and alternative tests

• The nonparametric analogue for this test is the one-sample Wilcoxon signed-rank test.

• Power analysis for the one-sample *t*-test can be found
at Mangiafico (2015)
in the References section.

### Packages used in this chapter

The packages used in this chapter include:

• psych

• rcompanion

The following commands will install these packages if they are not already installed:

if(!require(psych)){install.packages("psych")}

if(!require(rcompanion)){install.packages("rcompanion")}

### One-sample *t*-test example

In the following example, Brendon Small has his SNAP-Ed students keep diaries of what they eat for a week, and then calculate the daily sodium intake in milligrams. As a first step in the analysis, he wants to compare mean sodium intake by his students to the American Heart Association recommendation of 1500 mg.

A one-sample *t*-test can be conducted with the *t.test*
function in the native *stats* package. Conveniently the output includes
the mean of the sample, a confidence interval for that mean, and a *p*-value
for the *t*-test.

We will use a histogram with an imposed normal curve to confirm data are approximately normal.

Input = ("

Instructor Student Sodium

'Brendon Small' a 1200

'Brendon Small' b 1400

'Brendon Small' c 1350

'Brendon Small' d 950

'Brendon Small' e 1400

'Brendon Small' f 1150

'Brendon Small' g 1300

'Brendon Small' h 1325

'Brendon Small' i 1425

'Brendon Small' j 1500

'Brendon Small' k 1250

'Brendon Small' l 1150

'Brendon Small' m 950

'Brendon Small' n 1150

'Brendon Small' o 1600

'Brendon Small' p 1300

'Brendon Small' q 1050

'Brendon Small' r 1300

'Brendon Small' s 1700

'Brendon Small' t 1300

")

Data = read.table(textConnection(Input),header=TRUE)

### Check the data frame

library(psych)

headTail(Data)

str(Data)

summary(Data)

### Remove unnecessary objects

rm(Input)

#### Histogram of data

x = Data$Sodium

library(rcompanion)

plotNormalHistogram(x)

#### Normal quantile plot of data

x = Data$Sodium

qqnorm(x)

qqline(x, col="red")

#### One-sample t-test

t.test(Data$Sodium,

mu = 1500,

conf.int = 0.95)

One Sample t-test

t = -4.9053, df = 19, p-value = 9.825e-05

alternative hypothesis: true mean is not equal to 1500

95 percent confidence interval:

1196.83 1378.17

sample estimates:

mean of x

1287.5

### Reference’s

* *

** “Student’s t–test for One Sample”** in
Mangiafico, S.S. 2015.

*An R Companion for the Handbook of Biological Statistics*, version 1.09. rcompanion.org/rcompanion/d_01.html.

### Exercises O

1. Considering Brendon Small’s data,

a. What was the mean sodium intake?

b. What is the 95% confidence interval for sodium intake?

c. Is the data distribution reasonably normal?

d. Was the mean sodium intake significantly different from the American Heart Association recommendation or 1500 mg per day?

e. What do you conclude practically?

2. As part of a professional skills program, a 4-H club tests its members for
typing proficiency. Dr. Katz wants to test his students’ mean typing speed
against a nominal speed of 40 words per minute.

Instructor Student Words.per.minute

'Dr. Katz Professional Therapist' a 35

'Dr. Katz Professional Therapist' b 50

'Dr. Katz Professional Therapist' c 55

'Dr. Katz Professional Therapist' d 60

'Dr. Katz Professional Therapist' e 65

'Dr. Katz Professional Therapist' f 60

'Dr. Katz Professional Therapist' g 70

'Dr. Katz Professional Therapist' h 55

'Dr. Katz Professional Therapist' i 45

'Dr. Katz Professional Therapist' j 55

'Dr. Katz Professional Therapist' k 60

'Dr. Katz Professional Therapist' l 45

'Dr. Katz Professional Therapist' m 65

'Dr. Katz Professional Therapist' n 55

'Dr. Katz Professional Therapist' o 50

'Dr. Katz Professional Therapist' p 60

For each of the following, answer the question, and ** show
the output from the analyses you used to answer the question**.

a. What was the mean typing speed?

b. What is the 95% confidence interval for typing speed?

c. Is the data distribution reasonably normal?

d. Was the mean typing speed significantly different from the nominal rate of 40 words per minute?

e. What do you conclude practically?