Let's build up the test statistic for one-way analysis of variance so recall
we were working with this example comparing the weight loss on one of four
diets A B C or D and we can see the observations here as well as the summary
statistics the mean weight loss and standard deviation of weight loss for
each of the four diets, we're working with this null assuming that all means are
equal and an alternative at least one differs from the rest. We previously
talked about how we can take the total variability in weight loss or the total
sum of squares and separate it into two parts that which is explained by the
diet and that which is not explained by the diet, so let's look at how we can use
that to build up the test statistic: first just a quick note on notation and
again we want to focus on the concepts not on plugging into formulas but this
helps us with understanding the formula and what's written in the notation so i is
used to index the group: Group one two three or four k is to signify the
number of groups J is used to represent the observation number within a group
Yij tells us the individual observations in group i, observation number j, so for
example Y1,3 is the observed value for Group 1 person number 3
Yi-bar is the mean for group i, Y-bar with no subscript is the overall or grand
mean: the mean weight loss for everyone in the study; Si is the standard
deviation for people in the group i, and ni is the sample size for people in
group i, so we saw that we can take the total variability and separate it into two
parts that which is explained by diet and that we signified as the variance
between diets or sometimes called the mean square between and that was the sum
of squares between divided by its degrees of freedom
the degrees of freedom between groups and looking at the formula and again we don't want to
get stuck on this but this helps us see the concepts we just learned from a
slightly different angle you can think of this as we're going to sum over all the
groups so Group one two three four what's the sample size in each group and
how far is the group specific mean from the overall mean squared divided by its
degrees of freedom if we work that out for example we'd find that the sum of
squares between groups or the explained sum of squares it's 97.3
degrees of freedom 3 right four groups minus one and that's going
to come out to 32.4t, we also saw we can think of the unexplained
and again this is the variability that's not explained by diet or not explained
by X, this is the variability going on within a group or the mean square within
and again this is the sum of squares within groups divided by the degrees of
freedom within and formulaically we can think of summing over all observations
how far is each individual from their group specific mean square divided by
three degrees of freedom. Right again we have n observations and
we lose K degrees of freedom by estimating the K group means, we can also
express this as summing over the groups
each group sample size minus one times the variance the
sample variance of each group divided by its degrees of freedom and the reason
why I write it this way is you can take a moment yourself to note that this here
is the exact formula for the pooled variance that we talked about in the two
sample t-test assuming equal variance in the two groups we're taking a the sample
variance of each group weighted by their degrees of freedom. okay so you can take
a moment yourself to work your way through and convince yourself that this
within group variance is the exact same as the pooled variance in the two sample
t-test assuming equal variance if you work this out for example you're going
to find the sum of squares within a group is 297 its degrees of freedom 56
and this comes out to be 5.3 so as noted we want to compare these two to each
other the mean square between groups to the mean square within groups and
the average sum of squares that can be explained by diet the average sum of
squares that cannot be explained by diet so let's try and think our way through
some stuff first suppose if the alternative hypothesis is true if at
least one mean differs if not all the means are the same how would we expect
statistically how we expect the mean squares between groups to compare to the
mean square within group if diets are different we'd expect this one should be
larger than this okay there should be much more variability that's explained
by diet than not explained by diet if we take a ratio of these and this is going
to be what we call our F statistic and or our test statistic
it's a mean squared between groups over the mean square within groups if we
expect the top to be larger than the bottom we expect this test statistic to
be larger than 1, if on the other hand our null hypothesis is
true if all the means are equal at the population level what would we expect to
see we'd expect the mean squares between, okay the variability that's explained by
diet, to be roughly the same as the mean square within or the variability that's
not explained by diet when looking at an F statistic you're taking the ratio of
these two we'd expect that to come out to be roughly 1 if we do this for our
set of data our F statistic 32.4 over the 5.3 that's going to come out to be
6.1 okay so the larger our F statistic gets the more evidence we have that the
alternative is likely true or the null is false well we don't want to get too
caught up on looking things up in tables it's important to note that this F
statistic follows what's called an F distribution it has degrees of freedom
for the numerator and degrees of freedom for the denominator so it has degrees of
freedom for the numerator which are K minus 1 right those are the degrees of
freedom of what's in the numerator and has degrees of freedom for the
denominator n-k, ok so again piece of software can do all these
calculations for you we don't want to focus on an F table and looking up an
exact p-value from that table so let's just jump to the interpretation
if we were going to work this out looking at a table or using a piece of
software p value is going to tell us like it always does what's the
probability of our observed test statistic or one even more extreme if the
null is true and we'd expect it to be 1 so what's the probability of getting an
F stat greater or equal to 6.1 if it should
be roughly equal to 1 if our null is true we'd expect our test that to be
roughly 1, what's the chance of seeing an estimate of 6.1 or more
you'll find that this comes out to 0.0011
okay roughly 0.1 percent so again if our null is true if all these diets are the
same the chance of seeing an F stat like this or the differences we saw or even
larger is only going to happen about 0.1 percent of the time that gives us
evidence to reject our null hypothesis we have evidence to believe the
alternative is likely true we have evidence to believe at least one diet
differs from the rest so now we need to decide which diets might differ from the
others and to do that we're going to compare all possible pairwise means
that's a topic we're going to get to talking about in a moment
Thanks! for more videos please subscribe to marinstatslectures