You are on page 1of 18

Open in app

Center for Academic


Program Support
Center for Academic Program Support (CAPS) is the University of New Mexico's learning
assistance center for undergraduate students
caps.unm.edu

POSTS LIKES ASK CAPS OUR SERVICES ALGEBRA BIOLOGY CALCULUS CHEMISTRY PHYSICS

What in the World is ANOVA?


Analysis of Variance
by Jared DiDomenico, CAPS Statistics Tutor

What on Earth is ANOVA?

One of the more advanced topics that undergraduate students may


start to encounter is the analysis of variance (ANOVA) statistical
procedure. Usually students are pretty apt at understanding the t-
tests and their procedures, but ANOVA is a bit different. To put it
simply, it’s when you want to compare the means of two samples
and see if they differ. But what happens if you have more than two
groups? What if we are curious about more than one type of factor
(e.g. sex, education, etc.)? Then we use the ANOVA model.

Wikipedia defines ANOVA as, “… a collection of statistical models


used to analyze the differences among group means and their
associated procedures (such as “variation” among and between
groups).” That’s quite a mouthful. Essentially, it means we can
examine the means of various groups by comparing the variation
that we could expect to find naturally between the groups and within
Get the Tumblr app 
the groups. Let’s think about that.
Source

Variation is something that is always going to be a part of data that


consists of random variables. We are all familiar with the normal
distribution. Height is an example of something that is normally
distributed. This is saying that people in a population will have
different heights at various frequencies (i.e. tall people occur less
often than people of average height) that can be distributed like a bell
curve. If we wanted to examine something like height from an
ANOVA point of view it would kind of look like this:

EXAMPLE #1
Source

Are the heights between the various university sports teams different
from one another? Let’s examine the heights of all the soccer,
basketball, and football players at UNM (for the sake of this example,
data will be made up). We found that the average heights of the
soccer players were 70 inches, the football players were 72 inches,
and the basketball players were 75 inches. Oh look, they aren’t equal
therefore they are different! If anyone has had any statistics classes
they know that this isn’t necessarily true because there is natural
variation that may have just made our samples different. ANOVA is
aimed at seeing if the means of heights in these groups are different
and this can be understood if the variation that is present within the
soccer players, within the football players, and within the basketball
players is different than the variation between the all of the players.

Are the Means Different?

Like any statistical test, we have to have a null hypothesis and an


alternative hypothesis. The null hypothesis the hypothesis we
assume to be true. Null is usually synonymous with nothing, thus the
null hypothesis is no effect. An alternative hypothesis is something
that is different from null and cannot occur if the null is true. If the
null is no effect, then something mutually exclusive is that there is an
effect. Both can’t happen at the same time.

Now, specifically for ANOVA, our null hypothesis is all the group
means are the same, or no difference.
The alternative is the opposite, or the compliment in probability, that
at least one mean differs from the others. The easiest notation for
this is:

To calculate whether or not there are any differences you need to


know a few things…

Sums of Squares

Source

Sums of Squares are a measure of variability within our data. The


total sums of squares is a measure of all the variability that is present
within our model. (Note: I am going to start calling this ANOVA a
model, because that’s what it is, its predicting a response knowing
information from what group the response was in, plus a little error).
This is a simple, yet tedious calculation, and is as follows:

SSTO (total sums of squares)

Essentially this is saying take the ith value from jth group, subtract the
grand mean of the responses from it, square it, and then add it all up
using every point in every group.

If we were do some mathematical proofs, we could figure out how to


split up the total variation to show the variation between the groups
and the variation within the groups. Essentially they are calculated as
follows:

SSTR (treatment sums of squares,sometimes called between)

SSE (sums of squares of error, sometimes called within)


This shows us that, SSTO = SSTR +SSE. So it will be easier to solve
two of them then use that information to solve the other. At the end
of this I will include an example to illustrate the calculations.

The ANOVA Table


We can organize all the needed information by creating an ANOVA
table. The general One-Way ANOVA table is below:

The table above shows how to use the sums of squares and
information from the group sizes to be able to calculate an F-
statistic called F*.

Once we know F* we can compare it to the F-distribution to find a p-


value. First we need a level of confidence, the degrees of freedom for
the treatment and the degrees of freedom for the error to find the
critical F. Thus,

If F* > F(0.95, degrees of freedom for treatment, degrees of freedom


for error), we will reject the null hypothesis and conclude the
alternative.

If F* < F(0.95, degrees of freedom for treatment, degrees of freedom


for error), we will fail to reject the null hypothesis.
From here you interpret you results. If you rejected the null then you
know that there is at least one group or treatment mean that differs
from the others. If you fail to reject the null hypothesis then all the
group means are equal. Just be sure to tell what that means in
context of the problems.

AND THAT’S IT FOR ANOVA.

Usually this test is followed by what are called multiple comparisons,


