Just the other week, my fiancé and I were told we were able to qualify for a mortgage. As you can expect, I’ve spent the following days excitedly searching for properties online and dreaming up interior design schemes. I’m sure most people would agree that the thought of decorating your first home is a thrilling but mildly terrifying task, as up until now all the bad interior design decisions in your home could be blamed on your parents’ poor taste.
While perusing the internet for living room paint colours, I came across the statement of ‘blue is a calming colour’.
This got me thinking, who comes up with this information? Is this just a clever marketing technique designed to encourage me to paint my entire house blue (because let’s face it, who doesn’t need a bit of calming in the midst of a global pandemic)? Or is there actually some truth to this statement? A way of testing whether this statement is likely to be true would be to use hypothesis testing.
Hypothesis testing is a statistical method that is used to determine how likely or unlikely a hypothesis is for a given sample of data.
In this post, I give a very simple introduction to hypothesis testing for those of you who may not have come across it before. I try to keep things simple, so if you want a bit more information (particularly on test statistics), I’ve left some great further reading resources at the bottom!
Let’s say that we have access to some data that was gathered to determine whether or not people find the colour blue calming.
The data we have corresponds to the following experiment: 100 people were asked to fill in a survey about how they were feeling. 50 of these people carried out the survey in a blue room, and the other 50 carried out the survey in a white room. The possible survey responses were given by calm and normal.
Let’s assume that people in the blue room have some probability p1 of choosing the calm answer, while the probability of people in the white room choosing this answer is given by some probability p2.
We can now begin our hypothesis test!
In hypothesis testing, the null hypothesis H0 describes the case that the sample observations result purely from chance. In our case, it would mean that we’d expect to see the same proportion of people feel calm in the blue room as in the white room. Looking at our probabilities, we could say the null hypothesis is given by: H0 : p1 = p2.
On the other hand, the alternative hypothesis HA describes the case that the sample observations are influenced by some non-random cause. In our example, this corresponds to the people in the blue room having a different probability of feeling calm than those in the white room: HA : p1 ≠ p2.
The general idea with hypothesis testing is that we look to see if our data provide evidence to reject H0. This is done by calculating something called a test statistic, and then looking at the probability of observing this test statistic in the case that our null hypothesis is true.
In order to see whether or not the value indicated by the null hypothesis is supported by the data, we need to set a significance level α for our hypothesis test. This is the probability that we incorrectly decide to reject the null hypothesis in the case that it is actually true! Of course, we want this to be small, so it’s usually set at 5%.
Some more definitions…
A test statistic T is a function of the data whose value we use to test a null hypothesis. It shows us how closely the data observed in our sample match the distribution that we’d expect to see if the null hypothesis were true.
The p-value of a test is the probability of observing a test statistic at least as extreme as observed, if the null hypothesis is true. This means that small p-values offer evidence against H0, because it is saying that if the null hypothesis is true, then it is very unlikely that we would’ve seen this result. Make sense?
Don’t worry if it doesn’t! If you’re new to hypothesis testing, it can be quite difficult to wrap your head around.
Let’s pause for a moment and think about what we would do in order to test our question of “Is blue a calming colour?”.
- Define our null hypothesis – “The colour blue has no effect on how calm a person feels. Or, in other words, the probability of a person choosing calm is the same, whether they are in the blue room or the white room.”
- Set our significance level – This is the probability of rejecting our null hypothesis when it is actually true. We obviously want this to be small, so α=0.05 is a good choice.
- Construct a test statistic – It’s up to you to choose what you would like to use as a test statistic. Basically, it is a function of the data that we can calculate to give a number. This could be the t-value, z-value or maybe a function of likelihood ratios.
- Calculate the p-value – This is the probability that we would’ve obtained our test statistic value if the null hypothesis is true.
- If the p-value is less than our significance level α, reject our null hypothesis – We can now say that “Blue is a calming colour!”
- If the p-value is greater than our significance level α, do not reject our null hypothesis – “We still don’t know if blue is a calming colour.”
Note that Step 6 says “do not reject our null hypothesis” and not “accept the null hypothesis”. This is important: failing to reject the null hypothesis just means that we did not provide sufficient evidence to conclude that blue is a calming colour; in other words, it still might be! But we don’t have enough evidence to say this.
So there you have it, a brief introduction to hypothesis testing! I hope you enjoyed this post and found it useful. If you want to know more about hypothesis testing, be sure to check out the further reading on this post!
Further reading …
This great blog post was written by one of my fellow STOR-i students, and it explains hypothesis testing in a bit more detail, for those of you looking to carry out your own hypothesis tests.
This post gives some great examples of simple hypothesis tests, to help get you started.