What is Hypothesis testing?

You’re probably familiar with testing hypothesizes from grade school, where we learned that:

  • A hypothesis is a testable question, with dependent and independent testing
  • The point of an experiment is to prove or disprove a hypothesis
  • Proving your hypothesis wrong does not invalidate your experiment

In statistics, we further build upon this base understanding of hypothesis to implore Hypothesis Testing.

Formally, Hypthesis Testing is a statistical test to draw conclusions from one or two populations of data.

Let’s break down the different parts of a Hypothesis Test next.

Parts of Hypothesis Testing

In Hypothesis testing, we actually have two hypothesizes the Null Hypothesis and the Alternate Hypothesis.

Additionally, we also have a p-value, commonly known as a probability value, which is used in the test to compare against the Null and Alternate Hypothesis.

When answering a hypothesis test, we would create a Null and Alternate Hypothesis like so:

\(H_o : \mu_a \ge \mu_b\) \(H_a : \mu_a < \mu_b\)

Here we can see that the Alternate Hypothesis is merely the opposite of the Null Hypothesis.

In fact, in Hypothesis testing, we are actually attempting to disprove the Null, rather than prove the Null.

Why are we proving the opposite??

We disprove the Null because it is easier to prove that something is false, rather than something to be true.

For example, in the histogram below, we would like to prove if there are 20 or more data values are above the mean

To then prove this, we would create a \(H_o\) = 20 data values above the mean, and a \(H_a\) = less than 20 values below the mean

In this case, if we prove the alternate false, we would prove the Null to be true. You can think of this similar to a proof my contradiction.

m = mean(temp)
numG = length(temp[temp < m])
m
## [1] 5.3
numG
## [1] 19

From this, we can see that the alternate is false, thus proving that the Null Hypothesis must be true

Another example, on a similar scale would be the following graph:

We could ask ourselves if there appears to be a statistically significant linear relationship between X and Y

In this case, we would create

  • \(H_o\) : there is no linear relationship
  • \(H_a\) : there is a linear relationship

Then, from the line of least regression, we can see that there does appear to be a statistically significant linear relationship between X and Y. This allows us to reject the \(H_o\) : there is no linear relationship; thereby accepting the alternate.

Similarly, in this example we can create a dataset of two different classes, and their averages on a math test. We would test if there was a statstically significant difference between the two classes.

  • \(H_o : \mu_a \ne \mu_b\)
  • \(H_a : \mu_a = \mu_b\)

Closing Thoughts

The act of Hypothesis testing is similar to the basis of hypothesizes in general. For many students, it is difficult to understand that to prove your test true, we in fact have to prove the opposite false. However, once you can understand how and why Hypothesis testing does work, you can become a better statistician.