ONE SAMPLE T-TEST (EXAMPLES)

Tweet
Share

Watch this space

Detailed text explanation coming soon. In the meantime, enjoy our video.

The text below is a transcript of the video.



Connect with StatsExamples here



LINK TO SUMMARY SLIDE FOR VIDEO 2:


StatsExamples-one-sample-t-test-examples.pdf

TRANSCRIPT OF VIDEO 2:


Slide 1

The one sample T test is used to test a hypothesis about a population mean using a sample. Let's take a look at some examples so we can see how this works.

Slide 2

First let's review the steps in a one sample t-test.
You can watch our intro to the one sample t-test video for more information about this, but here's a quick summary.
We want to know if the population mean, represented by the symbol "\(\mu\)", is some specific value, call it "\(\mu\)0", but we can't measure the entire population and get the mean directly. We take a random sample from the population instead and calculate the sample mean and a confidence interval for where the population mean probably is.
Then we ask the question: does the confidence interval include \(\mu\)0 ?
►If the hypothesized population mean is inside our confidence interval, then there is a reasonable probability that the population mean is what we hypothesized it to be. The sample we got is what we would expect in the population mean was that value. We certainly don't have evidence to decide the population mean isn't \(\mu\)0. We therefore conclude that, based on our sample data, there is a reasonable probability that mu equals \(\mu\)0.
►On the other hand, if the hypothesized population mean is outside our confidence interval, then there is a low probability that the population mean is what we hypothesized it to be. The sample we got is not what we would expect if the population mean was that value. We do have evidence to decide the population mean isn't \(\mu\)0. We therefore conclude that, based on our sample data, there is a very low probability that mu equals \(\mu\)0.

Slide 3

However, when doing a t-test we don't generally go through all the steps of making the confidence interval and placing the hypothetical population mean inside or outside.
►Instead, we compare half the overall width of the confidence interval to the distance between the sample mean and \(\mu\)0. This is equivalent to seeing if \(\mu\)0 is within the confidence interval or not.
Since half the width of the confidence interval is our standard error times the critical t value from our table, we can rearrange this to get the equation shown at the bottom of the screen. I've shown this using an alpha value of 0.025 since that is the most common alpha value used when doing t-tests, but the actual t-value can vary based on the probability level desired.
If the left side of the equation is larger, that's the same as if the hypothetical population is outside the confidence interval.
If the left side of the equation is not larger, that's the same as if the hypothetical population is inside the confidence interval.
►So all a t-test really requires is to calculate a t-calculated value which is the sample mean minus the hypothesized population mean and divide that by the standard error. Then we just compare that t-calculate value to the appropriate t-critical value.
Getting the t-calculated value is pretty easy.
Knowing what the appropriate t-critical value is takes a little figuring.

Slide 4

There's a different t-distribution for every degrees of freedom value for the sample. And depending on what degree of significance we want to use, there are different t-critical values we may wish to use for each of these distributions. Again, you can watch our intro to the one sample t-test video for more information about this.
These t-critical values can be found in tables like the one shown here from the StatsExamples website. In this table, each row corresponds to a certain number of degrees of freedom and each column corresponds to an area alpha outside of the confidence interval.
By far the most commonly used probability level is an overall probability of 5% which means using a probability of 2.5% on each end and a 95% confidence interval in the center. This corresponds to an alpha value of 0.025 from our table on each end.
Our t-test then consists of seeing whether our t-calculated value is outside of this region - greater than the t-critical value for alpha equal 0.025 or less than the negative version of the t-critical value for alpha equal 0.025.

Slide 5

OK, so here it all is at once.
First, we create a null hypothesis and alternative hypothesis about what we think the population mean may be. The null hypothesis is that \(\mu\) equals \(\mu\)0. The alternative is that \(\mu\) is not equal to \(\mu\)0.
Then, we get a t-calculated value using the equation shown.
Then, we compare that t-calculated value to various t-critical values, which correspond to different confidence intervals and probabilities, based on the t-distribution for the number of degrees of freedom for our sample.
Then, we determine the probability, the p value, of seeing a t-calculated value as extreme as we do. This p-value will be the smallest alpha value we could choose and still reject the null hypothesis. In other words, what's the smallest alpha value we could pick, giving rise to the widest confidence interval, so that the hypothetical population mean would be outside that interval?
This p-value is essentially the probability of seeing our sample data if the null hypothesis is true.
Finally, we decide to "reject our null hypothesis" or "fail to reject our null hypothesis" based on the p-value. If the p-value is small we will reject the null hypothesis, if the p-value is not small then we would fail to reject the null hypothesis.
Another way of thinking about this is that if the null hypothesis that \(\mu\) equals \(\mu\)0 is true, that would give us non-small p-values, whereas if the alternative hypothesis of \(\mu\) not being equal to \(\mu\)0 is true, that would give us small p-values.
OK, now let's look at some concrete examples.

