 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, student's t-distribution instead of z. William Gossett developed a t-distribution. He wrote under a, 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. Okay, 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. 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, and t10 looks different than t11, and t11 looks different than t12. 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 a normal distribution, and that's why most tables at some point will switch over. And basically, you 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 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, mu zero is the value of the parameter under the null hypothesis. And if you notice, there are degrees of freedom attached to the tn minus one, and we'll certainly get plenty of practice with that. Now I'm 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 minus one. 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 when you, in the formula of computing s, you divide it by n minus one. You lost a degree of freedom. If you didn't divide by n minus one 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 minus one, n minus one to make sure it's an unbiased estimator of sigma. So basically we have n minus one 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 minus one 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 minus one 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? Well, 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 0.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 non-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 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 alpha is 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 alpha is 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 do it for, when we use it for 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. And 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 want a 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 two, soup from a vending machine company. The company claims that its soup vending machines deliver, on average, exactly four 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 that 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, H O mu is four ounces and H 1 is mu is not four 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. We 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 in the rejection region, which is another way of saying that the probability of getting this kind of sample evidence, if HO is true, using the mu of 4th, 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. So the probability of less than 2% of getting this kind of sample evidence, we reject the claim, or in other words, reject 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 says, can I 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. 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. 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. H1 is mu less than 70. The rejection region is on the left. H1 is always pointing to it. On the left, we need 5% for a T15. If you look at the table value, you'll see it's minus 1.7531. Tables have negatives, but it's symmetric. We know what it means to put 5% in the tail. Don't forget that negative number. You're going to need a negative to show it's on the left side. Now we take the sample evidence. We convert it into T15. 68 minus 70 over 9 over the square root of 16. Notice you keep the N. N doesn't change. You have N minus 1 degrees of freedom. N is still 16. It's minus 2 over 2.25 which is minus 0.88. You look for that. You notice you're not in the rejection region. This is not unreasonable. Again, it's a small sample. This is what happens sometimes with very small samples. It becomes hard to reject HO. 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. It's not significant. You show that it's greater than the level you're testing it. Probability of 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. 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. Now you find the critical value of the T15 is 2.1315. Now you're going to be using a T15 value of plus and minus 2.1315. The standard error of the mean, which we did before, hasn't changed. That's going to be 2.25. So 2.1315 times 2.25. Your 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 with small sample size. You have a wide interval. Basically, you're 95% sure that somewhere in that interval you just constructed 63.2 to 72.8 lies the fixed number. 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 bottled water. 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 one. 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 one 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, 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 one 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, 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 four. That's kind of a lot. A T value of four or even a Z value of four would be really, really large. And 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 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 your, the material is to practice, practice, practice, do homework, do problems, wherever you can find them. And you know, there are a lot of practice problems available on our website.