if one rejects the null. If the null hypothesis was not rejected then you
are finished. Multiple comparisons will be the subject of future blogs.

FULL EXAMPLE
The following are generated data following sports example
mentioned previously:

1) State Your Hypotheses


The null hypothesis is that all the teams have the same mean height:

The alternative is that at least one sports team differs in mean


height:

2) Calculation of Sums of Square


SSTO (total sums of squares)

SSTO =(69-72.33)^2+(72-72.33)^2+ …+ (79-72.33)^2+ (76-


72.33)^2=270.7

SSTR (treatment sums of squares, sometimes called between)


SSTR = 10*(70-72.33)^2+(10*(72-72.33))^2+10*(75-
72.33)^2=126.7

SSE (sums of squares of error, sometimes called within)

… …
SSE = (69-70)^2+ +(69-70)^2+(74-72)^2+ +(67-72)^2+ (76-

75)^2+ + (76-75)^2=144

Notice -> SSTO = SSTR + SSE = 126.7 + 144 = 270.7

3) Create the ANOVA Table

4) Decision
If F* > F(0.95, 2, 27), we will reject the null hypothesis and conclude
the alternative.

If F* < F(0.95, 2, 27), we will fail to reject the null hypothesis.

We need to find F(0.95, 2, 27). Using a table, or program, we find that


F(0.95, 2, 27) = 3.354.

Because F* = 11.88 > 3.354 = F(0.95, 2, 27), we reject the null


hypothesis that the group means are equal and go with the
alternative.

5) Conclusion
Because we rejected the null hypothesis, we conclude the alternative:
At least one team has a mean height different than another.
To figure out which one, we must perform multiple comparisons, the
subject of a different blog.

Source

#capsunm #caps #unm #STEM Mondays #math #statistics


#variance #graphs #lobos #basketball #learning #calculating
#null hypothesis #alternate hypothesis #ANOVA

2 notes May 4th, 2016

MORE YOU MIGHT LIKE

NEW Math Resources, Online


and Drop-In

Do your math classes already have you stressing out? Just relax and
REFRESH!
The purpose of the Math Refresh page on CAPS’ website is to assist
students in their math classes when CAPS isn’t always available. The
Refresher has over 10 links to different pages and websites devoted
to various math topics ranging from exponents, logarithms,
quadratics, and much more. Example problems are also available at
the bottom of each page to help students study for tests.

To go straight to the Math Refresh page, click here!

Also new this semester is CAPS’ policy towards what’s actually


tutored in the drop-in lab. In the past, CAPS had a list of classes
offered for tutoring and you had to be in one of those classes to be
tutored. Now, tutoring is based on content. This means that if your
psychology class uses statistics or your statics class uses physics
you are welcome to come on in for tutoring! Don’t be afraid to take
advantage of this wonderful change and all of the other resources
CAPS has to offer.

To learn more about the times, locations, and subjects CAPS offers,
visit our webpage or come in to the 3rd floor of Zimmerman Library.

#capsunm #caps #unm #STEM Mondays #stem #science #math


#tutoring #learning #learning center #online #online learning #new
#CAPS services

1 note

Hypothesis Testing
by Jared DiDomenico, CAPS Statistics Tutor

Have you ever been really sure something in the real world works a
particular way, but you didn’t know if you were right? Have you ever
wondered what it means for something to be “statistically
significant?” Because of hypothesis testing we are able to say, with
some degree of certainty that the world likely works in some way.
The best way for understanding reality – science – works because of
the logic of this statistical procedure.
Source: xkcd

If you’re familiar with the nuts and bolts of hypothesis testing and
are just interested in some concrete examples please skip to the
examples below.

Essentially, hypothesis testing is proposing two likely explanations to


some problem or pattern in a data set that are mutually exclusive
from one another. Mutually exclusive is just a fancy way of saying
two things that can’t happen at the same time. For instance, I am
either a human, or not a human. I cannot be both. So these two
categories of what I am are mutually exclusive from one another.
Source: CodinginParadise

When we examine things using statistics, we are looking for


differences or patterns in these samples or data. We propose our
explanation for what could be happening. “Well maybe there is an

effect of my drug,” or, “maybe humans do find coffee delicious.” But


when we have an explanation we need to compare it to something,
something that we must assume is true. We call this our null
hypothesis, Ho. A null hypothesis is an explanation that we assume
to be true, such that our data will either support or disprove it. Given
it is “null” we likely make it something along the lines of NO effect, or
NO difference. That proposed explanation we had developed earlier
is what we refer to as our alternative hypothesis, Ha or a hypothesis
that usually is an effect or saying there is a difference. These
hypotheses must be mutually exclusive! How do we know which one
is right?

Source: PRWatch