Slide 6

For our first example, let's think about how big some frogs are. Consider a sample of 12 frog masses with the values shown.
The questions we will ask are:
Is the mean of the population they come from equal to 24g?
and
With what degree of confidence do we make this conclusion?
►The first step will be to calculate the sample mean and standard error. If you need a reminder of how to do this, see our video about calculating summary statistics. We need these values to get our t-calculated value.
►Our t-calculated value will use the equation shown on the left, using the hypothetical population mean, and the sample mean and standard error values shown.
The standard error comes from the sample standard deviation using the equation shown to the right - the standard error is the standard deviation divided by the square root of the sample size, which in this case is 12.
The mean of 26 suggests that the true population mean might be more than 24, but we don't know if this larger value for our sample might just be due to sampling error which is why we're doing a statistical test.

Slide 7

First question, is the mean of the population of frogs that this sample comes from equal to 24g?
►The t-calculated equation, using the sample mean of 26, hypothetical population mean of 24, and sample standard error of 0.767523, gives us a t-calculated value of 2.6058.
►The degrees of freedom for a one-sample t-test is the sample size minus one which is 12 minus 1 equals 11.
►Looking in our t-table we find the row corresponding to 11 degrees of freedom and the column corresponding to an alpha value of 0.025. The t-critical value from the table is 2.201.
►Now we just ask ourselves whether the t-calculated value is larger than the t-critical value. In this case, 2.6058 is larger than 2.201. This corresponds to what's shown in the figure, the hypothesized population mean of 24 is outside the 95% confidence interval around the sample mean of 26. This means we can reject our null hypothesis.
We can therefore say that "the population mean for the mass of the frogs is significantly different from 24g"
In fact, we can and should do even better than that. Since the sample mean was 26, this tells us that the true population mean is larger than 24, not just different.
►An even better conclusion is to say that "the population mean for the mass of the frogs is significantly larger than 24g"
Before we move on, I want to point out that the sign of the t-calculated value doesn't seem to match the figure. Some people try to memorize a rule about how the sign of the t-calculated value tells them whether the true population mean is larger or smaller than the one in the null hypothesis.
My suggestion is that you don't focus on the sign of the t-calculated value. It's kind of arbitrary which mean we put first and which we put second in the numerator of the t equation. You're much better off comparing the sample mean to the hypothetical population mean to figure out if the data suggests that the true population is smaller or larger than the hypothesized one.

Slide 8

Next question, with what degree of confidence do we make this conclusion?
►For this we're going to compare our t-calculated value to the entire set of t-critical values for our degrees of freedom value.
The diagram shows what we're doing, as the confidence intervals get wider, the t-critical value gets bigger to match the smaller alpha values.
Focusing on the row for 11 degrees of freedom we start with the critical value of 2.201 which was what we used for an overall alpha value of 0.05.
Now we move outwards, looking at the critical values for smaller alpha values until we find the pair of values where our t-calculated value of 2.6058 is more extreme than one, but not as extreme as the next.
In this case, 2.6058 is larger than 2.328 which corresponds to an alpha of 0.02 (which is an overall alpha value of 0.04), but not as large as 2.718 which corresponds to an alpha of 0.01 (which is an overall alpha value of 0.02).
Our p-value, the smallest alpha value we could choose and still have the t-calculated value exceed the corresponding critical value, would therefore be smaller than 0.04, but larger than 0.02.
Another way of thinking about this is that the hypothesized population value lies outside the 96% confidence interval, but inside the 98% confidence interval.
Either way we think about it, the way we report our conclusion is to say:
"The population mean is significantly larger than 24g (0.02 < p < 0.04)"
We use the technical term significantly because our p-value is less than 0.05, the usual threshold for rejecting a null hypothesis.
We say "significantly larger" instead of "significantly different" because our sample mean indicates the direction of the difference.
And finally, we report the p-value range to give our audience a sense of what the probability level for our conclusion is.
There is still a probability between 2% and 4% than we would get this sample data when the population mean is in fact 24. We have decided to reject the null hypothesis because this probability is low, but we should make it clear how low this probability is to our audience and ourselves. A p-value like this is less convincing than a p-value less than 0.0001 for example.
Lastly, this example uses a table of t- critical values to get a range for the p-value, but if we had a computer it could calculate the exact probability. If did this we would get a p-value of 0.02444 - which is less than 0.04, but not as small as 0.02.

