 In this lecture, we discuss the use of the student's t-distribution in statistical inference. If you recall, we used the z-statistic. Even if we didn't know sigma, technically you should know sigma, but even if you don't know sigma, but you have a large enough n, well, 30 or 50 depending on what your teacher tells you, a large enough n, you can use z. What happens if you have a small n? Everyone admits if it's below 30, if n is less than 30, you can't really use z. So what do we do if you don't know sigma? Again, if you know sigma, there's no problem. You can use z. So again, use z if you know sigma, or use z even if you don't know sigma, but n is large enough. But now you don't know sigma, n is small, what do you do? Well, if the population is normally distributed, you can use what's called a t-distribution. It's a student's t-distribution instead of z. William Gossett developed the t-distribution. He wrote under, I guess, a pseudonym. He called himself student because he was an employee of the Guinness Brewery. So he had to use a pseudonym in publishing his results. So basically in a nutshell, you're going to use the t-distribution when you have small samples and don't know sigma. That's essentially when we're going to use the t-distribution. And you'll see the t-distribution is very similar to the z. It's a little fatter in the tails, but we'll learn about that in a few minutes. I know you'd like to know when to use the t-distribution and when to use the z-distribution in making inferences about the mean mu of a population. Well, here you have it laid out in a nice little table. Either sigma is known or sigma is unknown. That's the population standard deviation. And either we have what we would call a large sample, a large n, or we have what we would call a small n. We'll talk more about what large and small mean. If sigma is known, well, just use the z-test. That's what it's for. If we have a large sample, a large enough sample, we'll just use the z-test, the z-statistic. So the only problem we have is when sigma is unknown and we have a small sample size. So of all those four cells that you're looking at in the table, the only one that's the problem is the one where sigma is unknown and the sample size is small. That's when we want to use the t-test. But remember, we're making a big assumption when we use the t-test. We're assuming that the underlying population is normally distributed. If we can't make that assumption, if we know that somehow we know that that's not the case or might not be the case, well, then we can't use the z, we can't use the t, and we have to take an advanced statistics course to learn more about distribution-free statistical methods. Look at this picture of the t-distribution. It looks like the z. Yeah, it does look like it. It's symmetric. That it has. Okay, so it's symmetric about the mean. The mean equals the median, which equals the mode. It goes from minus infinity to plus infinity. There's one little big difference. The student's t-distribution is not one distribution like the standardized z-distribution. It's not one. There are many. In theory, you could have thousands of tables, each based on a degree of freedom. So in other words, the t-distribution with nine degrees of freedom is a slightly different look than t10. t10 looks different than t11, and t11 looks different than t12. Now the degrees of freedom you'll find out in this case, in the one sample case, we're going to have n minus one degrees of freedom, and that will be explained. But what you have to know is the t-distribution, the shape of it will depend on the degrees of freedom. As n gets large, you see this t-distribution starts looking like the normal distribution, and that's why most tables at some point will switch over and basically move over and use the z already. So most tables stop at some number, like close to 50 or at 50, and then jump to 100 and then say infinity. Infinity, of course, t-infinity is z. So that's how we show that. As far as what this degrees of freedom stuff is, you kind of learned it a little bit when you learned about the standard deviation that we divided by n minus one. It's a mathematical kind of adjustment, so you know about losing a degree of freedom. But just bear in mind, there is no one t-distribution. There are lots of them, depending on the degrees of freedom. So when you write down t, unlike z, you just write z, everyone knows what you're talking about. If you write down t, it's not enough. If you write t9, t10, t20, whatever, degrees of freedom you're working with. As you can see, the formulas that you use when you're using the t-statistic look exactly the same, or almost exactly the same, as the formulas you used when you were using the z-statistic for confidence intervals and for hypothesis testing. They are the same, except that you have a value from the t-table instead of a value from the z-table. You're not going to have sigma because we don't know sigma. If we knew sigma, we'd be using z, but you have s in place of sigma. As always, mu0 is the value of the parameter under the null hypothesis. And if you notice, there are degrees of freedom attached to the tn-1, and we'll certainly get plenty of practice with that. Now we're going to talk about what it means to lose a degree of freedom. The number of degrees of freedom is equal to the sample size n-1. Why do we lose a degree of freedom? Anytime you compute a statistic from the sample and use it as an estimator in place of a parameter, there's something mathematically wrong with that. So you lose a degree of freedom. What do we do wrong here, in a sense? We didn't know sigma. Again, that's why we're using t. If you know sigma, you can use z. We don't know sigma. So instead of using sigma, which basically comes from a census, it's a parameter, we're using s, the sample standard deviation. And by now you know that s is not sigma. It's an estimate of sigma. And that's why in the formula of computing s, you divide it by n-1. You lost a degree of freedom. If you didn't divide by n-1 in computing the standard deviation, you'd have a bias. Because then there'd be a bias when you try to use s in lieu of the sigma. s is an estimate of sigma. So we divide by n-1, n-1 to make sure it's an unbiased estimator of sigma. So basically we have n-1 degrees of freedom, and it's a mathematical adjustment in effect. So you've got to use it and just keep in mind that it's n-1 degrees of freedom. And this means to you that if you're working with, let's say, sample size of 18, then the t that you're going to be showing is t17. n is 18, n-1 is 17. So the distribution you'll be using is t17. Here's an example of a hypothesis test where we find we have to use the t distribution. Consulting firm claims that its consultants earn, on average, exactly $260 an hour. That's the claim. You decide to test this claim. You get a sample of 16 consultants. It's not so easy to get a larger sample than that. So clearly the sample is small. Do you know sigma? The next sentence says you find that average x-bar is $200 an hour and s, this is the sample standard deviation, is $96 an hour. So we don't see sigma anywhere here. We have to use s as a point estimator for sigma. The sample size is 16, which is quite small. Clearly, this is a good candidate for the t distribution. We want to test the claim at alpha equals .05, significance level. And notice that last sentence, assume that the population follows a normal distribution. Without that, we can't do the problem. And sometimes that's a good hint. If the problem is written out completely on an exam and includes that sentence, the first thing you should do is check to see if it's a hinting that you should be using a t distribution. So let's follow the steps in hypothesis testing as much as we can. Really, we don't need to do every discrete step exactly. And in fact, we usually boil hypothesis testing down to four parts. The null and alternate hypothesis, the critical values from the table for the decision rule, the calculated value of the test statistic and the decision. But here, since this is the first problem, we'll follow the step, step one. We formulate the null and alternate hypotheses. The null hypothesis is the claim. So the null hypothesis says that the mean mu, the population mean, really is $260 an hour as claimed. If we reject that, we accept the alternate hypothesis, that is not. Step two, the level of significance alpha that was given, and that's 0.05, and we'll continue with this problem on the next few slides. Step three says choose the test statistic. Well, we already figured out we really don't have much of a choice. We don't know Sigma, we have a small sample size, and so we're going to be using the t distribution. Which t? Remember, there isn't only one t distribution, as we're familiar with from using the z. There are lots of t distributions, one for each degree of freedom. If your sample size is 16 and minus one is 15, that's your degrees of freedom. So we're working with a t with 15 degrees of freedom and alphas 0.05. Step four, we need to establish the critical values that split the distribution up into a region of rejection. That's the shaded area and a region of acceptance. That's the unshaded area in the middle. We go to the table, we say alphas 0.05, so the tail probability is 2.5% on each side. So we're looking at the 0.025 tail probability. Degrees of freedom is 15. We're going to see from the next slide how we look that up in the table. It turns out when we do, the critical values are plus and minus 2.1315, and so our decision rule will be when we calculate the value of the t statistic from the data, from the empirical evidence, if it turns out to be greater than 2.1315, we end up in the shaded area, so we'll reject. If it's less than negative 2.1315, we're in the shaded area on the left side, and so we'll reject. Let's see how to get those critical values from the table on the next slide. As you can see, the t table is set up differently from the z table that you've been working with till now. If we need to get critical values from the z table, we need to enter the table, the z table with the area, the 0 to z area, and we come out with the value of z. So we're using the z table backwards from the way it was intended when we use it for a statistical inference. Now the t table is set up exactly the way we want it. We have the tail probability, the area in the tail, that's the rejection region in the tail. If it's a two-tail test, we take alpha and split it in half, and you can see that the column highlighted here is 0.025, that's half of alpha. We use the row for the appropriate degrees of freedom, the degrees of freedom that we have. With a sample size of 16, 16 minus 1 is 15, degrees of freedom that we're working with is 15. So the column is 0.025, that's the tail area, the row is 15 for degrees of freedom. And as you can see, that's how we got the critical value from the t table of 2.1315. When it's on the right side, it's positive, but the t distribution is symmetric just like the z. And so on the left side, we end up with negative 2.1315. Step five, we're going to get the calculated value of the test statistic from the data, from the empirical evidence following the formula that you had before. And you notice that it doesn't start out z equals, it doesn't start out even t equals, because it's a particular t, the t with 15 degrees of freedom. And the formula is very, very similar now to the formula that you've been using all along. Using the data, the formula computes to negative 2.50. Then for step six, we have to make the decision. How do we do that? We take the calculated value of the test statistic from step five, compare it to the decision rule that we set up before using the critical values from the table. And negative 2.5 is less than negative 2.1315, so that lands it squarely in the shaded area in the region of rejection. And that makes step six easy. The conclusion is reject the null hypothesis. Now we're going to use the same data to construct a confidence interval estimator for mu. Remember that if we're estimating, if we're constructing a CIE, that means that we're, we don't know about the claim, we're not giving any credence to the claim or we're ignoring the claim. All we're doing is saying I have my data. I would like to estimate the population parameter. What was the data? We had a sample size of 16. The mean X bar was 200. The standard deviation S was 96. And all we need to, that's all we need to know in order to construct the confidence interval estimator. We're going to get a 95% CIE because it's reasonable to say since I wanted my rejection region and the hypothesis test to be 5%. I was willing to accept the 5% chance of rejecting the null hypothesis falsely. It makes sense to say that I wanted 95% confidence interval estimator for mu and that's what we're going to use. Like, and you know that the confidence level, the alpha level, those are usually given in the problems that you're doing in this course. So the X bar value 200 is in the middle. We use the value from the T table 2.1315 times the standard error of the mean 96 over the square root of 16 to compute the half width or the margin of error or the sampling error for this confidence interval. And the interval itself now goes from a lower limit of $148.84 per hour to an upper limit of $251.16 per hour for the consultants. That's our estimate. It seems like a pretty wide interval, but that's the best we could do with the data that we were given. And the interpretation, we have 95% confidence that this interval really does contain the true population mean. Let's look at example 2, soup from a vending machine company. The company claims that its soup vending machines deliver, on average, exactly 4 ounces of soup. Well, you want to test that. And the company statistician finds that based on a sample of 25, n equals 25, X bar, the sample mean is 3.97 ounces, and the standard deviation is 0.04 ounces. So question A says test the claim at alpha equals 0.02. B is a different problem, but using the same sample evidence. No claim was made. Nobody made a claim. You're looking at the sample evidence, and you're asked to construct a two-sided 98% confidence interval estimator for mu using the sample evidence. We're going to be testing the claim. Remember, alpha is 0.02, and the claim, if you write it down mathematically, H0 mu is 4 ounces, and H1 is mu is not 4 ounces. So now you have to take the alpha of 0.02 and put it into the two tails. You've got to divide it. Half of 0.02 is 0.01. So you have 0.01 in the right tail, and 0.01 in the left tail. Now, which T is this? This is T24. Notice that we write out T24. So everybody knows that we're using the T24 distribution. And now we have 0.01 in the right tail, and we see, well, what is the critical value? We don't use the Z-Table. We're using the T24 table. You see the critical value on the right is 2.4922, symmetric. So on the left you have minus 2.4922. So shaded in red, you have the rejection region. So on the high side, let's say above 2.4922, you're going to reject. If you're below on the left side, below negative 2.4922, you reject. Anywhere in the white area between 2.4922 and minus 2.4922, that white area is the acceptance region. Now we're going to take the sample evidence, turn it into a T-value, and see where the T-value falls. Well, you can see the, it's very similar to the Z-formula. T24 is 3.97 minus 4 over 0.04 over the square root of 25. So the numerator we have minus 0.03. And in the denominator, that's the standard error of the mean, we have 0.008, because 0.04 over 5 is 0.008. And we end up with a T-value, T24 value of minus 3.75. Essentially what we've done is converted the sample evidence into a T24 value. Now where is that minus 3.75? Obviously it's in the rejection region, right? You're all the way in the left, you're too far to the left, you're in the rejection region, which is another way of saying that the probability of getting this kind of sample evidence, if that was true, using the mu of fourth, we temporarily accept that claim. And then see, well, is this the sample evidence we should be getting? No, it's much less than 0.02 probability, right? So the probability of less than 2% of getting this kind of sample evidence, reject the claim, or in other words, reject the HO. Now we're going to do part B. No claim was made, nobody made any claim, you just want to take the sample evidence and construct a two-sided 98% confidence interval estimate, or mu. Okay, so you take the sample mean 3.97, and as you know, the T-value, T24 value, you take plus and minus 2.4922, that's the value from the table, times the standard error of the mean, that was the 0.008, and you find out that your margin of error is 0.02 ounces. So when you construct your confidence interval, it goes from 3.97 plus 0.02, 399 on the right, 3.99 ounces, on the left it's 3.97 minus 0.02, which is 3.95 ounces. So basically a 98% sure that somewhere in that interval from 3.95 ounces, 3.99, somewhere is that mu. Notice by the way, 4 would not be in the interval, so if you didn't even make a claim yet, and your boss is going to claim 4, you say nope, it's not in the 98% CIE. So it's basically very similar to what you did in part A. But again, generally once a claim is made, you're going to test the hypothesis. If no one's making any claims, the correct approach is to construct the confidence interval. This problem of looking at reading scores. A school claims that the average reading score of its students is at least 70. Now you know what the word at least or at most, what that hints at. We're going to be doing a one-tail test. Okay, a sample of 16 students is randomly selected. So N is 16 to test the claim. Here's your sample evidence. X bar is 68 and S is 9. So in part A we're going to test the claim at the alpha 05. Part B says forget the claim. No one made any claims. All you want to do is take the sample evidence to construct a two-sided 95% CIE from mu. We're going to test the claim at alpha 05. Now notice I write T15 and minus 1. 16 minus 1 is 15. We're going to be using the T15 distribution. Okay, we've got to put 5% in the left tail. Why? HO is that mu is greater than 70. High numbers are good. You might get a promotion if the reading score is way above 70. High numbers are good here. It's only when it's low you might get fired. Okay, so H1 is mu less than 70. So the rejection region is on the left. H1 is always pointing to it. And on the left, so now we need 5% for T15. And if you look at the table value you'll see it's minus 1.7531. Tables don't have negatives but it's symmetric. And so we know what it means to put 5% in the tail. Okay, but don't forget that negative number. You're going to need a negative to show it's on the left side. Okay, now we take the sample evidence. We convert it into T15. Score. Okay, so 68 minus 70 over 9 over the square root of 16. Notice you keep the N. N doesn't change. Okay, here we have N minus 1 degrees of freedom. N is still 16. So it's minus 2 over 2.25 which is minus 0.88. Okay, you look for that. You notice you're not in the rejection region. And this is not unreasonable. Again, it's a small sample. And this is what happens sometimes with very small samples. It becomes hard to reject HO. But anyway, there's no evidence to reject HO based on the sample of 16. Your conclusion is you can't reject HO. The probability of getting the sample evidence is greater than 05. And it's not significant. You show that it's greater than the level you're testing it. So probability of the sample evidence is greater than 05. There's no reason to fire anyone. And the principal now is safe. He can keep his job or her job. Well, in Part B, there's no claim aid. We're not working with any claims. All I want to do is take the sample evidence and construct the two-sided confidence interval. That's all I'm doing. Notice the T value of T15. Remember, you want to put half of it. You're taking 05, cutting in half. You want 95% in the acceptance region. So you have 025 on the left and 025 on the right. And now you find the critical value of the T15 is 2.1315. So now you're going to be using a T value, T15 value, of plus and minus 2.1315. The standard error of the mean, which we did it before, hasn't changed. That's going to be 2.25. So 2.1315 times 2.25. And your margin of error is 4.8. Again, that's the margin of error is 4.8. So you do 68 plus and minus 4.8. And now you have your confidence interval. It goes from 63.2 all the way to 72.8. It's very wide because the sample size is so small. That's what happens a small sample size. You have a wide interval. But basically, you're 95% sure that somewhere in that interval you just constructed 63.2 to 72.8 lies the, remember it's a fixed number and the population mean, that's the reading score, somewhere in that interval, you're 95% sure, is the true mean. Here's another problem. This is also going to end up being a one-tail test using the T distribution. But the tail is on the other side. The Vandelay Water Company claims that at most there is one part per million benzene in its terribly expensive, horrible tasting bottle of water. Terrible tasting and terrible tasting and terribly expensive probably go together just a little aside. Why do we not want benzene in our water? It's toxic. We really don't want to be drinking benzene. We want to test this claim at the alpha level of 0.05. What's the sample data? N equals 25 randomly selected bottles of water. From that sample of size 25, our X bar value, our sample mean was 1.16 parts per million of benzene with a standard deviation of 0.20 ppm of benzene. So we want to test the claim. We want to do a hypothesis test. HO is that mu is less than or equal to 1. That's the same as saying that there's at most one ppm of benzene. There isn't more. There's less than or equal to. If we reject HO, then we're accepting H1, which is saying that really the mean is something greater than the claim, greater than one ppm. We don't know what. We don't have to specify what, but we know it's more. Where are we going to? How are we going to make the decision rule? Well, we don't know sigma, and our sample size is rather small. So we're going to use a T with n minus 1 or 24 degrees of freedom. The region of rejection is all in one tail. How do I know it's on the right side? Remember the hint that H1 has a greater than symbol. It looks like it's an arrow pointing to the right. And that means that our region of rejection is in the right tail. H1 covers our region of rejection, remember, because if we reject HO, that means we're accepting H1. So the 0.05 is all in one tail. That's how we use the T table. We need the tail probability, 0.05. We need the degrees of freedom, n minus 1 or 24. And what do we get? We get a table value, a critical value from the T table of 1.7109. So when we calculate the T statistic from the data, if we get a value that's greater than 1.7109, if we're in the red shaded area, we reject. If it's less than, we don't reject. That's our decision rule. So now let's go back on the left side and say, oh yes, we have the calculated value of the T24 statistic, calculated from the data. And using the formula, it comes out to exactly 4. That's kind of a lot. A T value of 4 or even a Z value of 4 would be really, really large. That puts us beyond 1.7109 into the region of rejection, way into the region of rejection. And so there's no question. The conclusion is reject the null hypothesis. The probability that we got this value or worse, if the null hypothesis is true, that probability is less than the level of significance, the alpha of 0.05 that we're working at. Thank you for attending our lecture on the T distribution. I hope you learned something. I hope you enjoyed it. But you know that the best way to make sure that you learned the material is to practice, practice, practice. Do homework, do problems wherever you can find them. And there are a lot of practice problems available on our website.