Let me ask you a question. Say I flip a coin and it lands up on heads
10 consecutive times. Would you think this is a fair coin? Maybe. But
to a statistician, this event is so unlikely that they would say it is
probably not due to chance but that something was affecting it (i.e.
poor flipping, an unfair coin, etc.). We, in very similar manner, do the
same thing with our null hypothesis and alternative hypothesis.

BONUS – What is the null and alternative hypothesis in the coin


example??

Source: TheGraceCommunity

So let’s bring everything together. We proposed two mutually


exclusive hypotheses regarding our data, the null being NO effect,
and the alternative being there IS an effect. We use that null
hypothesis as an assumption – we assume it is true. We calculate a
probability (usually referred to as a p-value) using the various tests
you’ll learn about. This p-value is the probability you got the results of
your data, given that your null hypothesis was true. We compare that
p-value to an alpha (α) value. The α value is the probability that you
believe is so small that you no longer expect the outcome to occur by
chance alone. In our case, the golden standard is 0.05. In other
words, we think that something that occurs 1 out of 20 times is a
little fishy. If our p-value is larger than alpha (p-value > α) then we say
that because of the probability we found  for results being as
extreme as we have, assuming our null is true, we FAIL to reject the
null hypothesis. If our p-value is smaller than alpha (p-value < α) then
we conclude that our data suggest the effect we found was not due
by chance, and that we shouldn’t accept the null hypothesis as our
explanation. Instead, we REJECT the null hypothesis and conclude
that we have evidence for our alternative hypothesis. All of this is
very abstract, so let’s examine the logic of this using some real
examples – in court, and in cases of cancer.
Source: MoviePilot

Examples
Example #1

Source: Netflix screenshot


*** This example works best if read with a southern accent***

ORDER IN THE COURT! Judge H.P Test here to conclude this trial.
We have our defendant, Caleb Crawdad, being accused of
MURDER! Now this man is innocent until proven guilty in MY
COURT OF LAW. We have seen the prosecution’s evidence
regarding the likeliness of the defendant committing such a
heinous crime. But we have heard such a probable alibi by the
defendant. JURY, have you made your decision?

Yes your honor.

WELL??!

We find the defendant guilty!

Source: Netflix screenshot

In this poor attempt to mimic a southern courtroom, we see a


wonderful demonstration of the logic of the hypothesis test. Here we
see our null hypothesis is innocence until proven guilty (no crime
committed). We believe that Caleb Crawdad murdered someone
(crime was committed), so we propose this as an alternative
hypothesis. The process of presenting the data during the trial is
analogous to the statistical tests we perform to find our p-value. The
jury compares this evidence to some standard they believe is enough
to suggest guilt (alpha). After their comparison they make their
decision. In our case we rejected the null hypothesis (innocence) and
concluded that he was a murderer (guilty).

Example #2

“We have your results Mr. White. It turns out that you have cancer.”
This something none of us wish to hear. Hearing it could make us
break bad. So we must be certain with our diagnoses. So in order to
find out if someone has cancer we use hypothesis testing. Let’s
make the assumption Mr. White does not have cancer (assuming
something should be a dead giveaway that this is your null). We
propose that Mr. White does have cancer as an alternative. After a
CAT scan we find out if he does or doesn’t- we are presented
evidence in some fashion. However, sometimes we misread the
scan, the equipment malfunctions, etc., and we make a wrong
conclusion. Let’s look at the decisions in turn.
Source: EnhancedLearning

Let’s assume Mr. White doesn’t have cancer (null hypothesis). Our
alternative is that he does. Let’s also pretend we are omniscient and
know with 100% certainty the actual reality of his body. Two
conclusions we can have are right and two are wrong. (1) Let’s say
we conclude Mr. White does have cancer (reject the null) and in
reality he actually does have cancer (the null is false). We’ve made a
correct decision. (2) Let’s say we conclude he does not have cancer
(fail to reject the null) and he does not have cancer. We are correct
again. (3) What if we conclude he does have cancer (reject the null)
and he does not have cancer (null is true)? We’re wrong. In medicine
this is called a false positive (we think he is positive for cancer and
we are incorrect), and is a Type I error in statistics. But what if we
conclude he does not have cancer (fail to reject the null) and he does
have cancer (null is false)? Then we’re wrong again. In medicine this
is called a false negative (we think he is negative for cancer and are
incorrect), and called a Type II error in statistics. The table below
summarizes these errors.

Source: InFocus

So even though hypothesis testing is a very powerful tool for


statisticians, the conclusions we make may be incorrect. If we
flipped the coin ten times and it lands on heads for every flip, we may
conclude that it’s so unlikely that we would get that many heads that
we probably have an unfair coin. But sometimes these rare outcomes
DO occur. Sometimes we are wrong.
Source: Wordpress
This concludes our broadcast day.

Source: Wikipedia

#capsunm #caps #unm #hypothesis #testing #statistics


#STEM Mondays #STEM #The Office #Avengers #learning

See capsunm's whole Tumblr

You might also like