One-sample t-tests in Excel

advertisement
One-sample t-tests
Suppose You obtain a sample of 9 cars to test a car manufacturer’s claim that one of its models
averages 30 miles per gallon. Here are the data from the 9 cars of this model:
31, 27, 30, 28, 31, 32, 27, 29, 29
What is H0?
H0 :  =
What is Ha?
Ha : 
Calculate the sample size, mean and sample stdev and the t statistic.
n=
t=
X –
=
s/(sqrt(n)
x-bar =
s=
=
To make a decision about the null hypothesis, you need a critical t value. You can use Table E.6 to
find this, or You can be good enough to let Excel find it for You. Use the “TINV” function: =TINV
(alpha, df).
In this case, if we’re looking at an alpha of 5% with 8 dfs, we’d type in =TINV(.05, 8) and Excel
would provide us with the t* to which we will compare our t. Keep in mind that Excel uses a twotailed test, so if we want to use a one-tailed test, the alpha would have to be adjusted (by… doubling
it, right).
Excel can also give You the exact probability associated with the sample t value. The “TDIST”
function does this: TDIST (|ourT|, dfs, tails) so in this case =TDIST(1.1094, 8, 2). (The value of ourT
has to be positive, but that’s not a problem since the t-distribution is symmetrical, and positive and
negative t-values are equidistant from the mean. Right?)
So what’s the probability of getting a sample mean like ours, if the null hypothesis is true?
P(t(8)=1.1094)=
So how would You interpret this finding?
One-sample t-tests in SPSS
Open SPSS by clicking the SPSS icon in the dock. When it asks You what to open, point it toward the
fruitfly.sav file in the Datasets folder in the S1610q folder on the desktop.
This file contains data from a study published in Nature in 1981. Here is a description of the dataset:
A cost of increased reproduction in terms of reduced longevity has been shown for female
fruitflies, but not for males. The flies used were an outbred stock. Sexual activity was manipulated
by supplying individual males with one or eight receptive virgin females per day. The longevity
of these males was compared with that of two control types. The first control consisted of two sets
of individual males kept with one or eight newly inseminated females. Newly inseminated
females will not usually remate for at least two days, and thus served as a control for any effect of
competition with the male for food or space. The second control was a set of individual males
kept with no female. There were 25 males in each of the five groups, which were treated
identically in number of anaesthetizations (using CO2) and provision of fresh food medium.
Here is a description of the variables in your datafile:
ID:
serial no. (1-25) within each group of fruit flies (4 groups)
Partner:
number of companions (1 or 8)
Type:
type of companion (0: newly pregnant female; 1: virgin female)
Lifespan:
lifespan in days
Thorax:
length of thorax, in nm
Sleep:
percentage of each day spent sleeping
ONE SAMPLE STATISTICS
Let’s look at lifespan first. Do sexually active fruit flies live longer than fruit flies that are not
sexually active? Use the “GRAPHS” menu to make a histogram of the lifespan. Does it look
normally distributed?
Now let’s look at the sample statistics. Go to ANALYZE -> DESCRIPTIVE STATISTICS ->
DESCRIPTIVES and put in the lifespan variable. Get the mean and standard deviation.
Our data only includes information about fruit flies that have at least one partner. Thus, the mean and
standard deviation found in the previous step is for fruit flies with at least one partner. Do we think
this mean is significantly less than 63.5 (the lifespan in days of fruit flies that are not sexually active)?
Go to ANALYZE -> COMPARE MEANS -> ONE SAMPLE T TEST. Put in 63.5 for the test value
and see what the test shows you.
Download