0:09

And so we get to the t-test.

Let's start with that.

Now, examples of a t-test are really ubiquitous in the medical literature.

Almost every journal article that you're going to read,

you are going to find some form of a t-test.

Now, t-tests, the most common one of all of those would be student's t-test,

and you might wonder who this student person was.

Well, his actual name was William Gosset, and he worked for

the Guinness Brewing Company.

And he was quite interested in doing statistical analysis on small samples.

Up until that time, people were very concerned about large samples, so for

instance, in shipping or agriculture.

He was more concerned about small samples.

Unfortunately, working there, he wanted to publish as well,

wanted to publish his work.

But he couldn't do that because it wasn't allowed.

Apparently, at that time, some other companies had some of their secrets let

out by their workers publishing some of their work.

So they refused, for anyone who worked for them, to publish.

He convinced them though that what he was working on was not so critical to them,

will not lead the company to let out some secrets.

And eventually they relented.

But they said he had to publish under a pseudonym.

And he chose student.

From there we have student's t-test.

Now student's t-test is not the only t-test, but

as a group with the t-tests, we have to keep certain things in mind.

Now the variable data points that we are working from

will have to come from two separate groups.

So we are comparing the means of two groups.

The actual data point, the actual data point values in those two groups for

whatever variable whether it be white cell count, whatever the example might be.

They've got to be numerical data types of course.

Ratio data types, we've spoken about those.

2:49

More importantly, specifically for

student's t-test, we also have to have equal variances.

Remember, we can work out the mean for each group.

But we can also work out the standard deviation, or

the square of that which is the variance.

The average distance, the average difference between each value and

the mean, they've got to be roughly equal.

Now, there's not an absolute rule of how different the variances can be.

But you have to look at the sizes and

whatever's at hand with that specific data to make a judgement call,

whether those variances are equal enough for you to use student's t-test.

We also have to have unpaired groups.

So the individuals in the one group must be independent from individuals

in the other group, cannot be the same individuals in both groups.

Or they cannot be connected or dependent on each other in any way.

Now some of these aspects I really want to go delve in a bit deeper.

Most importantly the data points coming from a population

parameter which has a normal distribution.

So, if you look at the data from a sample, remember that's a sample from

a population, how would you know all you have is that set of sample data points?

How can you know that they come from a population parameter that is

normally distributed?

Well, one thing you could do is just to make a histogram of the data values for

each group that you have.

And if they form a normal distribution, as we see there,

there's a density estimate plot there.

And we can see there's a rough normal distribution to it.

That would be one way to be relatively sure that these data points do come from

a population parameter that has a normal distribution.

And I can probably use a student's t-test under these circumstances.

A better way perhaps to do it is what is called a q-q plot,

the q standing for quantile.

We've got to do certain things there.

You're going to see a plot.

You're going see a red line, and some blue dots.

Now the red line will just represent a line that absolutely proves that something

is from a normal distribution,

a really straight line that goes from the left bottom to the right top.

The blue dots that you see though, that takes each individual value,

and it plots its quantile.

Now the quantile is the percentage of values that are less than that specific

value.

Do you see the red line there?

If all the blue dots fell exactly on that line,

there'd be a very good indication that that sample data

points come from a population parameter that has a normal distribution.

So each individual blue dot is one of the values from a group.

Now you've got to do it for

each group because they both have to come from a normal distribution.

And each one of them is plotted against their quantile,

the percentage of values that are less than that value.

And you can see these blue dots very nearly follow that red line.

So, we can assume that these data points for this sample set does come from

a population parameter that has a normal distribution.

Hence, we can use Student's t-test.

Now, if they do not do that, if it does not come from,

if you see that those blue dots are all over the show with a q-q plot,

then you can not use a parametric t-test.

Then we have to look at non-parametric t-tests.

And that's why it's important to look in the methods section

of any journal article.

Do they talk about these things?

It would be even better if we all had access to the data that

was actually used for that analysis, so we can see for

ourselves whether it was appropriate to use a parametric test.

Now another important point of the assumptions that we

make with student's t-test is this equal variances.

Now as I said, there isn't an absolute character for

how different the variance between the two groups have to be.

But you do see unequal variances or

something that must highlight the fact that you might be dealing with unequal

variances that are of such a large extent that you can't use student's t-test.

But you have to use another t-test.

It's usually when the data values have some skewness to that data.

And it's also regularly seen when the sample data numbers are quite small,

when you only have a few patients or participants in each group.

Then you have to have another type of t-test, and

you've seen an example of this.

You also have a distribution there that is quite skewed,

with the tail going off to the right.

7:21

topic to talk about when using student's t-test though is also the paired samples.

If those two samples of the two participants and

the two groups, if they have any,

if they're dependent on each other in any way, you cannot use student's t-test.

You have to use a paired t-test.

Now, when are they paired in some way?

When are they dependent on each other?

The most common example would be monozygotic or identical twins.

