You are on page 1of 7

Lab 5 – Hypothesis Testing Using One Sample T-Test

Suppose that a car manufacturer claims that its typical car gets 22 miles per gallon. You want to
determine whether this claim is true or not. First you randomly sample 20 cars, check their
mileage, and get the observations stored in “lab5.sav” under the variable car. First, let’s look at
the data.

- Go to SPSS and retrieve (open) the file “lab5.sav”.


- Click on “Analyze”, select “Descriptive Statistics”, and click on “Descriptives”.
- Select the variable “Mileage per gallon [car]”, move it into the “Variable(s)” field
and then click on the “Options” button.
- Unselect “Minimum” and “Maximum” options by clicking on the checked box in
front of them and then select the “S. E. mean” option (Standard Error of the Mean).
- Click on the “Continue” and then “OK” button.

Table 1 shows the output.

Table 1

So, the observed mean is 22.35. This is higher than the claimed mean. But is this difference due
to a sampling variability or is it a real difference?

I. Formulating the Hypotheses (Null H0 & Alternative H1)

What are these hypotheses? The null hypothesis or H0 is the statement that claims a specific
value for the statistic of interest (in this case the mean = 22 miles per gallon). Generally, this is
the statement that we are hoping to reject. The alternative hypothesis or H1 is the statement that
expresses a compliment of the null hypothesis. In this case, the alternative hypothesis would state
that the mean mileage is not 22 miles per gallon. So our problem is an example of a two-tailed
hypothesis test. (If our alternative hypothesis claimed that the mean mileage is less than 22 miles
per gallon, or greater than 22 miles per gallon, we would have a one-tailed hypothesis test.
Notice that whether or not the hypothesis is judged as two- or one-tailed depends on the
alternative hypothesis.)

II. Selecting a Significance Level, or a

Usually, we select a = .05. But other values are possible, such as a = .01. For this lab, we are
going to use a = .05.

1
III. Setting the Decision Stage

Choosing a Statistical Test

To test a hypothesis about the sample mean, there are two tests available, the z-test and the one
sample t-test. Both tests have the same form:

where μ is the mean given by the null hypothesis, σx-bar the true standard error of the distribution
of the means, and SDx-bar the estimated standard error. You should note that the only difference
between z and t tests is knowledge of the population standard deviation. Thus, if you know the
population standard deviation and can compute the true standard error, you would use the z-test.
Otherwise, you use the t-test. (The reason is that for small sample sizes, estimation of the
standard error introduces extra variability. The t-distribution is more spread out. As the sample
size increases, the variability introduced by the estimation of the standard error decreases.
Eventually, both distributions, z and t look alike, as sample size becomes very large.)

In real life, we often do not know the population standard deviation and the true standard error.
Neither do we know the true standard error in our example. Thus we are going to use the t-test.

Finding a Critical Value or Values

Figure 1, on the next page, represents the sampling distribution of the t-statistic with df = 19.
The solid vertical line represents the observed t-statistic for our example problem (transformed
observed mean). The dotted vertical lines represent the LB and UB, or as your book calls them
critical values. These were obtained from Table C.2, in Privitera. Specifically, for 19 degrees of
freedom, df = n – 1, LB = -2.093 and UB = 2.093.

2
Figure 1

LB t - observed UB

III. Locating Rejection Region & Formulating the Decision Rules

As you already know, the critical values could be thought of as LB and UB. Then, if the null
hypothesis is true, 1-a or in our case 95% of all samples that could be drawn from the population
will produce t-values that lie within these critical values or boundaries. This means that if we
take one sample from the population described by the null hypothesis, we would expect that the
t-value obtained will fall within the critical values. (Remember the confidence intervals in the
previous lab?) If the observed t-value falls outside the boundaries, to the left of the LB or to the
right of the UB, we conclude that this is not very likely to happen under the assumption that the
null hypothesis is true. Therefore, we would “Reject H0” if the t-observed fell outside the critical
values. Also, we would “Fail to reject H0” if the t-observed fell in between the critical values.

IV. Calculating the Observed Statistic

- Click on “Analyze”, select “Compare Means”, and click on “One-Sample T Test.”


- Select variable “Mileage per gallon [car]”, move it into the “Test Variable(s)” field.
- In the field “Test Value”, type 22 (this is your null mean).
- Click on the “Options” button.
- Since we choose alpha = .05, we leave the value of 95 in the field “Confidence
Interval Percentage”.
- Click on the “Continue” button and then “OK” button.

Table 2 shows the SPSS output. The first part of the output provides the descriptive statistics, the
sample mean = 22.35, the standard deviation = 2.257, and the standard error of the mean = .505.
The lower part of the output provides the outcome of the t-test. The mean difference column tells
us how much the sample mean differed from the null mean (22 miles per gallon). In this case,
our sample mean was .35 miles per gallon larger than the null hypothesized mean. The output
also provides the 95% CI on the difference , where LB = -.706 and UB = 1.406. (Under
the null hypothesis, D = 0) We also get the t-value = .69, df = 19, and 2-tail significance = .496.
You can see Table 2 in your output window.

3
Table 2

One-Sample Statistics

N Mean Std. Deviation Std. Error Mean

Mileage per gallon 20 22.3500 2.25727 .50474

One-Sample Test

Test Value = 22

95% Confidence Interval of


Mean the Difference
t df Sig. (2-tailed)
Difference
Lower Upper

Mileage per gallon .693 19 .496 .3500 -.7064 1.4064