Slide 9

For our second example, let's think about the heights of a bunch of birds, penguins are our favorites here at StatsExamples so we use them. Consider a sample of 10 bird heights with the values shown.
The questions we will ask are:
Is the mean of the population they come from equal to 1 meter?
and
With what degree of confidence do we make this conclusion?
►The first step is to calculate the sample mean and standard error for our t-calculated value.
►Our t-calculated value uses the equation on the left, with the hypothetical population mean of 1 meter, and the sample mean and standard error values shown.
As before, the standard error is the standard deviation divided by the square root of the sample size, which in this case is 10.
The mean of 1.11 suggests that the population mean might be more than 1, but we don't know if this higher value for our sample might just be due to sampling error.

Slide 10

First question, is the mean of the population of birds that this sample comes from equal to 1 meter?
►Using the sample mean of 1.11, the hypothetical population mean of 1, and the standard error of 0.056490, we get a t-calculated value of 1.9473.
►The degrees of freedom for a one-sample t-test is the sample size minus one which is 10 minus 1 equals 9.
►Looking in our t-table we find the row corresponding to 9 degrees of freedom and the column corresponding to an alpha value of 0.025. The t-critical value from the table is 2.262.
►Now we see if the t-calculated value is larger than the t-critical value. In this case, 1.9473 is not larger than 2.262. This corresponds to what's shown in the figure, the hypothesized population mean of 1 is within the 95% confidence interval around the sample mean of 1.11. This means we won't reject our null hypothesis. We don't have the kind of sample data that would cause us to decide that the population means isn't 1 meter. In more technical terms, we "fail to reject" our null hypothesis.
We can therefore say that "the population mean is not significantly different from 1 meter"

Slide 11

Next question, with what degree of confidence do we make this conclusion??
►For this we compare our t-calculated value to the full set of t-critical values for our degrees of freedom value.
Focusing on the row for 9 degrees of freedom we start with the critical value of 2.262 which was what we used for an overall alpha value of 0.05.
Now we move inwards, looking at the critical values for larger alpha values until we find the pair of values where our t-calculated value of 1.9473 is more extreme than one, but not as extreme as the next.
In this case, 1.9473 is larger than 1.833 which corresponds to an alpha of 0.05 (which is an overall alpha value of 0.1) but not as large as 2.262 which corresponds to the overall alpha of 0.05.
Our p-value, the smallest alpha value we could choose and still have the t-calculated value exceed the corresponding critical value, would therefore be smaller than 0.1, but larger than 0.05.
Another way of thinking about this is that the hypothesized population value lies inside the 95% confidence interval, but outside the 90% confidence interval.
The way we report our conclusion is to say:
"The population mean is not significantly different from 1 meter (0.05 < p < 0.1)"
The difference we observed is not significant because our p-value is larger than 0.05, the usual threshold for rejecting a null hypothesis.
As before, we report the p-value range to give our audience a sense of what the probability level for our conclusion is. Although the difference is not significant, it is close and maybe that's suggestive and would lead us to do a follow up study to make sure.
Although we've decided not to reject the null hypothesis because this probability isn't low enough, a p-value like this is less convincing than a much larger p-value like 0.78 for example.

Slide 12