If you have identical twins in each group, they are dependent on each other.

Those results are not independent of each other for those two groups.

And also when we have samples where we take a measurement for

some variable in a sample before and after some event.

So we would take the values, there would be some intervention.

And then the same individuals would take the same test again, and

we compare those two tests.

Definitely each set of those values would come from the same individual, and

you cannot use student's t-test.

Now, what do we want from this t-test?

We want the probability, the p-value.

The sample values for your two groups come from different populations.

There's some quintessential difference between the populations

to which these two sample groups are, are inferring, or come from.

8:41

The assumptions that we've talked about until now are not met.

Student's t-tests is invalid.

You cannot believe the p-value that comes from it.

You have to look at the others, whether it be unequal variance t-test,

whether it be paired variable t-tests, or whether it be non-parametric tests.

You've got to consider all of these assumptions when you use student's t-test.

Now when we spoke about hypothesis, we spoke about the one or two-tail test.

Remember that comes before any data collection or any analysis.

I'm gonna run you through what happens step by step with both of these so

you have a good, intuitive understanding of what is really happening.

So we are going to calculate the mean of each group and

the difference between the mean.

So we'll have the means for group one, the mean of group two.

All the assumptions are met.

And we just subtract one from the other, so the difference between those two means.

10:11

When we have that graph,

depending on the degrees of freedom, remember it's sample size, which for

student's t-test is two, subtracted from the total number of participants.

So we have 30 in one group, 30 in the other group.

That's 60 participants minus 2 for 2 groups, and

degrees of freedom would be 58.

Now once we have that little graph, the computer or

the mathematics will work out how many standard errors away from

the mean we have to be such that we have an area under the curve

at 0.05 if we chose 0.05 as our level of significance.

So that is called the critical t-value.

The critical t-value is a line somewhere on your graph that says so

many standard errors away from the mean would represent a value that if we

are larger or smaller than that, we will have an area under the curve of 5%,

again, if 0.05 was what we had.

So look at the graph.

You can see it beautifully there.

This was a one-tail t-test that we are doing.

We are suggesting that one groups will have a value more than the other,

that was our alternative hypothesis.

So again, the line is going to be drawn that is so

many standard errors away from the mean you have to be so that the area under

the curve towards positive infinity there would represent an area of 0.05.

Now this graph's obviously not to scale.

But that is the critical t-value, so many standard errors away from the mean.

11:45

That's called the t-value.

Now that t-value is compared to the t-critical value, the one we've just

spoken about that would represent 0.05 of the area under the curve,

that fraction of the area under the curve.

This t-value, so many standard errors away from the mean that the difference in means

are, is now going to fall on either side of that line.

If it falls within the shaded area, well we know,

it was unlikely to have be, to have found that difference in means.

It is going to be statistically significant of p-value of less than 0.05.

The t-value was now on that side, further away than the critical t-value.

And there we see the two examples, the orange line still in the middle,

which still represents how many standard errors away from the mean would represent

an area under the curve of 0.05.

But look at the red line.

That t-value is so many standard areas away from the mean that the difference in

the means of the two groups are, falls outside of that shaded area.

The t-value is on the one side of our critical line.

Look at the blue line though, that falls within the shaded area.

That t-value is larger than the t-critical value.

Now remember this is just on the one side.

So in your mind's eye just reflect it on the other side because our alternative

hypothesis might have stated that one group will have a value less than

the other group.

So we're talking negative values.

So if you want statistical significance there,

the t-value has got to be less than the critical value on this side.

It's more than.

But you can clearly see all we're doing is converting the difference of means

to so many standard errors away from the mean.

And that's gonna fall somewhere on that curve.

13:30

Now what I've done there, I've kept the blue and

the red line on the positive sides.

It's exactly in the same spot.

Now, once again, it's not to scale, so just for illustrative purposes.

But imagine the red and the blue lines in exactly the same spot.

But what we have now done, we've moved the goal posts with a two tail t-test.

We have said that we still want an area of 0.05 under the curve, but

in our alternative hypothesis, it might be more or better.

So we only have 2.5%, 0.025 of a fraction under the curve on both sides.

That means we have to move further away our critical t-value,

which would represent an area under the curve of 0.025 Is now further away.

You can well imagine that than if it was just a one tail test.

So, if we look there at our blue line,

before it fell in that shaded area, now it does not because that goalpost had moved.

So, now we don't have, for that same difference in mean,

exact same standard errors away from the mean, we do not fall in that shaded area.

And the p-value is actually double.

Because if you have the blue line on one side with that type of alternate

hypothesis, you've gotta reflect it on the other side as well and

work out the area under the curve from both sides of the blue line out.

So your p-value for two tail test is twice as much as the p-value for one.

So you can see how critically important this is.

You can really go from a non-statistical p-value to a statistical p-value

just by changing the way that you state your alternate hypothesis.

That is why it is so important to do that before any analysis is done.