Hypothesis Testing
Hypothesis Testing
Till now, the goal was to find ways of describing, summarizing and visualising
the sample data only
A sampling technique where every item in the population has an equal chance
of being selected
Samples of
size n
Assumptions
Data must be randomly sampled Sample values must be independent of each other
Samples should come from the same distribution Sample size must be sufficiently large (≥30)
Central Limit Theorem
Estimation
Make inference about a population parameter
based on sample statistic
Point estimates vary from sample to sample. Often an interval is used to provide a range of values the
parameter can take, instead of a single point estimate.
Interval estimation - Confidence interval
For example, a bulb manufacturing company is interested in knowing whether the new
manufacturing process improves reliability of the bulbs.
The objective of the Hypothesis Testing is to SET a value for the parameter(s) and perform
a statistical TEST to see whether that value is tenable in the light of the evidence gathered
from the sample.
Overview of Applications
e.g. a new automobile e.g. a manufacturer claims e.g. new online ad has
system increases the mean that 1L soft drink bottles are resulted in higher online
mpg performance filled with an average of at conversion rates for an
least 0.99L E-commerce website
Stating the Hypothesis
Null and Alternative Hypotheses - Two
mutually exclusive statements about
the population parameter(s)
E.g. The new process for E.g. The new process for
manufacturing bulbs does manufacturing bulbs
not improve reliability. improves reliability.
Null & Alternative Formulation : Example
Mean length of lumber is specified to be 8.5m for a certain building project. A construction
engineer wants to make sure that the shipments she received adhere to that specification.
The population parameter about which the hypothesis will be formed is population mean
𝜇.
H a : 𝜇≠ 8.5
Tips to formulate Null & Alternative
Am I testing an
Am I testing a status quo
assumption or claim that
that already exists?
is beyond what I know?
Always contains equality (=, >= Doesn’t contain equality (≠, >,
, <=) <)
Basic Concepts of Hypothesis Testing
Importance of Null
Null hypothesis is assumed to be true unless reasonably strong evidence to the contrary is
found.
Based on a random sample a decision is made whether there exists reasonably strong
evidence against the null hypothesis.
Evidence is not strong (does not satisfy Fail to reject the null hypothesis
the predetermined decision rule) in favour of alternative hypothesis
Importance of Test Statistic
The test statistic is calculated from the sample data and tested against the predetermined
Decision Rule.
The test statistic is a random variable that follows a standard distribution such as Normal,
T, F, Chi-square etc. Sometimes the tests are named after the test statistic
Since hypothesis testing is done on the basis of sampling distribution, the decisions made
are probabilistic.
Hence, it is very important to understand the errors associated with hypothesis testing.
Type I and Type II Error
Type I and Type II Errors
Level of Power of
significance the test
H 0 is True H 0 is False
Type I error (false positive): “The patient doesn’t have cancer but doctors says she does”
Type II error (false negative): “The patient does have cancer but report says she doesn’t”
Template for Hypothesis Testing
Hypothesis Testing Template
1 Identify the key question What is the research question that you are trying to answer?
2 Establish the hypotheses What is the metric of interest? Define the Null and Alternate Hypothesis.
What data do you have? Do you understand what it means? Can it be used
3 Understand and prepare data directly?
4 Identify the right test Choose the method for testing based on the last three points
5 Check the assumptions Ensure that data satisfies the assumption for the test.
What are the null and alternative hypotheses? What is an appropriate test statistic?
Let’s see an example and understand the significance of the above questions
For simplicity, we will assume that the population standard deviation is known and the
sample size is more than 30.
Example
It is known from experience that for a certain E-commerce company the mean delivery time
of the products is 5 days with a standard deviation of 1.3 days.
The new customer service manager of the company is afraid that the company is slipping
and collects a random sample of 45 orders. The mean delivery time of these samples comes
out to be 5.25 days.
Is there enough statistical evidence for the manager’s apprehension that the mean delivery
time of products is greater than 5 days.
Significance of Test
Assumptions
the test Statistic
Distribution
Test for population Standard Normal
mean ● Continuous data distribution
H0 : 𝜇 = 𝜇 0 ● Normally distributed population
or sample size > 30
● Known population standard
deviation 𝜎
● Random sampling from the
population
One-tailed and Two-tailed Tests
One-tailed and Two-tailed Tests
Greater than type
H a : 𝜇> 𝜇0
One-tailed test
Less than type
Alternative H a : 𝜇< 𝜇0
Hypothesis
Two-tailed test
Choice of One tailed vs Two tailed depends on the nature of the problem, not on the sample data!
Difference between One-tailed and Two-tailed Tests
Test statistic value does not change for two-tailed or one-tailed test.
Only the critical value(s) / p-value associated with the test statistic changes