For our third example, let's think about the clutch sizes, the number of eggs in a nest, for some chickens. Consider a sample of 14 clutch sizes with the values shown.
The questions we will ask are:
Is the mean of the population they come from equal to 9?
and
With what degree of confidence do we make this conclusion?
►As before, the first step is to calculate the sample mean and standard error for our t-calculated value. The mean of 7.429 suggests that the population mean might be less than 9, but we don't know if this low value for our sample might just be due to sampling error.
►Our t-calculated value uses the equation on the left, with the hypothetical population mean of 9 eggs.
As before, the standard error is the standard deviation divided by the square root of the sample size, which in this case is 14.

Slide 13

Fist question, is the mean of the population of clutch sizes that this sample of clutch sizes came from equal to 9 ?
►Using the sample mean of 7.429, the hypothetical population mean of 9, and the standard error of 0.488486, we get a t-calculated value of -3.2169.
►The degrees of freedom for a one-sample t-test is the sample size minus one which is 14 minus 1 equals 13.
►Looking in our t-table we find the row corresponding to 13 degrees of freedom and the column corresponding to an alpha value of 0.025. The t-critical value from the table is 2.160.
►Now we see if the t-calculated value is larger than the t-critical value.
Keep in mind that what we're really thinking about is whether the t-calculated value is outside the confidence interval. That means that we're thinking about whether our t-calculated value is either larger than positive 2.160 or smaller than negative 2.160.
In this case, -3.2169 is less than -2.160 which corresponds to what's shown in the figure, the hypothesized population mean of 9 is outside the 95% confidence interval around the sample mean of 7.429.
This means we can reject our null hypothesis.
We can therefore say that "the population mean is significantly different from 9 eggs."
In fact, we can and should do even better than that. Since the sample mean was 7.429, this tells us that the true population mean is less than 9, not just different.
►An even better conclusion is to say that "the population mean clutch size is significantly less than 9 eggs"

Slide 14

Next question, with what degree of confidence do we make this conclusion??
►For this we compare our t-calculated value to the full set of t-critical values for 13 degrees of freedom. Starting with the critical value of 2.160 which was what we used for an overall alpha value of 0.05 we move outwards until we find the pair of critical values that bracket our calculated value.
In this case, - 3.2169 is more extreme than - 3.012 which corresponds to an alpha of 0.005 and an overall alpha value of 0.01, but not as extreme as 3.372 which corresponds to an alpha of 0.0025 and an overall alpha value of 0.005.
Our p-value is therefore smaller than 0.01, but larger than 0.005.
Our conclusion is:
"The population mean clutch size is significantly less than 9 eggs (0.005 < p < 0.01)"
As before, we report the p-value range to give our audience a sense of what the probability level for our conclusion is. Compare this example where the p-value is extremely small, less than a one-percent chance this can be caused by random sampling error, to our first example of a significant difference.
Even so, there is a slim chance that the true population mean is 9 after all, and when we decide otherwise we may be making a mistake.

Slide 15

So far, we've been looking at two-tailed t-tests - ones where we want to know if the population mean may be either smaller or larger than a hypothetical value. There are also one-tailed t-tests in which we only care about one direction or the other.
We can use the same general method to test different null and alternative hypotheses as shown.
The procedure is basically the same, but we compare the t-calculated value to t-critical values in only one direction and the critical values we use correspond directly to the overall alpha value. For example, instead of using the column for alpha equals 0.025, we would use the column for alpha equals 0.05, but only test how extreme the t-calculated value is on one direction.
Let's look at a pair of examples to see how this works.

Slide 16

For our first one-tailed example, let's think about a population of cholesterol values we're interested in. The motivation for our study may be that we want to know if their mean value is less than 200 for some reason. Let's consider a sample of 15 cholesterol values from this population with the values shown.
The questions we will ask are:
Is the mean of the population they come from less than 200?
and
With what degree of confidence do we make this conclusion?
►As with the two-tailed test, the first step is to calculate the sample mean and standard error so we can get our t-calculated value. The mean of 197.6 suggests that the population mean might be less than 200, but we don't know if this low value for our sample might just be due to sampling error.
►Our t-calculated value uses the same equation as before and a hypothetical population mean of 200.
As before, the standard error is the standard deviation divided by the square root of 15, the sample size.

Slide 17

