Professional Documents
Culture Documents
Data Science
• Introduction to Hypothesis Testing
• Significance Tests: p-Value and Critical Value
• Z- Test
• T- Test
• Hypothesis testing is an act in statistics whereby an analyst tests an
assumption regarding a population parameter. It is used to assess the
plausibility (falseness) of a hypothesis by using sample data.
• It is a form of statistical inference that uses data from a sample to
draw conclusions about a population parameter or a population
probability distribution.
• Analysts test a hypothesis by examining a random sample of the
population for two different hypotheses:
• Null hypothesis (H0)
• Alternative hypothesis (H1)
Hypothesis Testing: Introduction
Hypothesis Testing: Example
A restaurant owner installed a new automated drink machine. The
machine is designed to dispense 530 ML in medium size glass. The
owner suspect that machine may be dispensing too much in medium
size. They decide to take sample of 30 drinks of medium size to see if
the average amount is significantly greater than 530 ML.
Null Hypothesis?
Ho : μ = 530
Alternate Hypothesis?
H1: μ > 530
• Unfortunately, since hypothesis tests are based on sample
information, the possibility of errors must be considered.
➢A type I error corresponds to rejecting H0 when H0 is actually true, &
➢A type II error corresponds to accepting H0 when H0 is false.
• Compute z-score?
• Whether to reject or select null hypothesis?
Z-Test: Example (Two Sample)
T - Test
T-Test
T-Test
• If you only care whether the two populations are different from one
another, perform a two-tailed t-test.
• If you want to know whether one population mean is greater than or
less than the other, perform a one-tailed t-test.
• Example question: your company wants to improve sales. Past sales data indicate
that the average sale was $100 per transaction. After training your sales force,
recent sales data (taken from a sample of 25 salesmen) indicates an average sale of
$130, with a standard deviation of $15. Did the training work? Test your hypothesis
at a 5% alpha level.
• Step 1: Write your null hypothesis statement (How to state a null hypothesis). The
accepted hypothesis is that there is no difference in sales, so:
• H0: μ = $100
• Step 2: Write your alternate hypothesis. This is the one you’re testing in the one
sample t test. You think that there is a difference (that the mean sales increased),
so:
• H1: μ > $100
T-Test (One Sample)
T-Test (One Sample)