p-value In Statistics?

Alex Duncan
Clarusway
Published in
5 min readDec 22, 2020
Photo by CDC on Unsplash

What exactly is a p-value?

The p-value tells you how likely it is that your data could have occurred under the null hypothesis. It does this by calculating your test statistic’s likelihood, which is the number calculated by a statistical test using your data.

The p-value tells you how often you would expect to see a test statistic as extreme or more extreme than the one calculated by your statistical test if the null hypothesis of that test was true. The p-value gets smaller as the test statistic calculated from your data gets further away from the range of test statistics predicted by the null hypothesis.

The p-value is a proportion: if your p-value is 0.05, that means that 5% of the time, you would see a test statistic at least as extreme as the one you found if the null hypothesis was true.

What are null and alternative hypotheses?

The null and alternative hypotheses are two mutually exclusive statements about a population. A hypothesis test uses sample data to determine whether to reject the null hypothesis.

Null hypothesis (H0)The null hypothesis states that a population parameter is equal to a hypothesized value. The null hypothesis is often an initial claim that is based on previous analyses or specialized knowledge. Alternative Hypothesis (H1)The alternative hypothesis states that a population parameter is smaller, greater, or different than the hypothesized value in the null hypothesis. The alternative hypothesis is what you might believe to be true or hope to prove true.

I know you always confuse p-value, so many of you don’t exactly understand what it means. Let’s use an example and understand the meaning of p-value step by step.

Imagine that you have two drugs and you are trying to find the best drug to cure coronavirus. You should do some tests and find the best alternative.

Photo by Kate Hliznitsova on Unsplash

Let’s make some tests to find the best drug for coronavirus and understand the p-value meaning.

Test 1:
You will give one Drug to each person in the test.

  • İmagine that you have two drugs and you want to know if Drug-1 is different from Drug-2. So you are giving Drug-1 to one person and Drug-2 to the other person.
  • İmagine that one person that is using Drug-1 is cured and the other person that is using Drug-2 is not cured.

Can we conclude that Drug-1 is better than Drug-2?

  • No. Maybe this guy is taking a medication that has a bad interaction with Drug-2. Maybe this guy did not use the Drug-2 properly.
  • Maybe Drug-1 doesn’t actually work and the placebo effect got the successful result.
  • There might be a lot of random things when doing a test and this means we need to test each drug on more than the two-person.

Test 2:
This time we will give each drug to 2 different people.

  • The two-person who is taking Drug-1 is cured.
  • One of the two-person who is taking Drug-2 is not cured and another one is cured.

Can we conclude that;
* Drug-1 is better than Drug-2?
* Are both drugs the same?

  • We can’t answer both of those questions because maybe something weird happened to these guys. Maybe for that reason, Drug-2 is failed.
  • Maybe one of the two guys that are being cured actually made a mistake and took Drug-1 instead of Drug-2 and nobody knew that.

Test 3:
And now we will test the Drugs on a lot of different people.

These are the results:

  • Drug-1 cured so many (1.043) people compared to the number of people it didn’t cure(3).
  • We can say 99.71 % of the 1046 people using Drug-1 were cured.
  • Drug-2 is just cured few (2) people compared to the number of people it didn’t cure (1042).
  • We can say only 0.001 % of the 1432 people using Drug-2 were cured.

We can conclude that it is obvious Drug-1 is better than Drug-2. We can not definitely say that results are unrealistic and random.

What can we conclude about these results that are shown below?

  • Now only 37 % of the people that took Drug-1 are cured.
  • Only 29 % of people were that took Drug-2 are cured.
  • We can see that Drug-1 cured a larger percentage of people.
  • But we can say that no study is perfect and there are always a few random things that happen,how confident can we be that Drug-1 is superior?

Booom that is the point that is where the p-value comes in. P-values are numbers between 0 and 1 that in our example quantify how confident we should be that Drug-1 is different from Drug-2.

  • The closer a p-value is to 0, the more confidence we have that Drug-1 and Drug-2 are different. So we should find the answer that “how small does a p-value have to be before we are sufficiently confident that Drug-1 is different from Drug-2? What threshold can we use to make a decision?
  • In practice, a commonly used threshold is 0.05. It means that if there is no difference between Drug-1 and Drug-2, and if we did this exact same experiment a bunch of times, then only 5 % of those experiments would result in the wrong decision.

Wrap

I have clarified the concept of the p-value, which is one of the important issues in statistics, with the help of a practical example.

Hopefully, this overview has helped you better understand the p-value. I also hope it has also opened your eyes to the value of metaphors in understanding the statistics.

If you found this helpful please share it on your favorite social media so other people can find it, too.

If that’s interesting for you, read and follow me on Medium.

References

StatQuest with Josh Starmer: YouTube Channel.

--

--

Alex Duncan
Clarusway

Human, AWS/DevOps Expert, Writer, Reader, Researcher, Traveler