First question, is the mean cholesterol value for the population this sample came from less than 200 or not ?
►Using the sample mean of 197.6, the hypothetical population mean of 200, and the standard error of 1.386633, we get a t-calculated value of negative 1.7312.
►The degrees of freedom for a one-sample t-test is the sample size minus one which is 15 minus 1 equals 14.
►Looking in our t-table we find the row corresponding to 14 degrees of freedom and the column corresponding to an alpha value of 0.05. The t-critical value from the table is 1.761.
►Now we see if the t-calculated value is more extreme than the t-critical value in the appropriate direction.
Earlier I mentioned that some people try to memorize how the sign of the t-calculated value corresponds to the direction of the difference. Again, I think this is a bad idea. For this example, it's much better to think about how the negative t-calculated value corresponds to the direction we're interested in because the sample mean was less than 200.
We therefore compare the negative 1.7312 to the negative versions of the t-critical values - in this case comparing it to negative 1.761.
Instead of showing the confidence interval in the diagram like before, this one is showing the t-values. And as illustrated in the diagram, negative 1.7312 is not as extreme as the t-critical value of negative 1.761 so we lack the evidence to reject the null hypothesis of the population mean being equal to or larger than 200.
We would say that "The population mean is not significantly smaller than 200"

Slide 18

Next question, with what degree of confidence do we make this conclusion?
►For this we compare our t-calculated value to the full set of t-critical values for 14 degrees of freedom. Since this is a one-tailed test, the alpha value from the table is the same as the overall alpha value for the results of our test.
Our value of - 1.7312 lies between the critical values - 1.345 and - 1.761 corresponding to alpha values of 0.1 and 0.05.
Our p-value is smaller than 0.1, but larger than 0.05.
Our conclusion is therefore:
"The population mean is not significantly smaller than 200 (0.05 < p < 0.1)"
Our sample would cause us to fail to reject the null hypothesis of a population mean equal or greater than 200 and not accept the alternative hypothesis that the population mean is less than 200. Note that the p-value is close to 0.05 so this is the borderline kind of result that might make us a little skeptical of the certainty of the result.

Slide 19

For our second one-tailed example, let's think about a population of parasite load values we're interested in. The motivation for our study may be that we want to know if the mean parasite load is over 10 for some reason. Let's consider a sample of 8 parasite load values from this population with the values shown.
The questions we will ask are:
Is the mean of the population they come from more than 10?
and
With what degree of confidence do we make this conclusion?
►As always, the first step is to calculate the sample mean and standard error so we can get our t-calculated value. The mean of 12.5 suggests that the population mean might be more than 10, but we don't know if this high value for our sample might just be due to sampling error, especially with a sample size of only 8.
►Our t-calculated value uses the same equation as before and a hypothetical population mean of 10.
The standard error is the standard deviation divided by the square root of 8.

Slide 20

First question, is the mean parasite load value for the population this sample comes from more than 10 or not ?
►Using the sample mean of 12.5, the hypothetical population mean of 10, and the standard error of 1.101946, we get a t-calculated value of 2.2687.
►The degrees of freedom for a one-sample t-test is the sample size minus one which is 8 minus 1 equals 7.
►Looking in our t-table we find the row corresponding to 7 degrees of freedom and the column corresponding to an alpha value of 0.05. The t-critical value from the table is 1.895.
►Now we see if the t-calculated value is more extreme than the t-critical value in the appropriate direction.
In this case, a positive t-calculated value corresponds to the direction we're interested in. We therefore compare the 2.2687 to the 1.895.
As illustrated in the diagram, positive 2.2687 is more extreme than 1.895 so we have evidence to reject the null hypothesis because that means that the p-value will be less than 0.05.
We would say that "The mean number of parasites is significantly larger than 10."

Slide 21

Next question, with what degree of confidence do we make this conclusion?
►For this we compare our t-calculated value to the full set of t-critical values for 7 degrees of freedom.
Our value of 2.2687 lies between the critical values 1.895 and 2.365 corresponding to alpha values of 0.05 and 0.025 respectively.
Our p-value is therefore smaller than 0.05, but larger than 0.025.
Our conclusion is therefore:
"The mean number of parasites is significantly larger than 10 (0.025 < p < 0.05)"
Our sample would lead us to reject the null hypothesis of a population mean equal or less than 10 and thereby accept the alternative hypothesis that the population mean is more than 10. Note that the p-value is close to 0.05 so this is the borderline kind of result that might make us a little skeptical of the certainty of the result.

