Professional Documents
Culture Documents
Hypothesis Testing
Joey: Yeah, you told me that we can’t make a decision just by comparing the
sample averages, right? And that we would get a diIerent sample average
when we rerun our experiments. Till now you explained me about the
central limit theorem, normal distribution and inferential statistics, (Please
revise the previous blogs if you want to know more about those topics) is
there anything else which I should be knowing before solving this problem?
Chandler: Let me explain what hypothesis testing is? Suppose, assume that
we are going to decide the colour of our website based on the number of
clicks it receives. And the number of clicks in our website is 30 per day for
the default colour. Now, if the number of clicks in our website is going to
increase by changing its colour, we decide to keep the colour permanently.
Otherwise, we will stick to our default one.
Here, we need to decide whether to change the colour of the website based
on the sample data that we have collected, and its mean is 63.875 per day.
We also understand that we can’t make a decision just by comparing two
numbers (63.875 per day > 30 per day) because number of clicks is a
random variable. And this is where hypothesis testing becomes handy. It
tackles these issues in an intelligent way and uses the sample data to make a
decision. In other words, hypothesis testing uses sample data to make an
inference about the population parameter.
Let me give you some examples which uses hypothesis testing to take a
decision
Doctor wanting to know whether children who take vitamin C are less
likely to become ill.
In all these above examples, it is not possible for us analyse the entire
population to arrive at a decision. If the doctor wants to know if the
children who take Vitamin C are less likely to become ill, then it will be very
costly to scrutinise every child in the world to arrive at a decision and
sometimes it becomes infeasible too. So, we always try to make a decision
by looking at a sample from the population.
H0: Changing the colour of the website doesn’t inbuences the number of
clicks which it receives.
H1: Changing the colour of the website inbuences the number of clicks
which it receives.
Made hypothesis for population parameter (μ) and not for estimate (x).
The above hypothesis test is also called as two tailed test. Likewise, there is
another way to formulate the null and the alternative hypothesis. It’s called
one tailed test which are used when our null hypothesis is itself greater or
lesser than some pre speciDed value.
The word ‘null’ in the null hypothesis means that it’s a commonly accepted
fact that statistician work to nullify. We can even call it as falsiDable
hypothesis. This is one of the reason we usually say either we “reject the
null hypothesis” or “fail to reject the null hypothesis” at the end of our
hypothesis testing.
1. Calculate test statistic for the sample data: Test statistic is some
function of the sample data which compares it with the expected value
of the population parameter which would in turn help us to make a
decision in hypothesis testing.
Let me digress a little to explain the mechanism behind the test statistic. Do
you remember CLT (central limit theorem)?
It states that
x = sample mean
E[x] = μ
(Please revisit our Sampling distribution of sample mean and central limit
theorem blog to understand the intuition behind the theorem)
I think now you are ready to understand how test statistic compares the
sample data with the expected value of the null hypothesis or the
population parameter. There are a variety of test statistics which are
selected based on some criteria. In our case, we will be using Z- statistic.
They are used when the following conditions hold true
Z-statistic is deDned as
To calculate z-statistic, we knew all the values except the sample mean (X).
In our example the collected sample was:
The value of z-statistic (3.83) tells us how much far away the sample mean
is from the null hypothesis mean (Positive value corresponds to sample
mean being higher and negative value corresponds to population mean
being higher).
The number 0.1 is called as the signiDcance level which typically represents
the level of acceptable error in our decision. Generally, the decisions are
made as follows:
Let us assume a α value of 0.10. Now, since the p value is less than α we
reject the null hypothesis. In other words, changing the colour of our
website has inbuences on the number of clicks.
Joey: Wow, I didn’t realize the importance of hypothesis testing until this
conversation. But I still have a doubt…Why don’t we say “accept the
alternate hypothesis” instead “reject the null hypothesis” since both means
the same?
Chandler: When our p-value is very low, the only conclusion we can make is
that X is not from the theoretical or the null distribution. We can’t make any
conclusion about the alternative hypothesis. And that’s why we always say
reject null hypothesis instead of accepting the alternate hypothesis.
Chandler: Let me put it this way, we know that the probability of observing
a sample in a normal distribution is zero since it is a continuous
distribution. Therefore, it is not possible to calculate the probability of
observing the sample we collected in the null distribution as it always
results in zero. That is the reason why we deDne the p-value as probability
of obtaining a result at least as extreme as the one observed (sample).
Chandler: Okay let’s pull the data from our database and run the hypothesis
to check if change in colour of website has any inbuence on the no. of clicks
which it receives.
Let red be the default colour and blue be the new colour to which we
change the website, also assume that we know that the average number of
clicks is 30 when the colour red (from historical data), now we change the
colour to blue and record the number of clicks per day for 8 days (assume
σ=25 and a=0.05 )
Quora- www.quora.com/proAle/Balaji-Pitchai-Kannu
Statistics
34 claps
WRITTEN BY
GreyAtom Follow