I am going to teach you about the one sample t-test doing the test by hand using formulas.
This will allow you to really see how the test works before we begin doing the one sample t-test with statistical software.
To make the calculations easier, however,
I'm going to use excel for the math. You can of course use any spreadsheet program to do these calculations.
So here is the example that we will be using:
We read a story in Martha Stewart Correctional Quarterly telling us that the
National average score for women on a test of indoor gardening is
73. So mu, the population mean, equals 73.
But there is no standard deviation.
We want to know how men will score on this same test.
We will assume that no gender differences exist.
So men should have a population mean of 73 just like the women.
We will compare the men's sample mean to the average score for the women.
We sampled a random selection of 9 men who produce a mean of 36.56.
So either we have about 8 points of sampling error
because there's approximately 8 points of difference between the two means or
the mean of men is significantly different than the mean of women (i.e. the mean of the population
of men does not equal 73).
We start with a null hypothesis that men in this sample were drawn from a population
with a mean of 73, so the men's mu equals 73
indicating no difference from the comparison population.
You should also remember that this is a simplified example for teaching, so I'm using a very small sample size of 9.
You should have sample sizes greater than 30 if you are doing a t-test for real research.
Well, let's work through the five steps of hypothesis testing.
Step number one:
Select the appropriate statistic and in this case we are comparing a single sample with a mean of
66.56 to a population with a mean of 73
where the standard deviation of the population is unknown, so we will be using the one sample t-test.
Step two: State the null and alternative hypothesis.
First decide if you are using a one-tailed, or directional test, or a
two-tailed non directional test.
If your research hypothesis has to do with the sample mean being
greater than the population mean or less than the population mean you are establishing a
direction and would use a one-tailed test.
Here we want to know if the mean for men is
different than the mean for women. No direction is given, so this is a non-directional
two-tailed test. We will need to plug in the population mean into our hypothesis.
So, in our case, the population mean is 73.
Our null hypothesis therefore H0: μ = 73
Meaning that we assume that the sample of men is drawn from a population that also has a mean of
73, just like the women.
Our alternative hypothesis is H1: μ ≠ 73.
Step three: select a level of significance.
For most research the level of significance will be alpha = 0.05
And technically you could set alpha equal to any value that you chose, but for scientific research you really have two choices
Alpha = .05 and alpha = .01, unless the problem says otherwise.
Assume that the value is alpha = .05
two-tailed test. The degrees of Freedom always equals n - 1.
Where n is the number of participants in your sample.
In this case with 9 men, our degrees of freedom are 8.
To find the critical value we go to Student's t Distribution table.
We are using a two-tailed test, so we will focus on the columns on the left.
The Alpha value is .05 with 8 degrees of freedom, so the critical value is +/- 2.306
Alternatively, you can download the RStats effect size calculator for t-tests and use it to determine your critical value.
So here you see six things that you can do with this effect size calculator spreadsheet.
If you click on the salmon-colored tab you will see a full t table of critical values for two-tailed tests
complete with a picture of William Sealy Gosset, our old friend Student.
So we could use this table, find our alpha level and degrees of freedom, and determine our critical value.
But there is something else that I want to show you.
Click on the green tab labeled critical values.
In the upper left we have the typical setup for alpha = .05, two-tailed test.
Simply enter your degrees of freedom,
click or hit return, and your critical value 2.306
appears here.
But wait, there's more.
If you are not doing a typical two-tailed alpha of .05 t-test
enter your degrees of freedom here.
Click and you'll get the critical values for both one and two tailed tests at a variety of alpha levels.
And I will tell you more about this green box in a moment.
So any t values exceeding +/- 2.306
indicate that the sample of men is
statistically significantly different than the population value for women.
Step four:
Calculate the statistics.
So here are the formulas that we will be using to calculate the t-test.
The first is the formula for standard deviation of the sample with N - 1 in the denominator.
When we estimate the population standard deviation from the sample standard deviation we use
N - 1 correction in the formula.
Once we calculate the standard deviation,
next we divide the standard deviation of the sample by the square root of the sample size to get the
estimated standard error of the mean.
And finally to conduct the t-test we divide the mean difference, the sample mean minus the population mean,
by the estimated standard error of the mean to get the t value.
Compare your t value to the critical value to see if it exceeds the critical value or not.
We are going to continue this example in excel., but first let me show you what we are going to do.
On the first excel spreadsheet we are going to create a column titled men and enter the data that you see here.
Then we will create a second column titled X2 for the x-squared
values and square each of the x values in the first column.
And finally we will add up the columns.
Then we're going to do one more thing.
We will copy just the x values to a second excel spreadsheet so that we can import them into
SPSS later and do this same t-test in SPSS
Let's shift to excel to continue this example.
To conduct the one-sample t-test. We need to enter our data.
Excel will make doing the math much easier. So open a blank data set in excel.
As we enter these data you will notice that this is a very small data set of 9.
I keep the data set small for the sake of learning the test. In the real world, however,
we should have 30 or more participants in our sample.
We will begin in Sheet 1.
Click on cell A1 and type "Men"
This is our variable name.
Now enter the raw data for men in column A
Next create an X-Squared column in Column B. Using the formula "= A2^2"
Double-click to copy the formula
Finally, summarize the columns using the formula "=sum(A2:A10)"
Then drag that formula to the right to copy the formula.
The sum of x = 599 and the sum of X-Squared = 40,153.
These data will allow us to calculate the standard deviation using a formula.
We are going to import these data into SPSS later, and we need them on a second sheet.
select column A and copy
then paste these data into a sheet.
Delete the sum by dragging a blank cell into A11.
Now go back to Sheet 1.
Let's get the standard deviation in Excel to make sure that we calculate it right in the next step.
Click in cell A12
Type "= STDEV(A2:A10)"
The standard deviation equals 5.98.
Let's calculate by hand and see if we get the same thing.
Save this Excel data to your desktop as Martha Stewart.
Excel will add the suffix .xlsx
Leave this file on your desktop for the next lesson, and now we will calculate a t-test.
I have listed all of the relevant values for our calculations here on the right.
These are the values that we will plug in to the formulas. We begin with the standard deviation formula.
Using the n-1 correction,
calculate standard deviation
by plugging in the
sum of x of 599, the sum of x-squared of 40,153,
and the N of 9.
The standard deviation equals 5.98.
Yes, that is the same value that we calculated with Excel. Very good.
Next, plug in the standard deviation and n to get the estimated standard error of the mean.
Standard deviation = 5.98
N = 9, so the estimated standard error of the mean is 1.99
Third, plug into the t formula the mean is 66.56.
Mu = 73 and the estimated standard error of the mean is 1.99.
So t = -3.23.
And finally this is a unified t-test formula with all of the steps in one formula.
This might be a simpler formula to use once you understand each of the steps. It is
exactly the same formula as we just used.
So the answer to step four is t with eight degrees of freedom = -3.23,
probability less than .05
Step five: Make the decision
Compare the obtained t value of -3.23 to the t critical value of
+/- 2.306 from Step 3.
Since your t-test value of -3.23 exceeds the critical value of -2.306
The results are statistically
significant. You reject the null hypothesis.
Men with a mean of 66.56 and a standard deviation of 5.98
scored significantly lower than women with a mean of 73 on the test of indoor gardening.
t with eight degrees of freedom = -3.23,
probability less than .05.
Here is how we would write up these results in APA style:
a one-sample t test was conducted to determine whether men scored differently than women on a test of indoor gardening.
Mean scores for men were significantly lower than for women t with eight degrees of freedom = -3.23,
probability less than .05. This suggests a gender difference in gardening skill.
That last statement about the gender difference would go in your discussion section if you were writing this up for a paper
Now of course you could say that p < .05 and leave it at that.
Better yet, you could calculate the actual
probability for this t test along with Cohen's d effect size.
Returning again to the RStats effect size calculator for t-tests, click on the green tab for critical values and
look at the green box in the lower left.
Here you can enter your t value of -3.23, the degrees of freedom
8, and the number of tails in the test (2).
Click and the p-value is
.012, plus below this box you get a message that your t-test is significant.
To the right I wrote a simple interpretation. If the t-test is significant you will reject the null
hypothesis that assumes no difference between the groups and
Instead conclude that the alternative hypothesis is correct that there is a statistically significant difference
between the groups.
Next you calculate your Cohen's d effect size for your single sample t-test by clicking on the light purple tab for
effect single sample.
You have two options here.
Option one is to enter the sample mean 66.56.
The population mean 73 and
the standard deviation 5.98 which you calculate it as part of doing the t-test.
Click. The Cohen's d is a -1.076.
If you have output from SPSS, you can cut and paste into this section and calculate the effect size as well.
More about that in the next video.
With the new probability and effect size you could write up your results,
Substituting p = .012 where you previously had the p < .05.
Finally for more details about reporting your results, see page 11 in the Bear handout.