Slide 22

Let's look at the result from the significant one-tailed test we just performed in more detail.
The t-calculated value we got of 2.2687 was significant when we did the one-tailed test because it is more extreme than the critical value of 1.895 corresponding to an alpha value of 0.05.
However, if we had done a two-tailed test then it wouldn't have been significant because we would have used the critical value of 2.365 corresponding to the alpha value of 0.025 in each direction for an overall alpha value of 0.05.
This brings up a risk of doing one-tailed t-tests. If we do these tests, we must decide on the direction before we look at our data. The direction must be based on some outside hypothesis or line of reasoning.
If we had calculated the sample mean first, and then decided on the direction, we would really be using the outer 10% of the area.
►For this reason, you should always beware of one-tailed tests.
Never do them after you see which way the data suggests or you're prone to reject the null hypothesis more often than you should.
Also, be extra skeptical when someone else uses a one-tailed test and gets a barely significant result. They wouldn't have gotten a significant result if they had done a two-tailed test, so did they really have the justification to do the one-tailed test?

Slide 23

Let's do a couple of quick examples to see just how easy the t-test can be.
Imagine we have a hypothesized population mean of 25 and our sample has a mean of 27 with a standard deviation of 6.35 and sample size of 40.
What's our conclusion?
►The standard error is just 6.35 divided by the square root of 40, which comes out to 1.004023.
The degrees of freedom is 40 minus 1 which is 39. Our table doesn't have a row for 39 so we'll round down to 35. The companion video that introduces the t-test describes why we do this in detail. The critical value in this row is 2.030.
The t-calculated value is 27 minus 25, divided by 1.004023 which gives 1.99198.
Is the t-calc larger than the t-crit?
This is asking whether 1.99 is larger than 2.030, which it isn't.
►Taking a quick look, the t-calc value is between the critical values for the alpha equals 0.025 and 0.05 columns.
Therefore, "The population mean is not significantly different from 25 (0.05 < p < 0.1)"

Slide 24

Now imagine we have the same hypothesized population mean of 25 and our sample has a mean of 27 with a standard deviation of 6.35, but now the sample size is 68.
►The standard error is the 6.35 divided by the square root of 68, which comes out to 0.757924.
The degrees of freedom is 68 minus 1 which is 67. Our table doesn't have a row for 67 so we'll round down to 60. The critical value in this row is 2.000.
The t-calculated value is 27 minus 25, divided by 0.757924 which gives 2.63878.
Is the t-calc larger than the t-crit?
This is asking whether 2.6388 is larger than 2.000, which it is.
►Taking a quick look, the t-calc value is between the critical values for the alpha equals 0.01 and 0.005 columns.
Therefore, "The population mean is significantly larger than 25 (0.01 < p < 0.02)"
In the two examples we did, the sample and hypothetical means differed by the same amount and the standard deviation of the data was identical. What differed was the sample size which changed the results from a non-significant difference into a significant one because of two things.
First, the standard error was smaller for the larger sample size.
Second, the larger sample allowed us to use a narrower t-distribution.
Both of these factors combined to reduce the width of our confidence interval and effectively change it from including the hypothetical mean in the first example to excluding it in the second when we had more data.

Slide 25

Finally, a few things to remember when doing one sample t-tests.
First, technically, data should be normally distributed, but the central limit theorem handles this for larger samples unless the data very weird.
Second, we should always report the p-value range (or exact p-value) and direction when reporting results.
Third, you can only do a one-tailed test under 2 conditions.
One, you only care about one direction.
Two, you have an a priori reason to test in only one direction.
You CANNOT look at data to choose the direction when doing a one-tailed t-test.
And finally, always remember the risk of a type I or type II error. The conclusions we are making from our statistical tests are based on probabilities - random chance can cause our samples to give misleading results sometimes.
Watch our video about type I and type II errors for more about this.

Zoom out

The one sample t test is the first statistical test that most statistics students learn and can be overwhelming. Hopefully, the examples in this video will help you with doing your own one sample t-tests. As always, a high-resolution PDF of this image is available on the StasExamples website via the link below.

End screen

If you found this video useful - like, subscribe and share it so that others can find it too.




Connect with StatsExamples here


This information is intended for the greater good; please use statistics responsibly.