The 95% CI shown above is similar to, but different from the Confidence Intervals presented in
lecture. The CI in Table 2 is based on the difference between the population mean (expressed in
H0) and the observed sample mean ( ). If Ho is true, then the most frequently observed (or the
expected value) of the difference should be zero. The CI given on this difference for the t-
statistic provides convergent information as to whether or not the observed value of t falls
outside of the critical values you would find in your text. If the lower and upper bounds for the
CI on the difference includes zero (as the one above does) then the observed value of t does not
fall outside of the critical values for the test. Similarly, you should note that the 2-tail sig. level
listed above does not meet the .05 convention for rejecting H0 (.496 is far too likely a value for
the observed t, to be inconsistent with H0).

V. Making a Decision

See Figure 1. Since the t-observed fell within the critical values, we conclude that there is not
enough evidence to reject the null hypothesis. (So we fail to reject H0). What does that mean?
Well, what we have concluded is that the average mileage does not differ from that publicized by
the manufacturer. You should note that the critical values of t shown in Figure 1 came from
Table C.2 in Privitera. SPSS does not print these values, although it does use the conceptual
equivalent of critical values in the computation of the significance level that is listed in Table 2
(2-tail sig). For example, if our observed t value had been equal to 2.093, the 2-tail sig level
would have been .05. Actually, SPSS computes the precise probability of the observed value of t.
If this probability is equal to or less than the alpha level we chose for our test, then we would
reject H0, if it larger we would fail to reject H0.

You should also note that SPSS treats all t-tests as though they were two-tailed, in that the
significance level assumes you will reject H0 if the value of t observed falls in either tail of the
sampling distribution. What do you do if you want to conduct a one-tailed test? There are two

4
approaches you could use: (1) You can consult Table C.2 of your text for the one-tailed critical
values, to see if the observed t falls beyond that value. (2) You can divide the 2-tailed sig level
shown in the output by two. This gives you the probability of the observed value of t for a one-
tailed test. Thus, a 2-tailed sig level of .10, is equivalent to a 1-tailed sig level of .05, which
would allow you to reject a null hypothesis for a one-tailed test.

Type I & Type II Error

Type I error results when the null hypothesis is true and we reject it (the chance of this
happening is a, the significance level). Type II error results when we fail to reject the null
hypothesis and in fact this null hypothesis is false. Often, the chance of this happening is
unknown.

In our case, we have failed to reject the null hypothesis. So, the only error we could be making is
a type II error. There is an unknown possibility that the null hypothesis is wrong.

Assignment:
1. A medical researcher attempted to learn if a poorly understood disease is accompanied by an
increase in body temperature. She measured the body temperature of 12 people diagnosed as
having the disease and obtained the following temperatures (in F): 99.3, 99.1, 100.4, 98.4,
98.2, 98.9, 99.7, 100.1, 100.7, 99.0, 98.8, and 99.2. Use SPSS and follow the procedure
outlined in the lab 5 format document. Note that you will have to create a new data window
to enter the body temperature variable. The actual procedures for the analysis are virtually
identical to the steps followed in the Lab example, above.
NORMAL BODY TEMP: 98.6 (two-tailed)

5
a. Does the mean body temperature of these individuals differ from a population mean of
98.6 F ? Use a two-tailed test and a .05 significance level.
Ho=98.6
H1 (not equal to) 98.6

Using 0.05 as a critical value, we conducted a t test

Critical value is 2.201 with a lower limit of -2.201


if the value is less than -2.201 or greater than 2.201 we reject the null

Our t value is 3.221, greater than our critical value of 2.201, so we reject the null

b. Could your decision regarding the statistical hypothesis represent a Type II error ?
Explained the answer.

A Type II error results when we fail to reject the null and in fact the null is false. In this case,
we reject the null, so this could be an instance of a Type I, not a Type II error.

2. Mothers with young children often complain that they do not get enough sleep. Suppose that
you obtained a measure of the typical amount of sleep of nine mothers of children under one
year of age and found the following durations of sleep (in hours): 6.4, 7.5, 6.9, 7.3, 7.6, 7.1,
6.5, 7.7, and 7.8. Use SPSS and follow the procedure outlined in the lab 5 format document.
Note that you will have to create a new data window to enter the body temperature variable.
The actual procedures for the analysis are virtually identical to the steps followed in the Lab
example, above.
DOES THIS DIFFER FROM POP. MESN OF 7.7 (two-tailed)

6
a. Does the mean amount of sleep of these mothers differ significantly from a population
mean of 7.7 hours of sleep per night ? Use a two tailed test and a .05 significance level.
Ho: M = 7.7
H1: (M not equal to) 7.7

Critical value of 0.05, critical limit of +/-2.306

If our t value is less than -2.306 or greater than 2.306, we reject the null, otherwise we fail to
reject it.

Our t value is -2.928 which is less than our critical value of -2.306, therefore we reject the
null hypothesis.

b. Could your decision about the statistical hypothesis represent the occurrence of a Type I
error ?
Since we reject the null, this could be an instance of a Type I error.

c. Could your decision about the statistical hypotheses represent the occurrence of a Type II
error ?
A Type II error only occurs when we fail to reject the null and it is in fact false, in this case
we reject the null so it could not be a Type II error.

d. Compute the 95 confidence interval for the population mean of these scores. Is the
population mean of 7.7 hours per night included in this interval ?
Since 0 does not fall within the bounds of
the 95% confidence interval, we’re 95%
confident our sample is not representative
of the population.

What to turn in:


For each problem, list clearly all 5 steps (this includes the discussion of what error you could
have made) including the SPSS t test output in a word document, just as was done in the
sample problem.

You might also like