Nikhil.M
3 min readMar 29, 2021

Hypothesis testing simplified.(Probability and Statistics)

Hypothesis testing in probability and statistics is often confusing and it’s little hard to grasp. In this blog ,I will take a simple example of tossing a biased coin to explain hypothesis testing.

What is hypothesis?

A hypothesis is an educated guess about something in the world around you. It should be testable, either by experiment or observation.

For example:

Making a statement like

  • “Effectiveness of a new drug is better than existing drug.”
  • “If I eat more vegetables, then I will lose weight faster.”

Alright let’s get started with our experiment.

Objective: Given a coin let’s determine if the is biased towards head or not.

Probability of biased coin towards head>0.5. Where as for a normal coin it is equal to 0.5.Let’s flip a the coin 5 times and count the number of heads.

Let x be count of heads, Here x is called “Test statistic”. Because this is the observation of our experiment to determine whether the coin is biased towards head or not.

Lets say we tossed the coin 5 times and got the following result.

Flip 1 →Head.

Flip 2 →Head.

Flip 3→Head.

Flip 4→Head.

Flip 5→Head.

In the following experiment we got five heads after tossing the coin 5 times. This is the ground truth, Since it is the result of our experiment.

This is our observation.

PROOF BY CONTRADICTION

Null hypothesis(Ho):

From the above experiment we can vaguely determine the coin is biased towards head. However ,we need to prove this .Hence ,we make an assumption that the coin is not biased, this assumption is called Null hypothesis.

Alternative hypothesis(H1):

Alternative native hypothesis is something which can taken as result. If our null hypothesis fails.

In this alternative hypothesis is :”The coin is biased towards heads”.

Proving the hypothesis

Let’s try to prove the null hypothesis .ie: “The coin is not biased”.

If that’s the case then, probability of getting heads in an unbiased coin is 0.5.If we toss the unbiased coin 5 times the probability is,

P(x=5/Ho):

Toss 1→1/2

Toss 2→ 1/2

Toss 3→ 1/2

Toss 4→ 1/2

Toss 5→ 1/2

There fore, P(x=5/Ho)=1/2 *1/2 *1/2 *1/2 *1/2 =1/32=>0.03.

P(x=5/Ho)=3%.

There is 3% chance of getting 5 heads in 5 tosses .if the coin is unbiased. Which is really low.

But upon conducting the experiment we got 5 heads in 5 tosses. Hence ,we reject the null hypothesis .(ie:”The coin is unbiased”).Because our observation of getting 5 heads in 5 tosses is ground truth.(We tested this and got this as the following result above).

If P(Observation/Ho)[in this case P(x=5/Ho)]was more than 5 %, we would have accepted the null hypothesis.

5% is generally the rule of thumb. Anything above 5% null hypothesis will be accepted. Anything below 5% null hypothesis will be rejected.

Hence, Alternative hypothesis is accepted ie ”The coin is biased towards heads”.

We conclude : “The coin is biased towards heads”.

Clarification on threshold

If the consequences of the concluding the experiment is expensive. We can always decrease 5% to 3% or 1%.It mainly depends on the type of the problem, which we are trying to solve.

For example:

If a biotech company makes a statement like “Effectiveness of a new drug is better than existing drug.”

Here it is wise to decrease the 5% to 3% or 1%.Since accepting or rejecting a hypothesis can have severe consequences.

Something to watch out for:

Hypothesis testing mainly depends on

  1. Design of the experiment: The way the experiment is designed to obtain test-statistic or the result.
  2. Ho :Null-hypothesis: We need to design make a proper assumption to contradict the assumption we obtained from the experiment.
  3. Design of test-statistic: Choosing the test-statistic.

I know it is confusing ,let’s take an example to understand this clearly,

If we tossed the coin only 3 times and got head every time.

Then, P(observation/assumption)[P(x=3/Ho) = 1/2 * 1/2 * 1/2 =>12.5%]

Which is higher than 5%,we would have accepted the null hypothesis. Just by changing the experiment slightly. We went from rejecting the null hypothesis to accept the null hypothesis.

Thank you for reading….

No responses yet