 How we calculate t-test, now we can use SPSS and we can do it pretty quickly with just one click, but still we need to know the logic behind where the values are coming from, where the t-value is standard error, difference value is coming from, so we will first do it manually so you get the concept, get the understanding and then we will go through SPSS how we calculate it. So the basic formula is what we did in the one sample t-test, remember mean minus mu, that is we divide the value of the sample as standard value or the value of the population or the standard value and then we divide it on the standard error. The same assumption for the independent sample t-test, but the difference is that we have two samples, sample one, sample two, that is group one, group two which we are calculating differently. So look here the formula is that this is the difference of your sample and this is the difference of your population and divide it by the standard error. Simply if you want to write it by simplifying it, then you can definitely do mean one minus mean two because this figure is not known by the population but we are interested mainly in the difference between group one and group two, so we are comparing for instance boys and girls, and we will divide it by the standard error of mean difference, mean difference. So to calculate the standard error we need to calculate the formula and also understand what is the standard error. So standard error basically is the amount of error that is expected because we are estimating the population from the sample. We have found out that the difference between boys and girls in my sample, but if we study the entire population then definitely there is a value that exists which is beyond the scope which we cannot actually study, we cannot take the entire population and study that. So we are estimating the population difference with the sample difference. So there definitely going to be error in between. We cannot do exact value, they predict until or unless we study the entire population. So it is the amount of error that is expected when we are estimating population mean difference from the sample mean difference. And how do we calculate that? Each of the two samples means represents its own population mean but each case there is some error. We are approximating the mean one from population one and the mean two from population two. For instance this is for girls, this is for boys. If we are estimating the larger population from the sample then definitely there will be an error in both. So we need to calculate the error and variance of both. For the independent sample T statistics you want to know the total amount of error involved in the using two sample means. So we need to calculate the total amount. That means we are estimating the population one from group one and we are estimating the population two from group two. What we will do is we will actually approximate the total error for the T test. So the T test is a simple formula. If we have to do it manually, we will calculate the difference between mean one and mean two. Mean one minus mean two and we will divide it by variance of one divided by n plus variance of two divided by n two. We have already done that and I am sure that if you go to the last lecture you can recall that. And how do we calculate variance? You should remember variance is basically a variability. The difference of each score from the mean. We calculate variance as x minus mean. We calculate the difference of each score from the mean. We square it from the mean and then we divide it by n. And we denote it by s square which we call variance. And if we take it under root then it becomes standard deviation. So simply take it under root and we will end it by s and it will become standard deviation. And we will under root it by square. Simple. So in the T test we have to take out the pooled variance. We have to take out the variance of each group. We have to take out the variance of group one and group two. Because I have told you that we see the combined error for both the groups. How much error is there? When the group one is predicting, estimating and the group two is calculating, we can calculate the pooled variance. And the formula for pooled variance is something like this. I have just taken out the variance. And I have told you variance is equal to x minus mean square divided by n. So we call this x minus mean square sum of squared deviations. We call it ss. We call it ss or sum of squared deviations. But sum of squared deviations means that this is x minus mean square by n. This is called ss. So you can write this as well. It is equal to ss divided by n. So instead of writing x minus mean square, you can write ss over n. So for pooled variance, what we do, we denote it like this. S square p, which means pooled variance, s square is always variance. p stands for pool. In this, you take sum of squared group one, sum of squared group two, and divide it with degrees of freedom group one and degrees of freedom group two. And we get pooled variance calculated from this. This is an example. Let me show you how to get pooled variance. So you have two groups. The first sample is n6 and ss, sum of squared deviations is 50. And the second sample is n6. And the sum of squared deviations is ss. It is 30. Individually, the two samples. How do we get the variances? Let's do it. All the information given was that we have ss group one. This is our group one. And we have ss given. How much? It is 50. And we have n1 given. So it is almost 6. Similarly, for group two, ss is given. That is, sum of squared deviation is 30. And we have n2 given. 6. So first, we get different variances. And you know variance. That is equal to ss over n. In fact, we do unbiased estimation. It is better that we do it with degrees of freedom. So sum of squared divided by degrees of freedom, which is equal to 50. Or 6 minus 1 is 5. And if we divide 5, it will come to 10. So our first group has variance 10. And if we calculate the other group's variance, this is ss n minus 1. And this will come to 30 divided by 5, which is equal to 6. So we have done these two groups. But for pooled variance, if we have to combine these two, we have told you the formula behind. We have sum of squared 1 divided by n1 minus 1 plus sum of squared 2 divided by n2 minus 1. And we will plug in the values. The value of ss is 50. And n1 minus 1 is equal to 5. And then your second group is 30. And your second group is 5, which is equal to 80 divided by 10. It is equal to 8. So you will see that in group 1, variance was 10. Group 2 was 6. But when we did pooled variance, so that is lying somewhere in the middle of the both. So when our n size is equal in both groups, i.e. group 1 may be 6, and group 2 may be 6, when we have equal sample size, usually your pooled variance lies in the middle of the two independent group 2's variance. Similarly, if our un-equal size of variance is equal to our sample size, in many cases, when we are studying, for example, married, unmarried, working, non-working, sports that do and don't do, usually our n size is not equal in both groups. When n size is not equal, and we calculate pooled variance, then it happens that usually the variance pooled value that is more tilted or closer to the one, which is a larger sample. For example, if we first do, we have two samples, one is n3, and the other is n9. If we take out both independent variance that we have taken out earlier, one and then we take out variance, two. So now our pooled variance, from the formula that we have written that will be more closer toward the group variance, which has a larger n. So our variance of this group, whose n9 is closer to it, let's do grab a copy in a pencil and calculate the pooled variance for this one, where we have unequal sample sizes in the two groups. So let me know the answer and pause the video, please. So did you calculate the answer? I'm sure, yes. And you got the right answer. The variance of group one, we have 10 and the variance of group two, we have 6. And when we have taken out the pooled variance, that actually is equal to 6.8. And what I was telling you, group two, we had its n size, which was 9. And its n size was 3. So in group two, variance 6, our pooled variance is also closer to the value of that group's variance, whose n size was bigger. So we basically have to calculate the pooled variance for the standard error. So estimating the standard error that we will do, we have its formula. So simply, we will calculate the difference of the mean one minus mean two and the pooled variance for the standard error formula. The total of your pooled variance is 1 divided by n1 and pooled variance is 2 divided by n2. Now you will ask, why the pooled variance is 1 and 2? Because you have to plug in one value in both places because you have combined them. So you will write the same value for group one and write the same value for the group two. Remember this formula is an independent sample T test and how we will calculate the difference and then the standard error of difference by putting the values for the pooled variance. So this is an example in a study of a jury behavior two samples of participants E8 each. So there are two samples. There are eight people in both samples and our n size is eight. We provided details about a trial in which the defendant was obviously guilty. Although group two received the same details as group one but the second group was also told that some evidence had been withheld from the jury by the judge. So only difference in both groups. For group one m is equal to 3 and sum of square deviation is equal to 16 and group 2 means 6 and sum of square that is 24. Is there a significant difference between the two groups in their responses? So both groups gave the same evidence but one additional information was also given. We will compare group one with group two using independent sample because both samples are independent means there are different people in the groups. Let's solve this example. So first of all we have information available. We have mean one which is equal to 3 we have sum of square deviation for group one dv which is 16 and we have n size of one which is equal to 8. Similarly for group two we have mean which is 6 and sum of square deviations group 2 is 24 and we have n2 that is also because in both groups we have 8. So first of all if you calculate variance for both the groups you can do both groups and see with the formula which I have told you sum of square one divided by n minus one and similarly you can remove the variance of the other group to sum of square of second groups divided by n2 minus one. But since I have told you that if we use pool variance that is much easier so you can do it same answer but we will put pool variance in it. The sign of variance and this is p sign and we know formula is ss1 plus ss2 divided by n1 minus one and plus n2 minus one. So you plugged in the values we have ss1 16 we have other group's deviation sum of squares 24 and this is our 7 plus 7 which makes 40 divided by 14 and it is equal to if you divide then 2.865. So our t formula is mean one minus mean two divided by variance pooled one divided by n1 plus pooled variance 2 divided by n2 and under the root so this is standard error of the difference and this is the mean difference of the two groups so you can put the values, plug in the values and then you can calculate the t value. It is important that first we have to make a null hypothesis and then we have to make alternative hypothesis. Our null hypothesis will be that mean one is equal to mean two and our alternative will be that mean one is not equal to mean two. After that we have to see the critical value of t, table value. Just like you see the value of z and in your independent sample t test after going to the table you have to see the value of t over alpha 0.05 you know this, get the table at the back of the book see the t table, look at the degrees of freedom it will be 8 plus 8 minus 2 so 16 minus 2 it is 14 so on the 14th degree of freedom you will see the value of t over alpha 0.05 so that is equal to 2.145 plus minus means that we said not equal to so that can lie on either tail. Now we have to compare the calculated value of t. Now I will plug in values mean one is 3 and mean one is 3, mean 2 is 6 divided by pool variance I have taken 8, 6 divided by how much is our n you don't have to do n minus 1 again because you have done n minus 1 here. So you have to write pool variance so you have to write n 1 which is 8 and then like this 2.86 divided by 8 and you will take the under root so when you will calculate these values it will come to 0.713 under root so that will be equal to 0.85. So 3 minus 6 is minus 3 and the answer is 0.85 so minus 3 divided by 0.85 is equal to minus 3.35 so this is our calculated value and our critical value that is 2.14 here. Now we have to see where 5 value falls so naturally it will fall here and you remember that this is a rejection region rejection region for null hypothesis so the calculated value is falling in the rejection region so we will reject the null hypothesis which means we can't say that mean 1 is equal to mean 2 we will say that there is significant difference between the ratings of group 1 and 2