0% found this document useful (0 votes)
4 views

Lecture_10

The document provides an overview of hypothesis testing in statistics, focusing on the null and alternative hypotheses, the process of testing, and the potential errors involved. It explains the significance of test statistics, critical values, and p-values in making decisions about hypotheses. Additionally, it includes examples to illustrate the application of z-tests and t-tests for mean comparisons.

Uploaded by

kamranhanif3111
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views

Lecture_10

The document provides an overview of hypothesis testing in statistics, focusing on the null and alternative hypotheses, the process of testing, and the potential errors involved. It explains the significance of test statistics, critical values, and p-values in making decisions about hypotheses. Additionally, it includes examples to illustrate the application of z-tests and t-tests for mean comparisons.

Uploaded by

kamranhanif3111
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 48

ST11: Statistics & Probability

Hypothesis Testing - One sample


case (chap 7)
This document belongs to ESCP Business School.
It cannot be modified nor distributed without the
author’s consent.
Prof. Lynn FARAH
Statistical Methods

Statistical
Methods

Descriptive Inferential
Statistics Statistics

Hypothesis
Estimation Testing
Hypothesis Testing

I believe the
population mean Sample value is
very far from
age is 50 claimed value.
Population (hypothesis). Reject
hypothesis?

J J
J
J J
J Random
J sample
Mean
`X = 20
What’s a Hypothesis?
I believe:
A statistical hypothesis is a - the average for ST11 is 12.7
statement/claim/assertion about the -13% of students are vegan
numerical value of a population - there is no relationship between
tattoo and hepatitis C
parameter.
Null Hypothesis

The null hypothesis, denoted H0, is the hypothesis that will be


tested.
This usually represents the “status quo” or some claim/assertion
about the population parameter. Usually:
H0: parameter = hypothesized value

It is always about a population parameter, not about a sample


statistic!

H0 : μ = 30 H0 : X = 30
Alternative Hypothesis

The alternative (research) hypothesis, denoted Ha (or H1), is the


“opposite” of the null hypothesis.
This hypothesis is accepted only if the sample data provide convincing
evidence of its truth, hence leading to rejecting the null hypothesis.
It usually represents the values of a population parameter for which the
researcher wants to gather evidence to support.

It is stated in one of the following forms:


Ha: parameter ≄ hypothesized value (Two-tailed)
Ha: parameter < hypothesized value (One-tailed, lower-tailed)
Ha: parameter > hypothesized value (One-tailed, upper-tailed)
Outcomes of a Hypothesis Test
We begin our hypothesis test with the assumption that the null
hypothesis is true.

The outcome of a hypothesis test can be:

• Rejecting the null hypothesis

→ We have evidence that supports the alternative hypothesis.

• Not rejecting the null hypothesis

→ We lack sufficient evidence to support the alternative hypothesis.


We can never prove that it is true!
A Trial as a Hypothesis Test
Think about the logic of jury trials:
• To prove someone is guilty, we start by assuming they are innocent.
• We retain the assumption of innocence, until the facts make it unlikely beyond “a
reasonable doubt”
• Then, and only then, we reject the hypothesis of innocence and declare the
person guilty.
If the evidence is not strong enough to reject the presumption of innocent, the jury
returns with a verdict of “not guilty.”
• The jury does not say that the defendant is innocent.
• All it says is that there is not enough evidence to convict, to reject innocence.
• The defendant may be innocent or may be guilty, but the jury is not sure
(confident) of guilt.
Expressed statistically, we will fail to reject the null hypothesis.
• We never declare the null hypothesis to be true, because we simply do not know
whether it’s true or not.
• Sometimes in this case we say that the null hypothesis has been retained
9

Two ways to be wrong

We cannot be sure of reaching the correct decision for our hypothesis


test, and there are two ways of getting it wrong:

• Type I error: the null hypothesis H0 is in fact true but we reject it

• Type II error: the null hypothesis H0 is in fact false but we fail to


reject it
10

Two ways to be wrong


Two ways to be wrong

The analogy with the jury trial (where the initial assumption is
innocence) would be:
I. convicting an innocent person
II. letting a guilty person go free.

Which mistake is worse?

In medical testing for a disease, where the null hypothesis is “no


disease”, then these mistakes are:
I. A false positive (we think there is disease but there isn’t)
II. A false negative (we think there is no disease but in fact there is)

Which mistake is worse?


Two ways to be wrong

• Type I Error
q Reject a true null hypothesis
q Considered a serious type of error
q The probability of a Type I Error is a
–Called level of significance of the test
–Set by researcher in advance

• Type II Error
q Failure to reject false null hypothesis
q The probability of a Type II Error is β
–We will not calculate it
The Hypothesis Testing Process

Claim: The population mean age is 50.


H0: μ = 50, Ha: μ ≠ 50

Sample the population and find sample mean.

Population

Sample
The Hypothesis Testing Process

We find that the sample mean age is X = 20.


This is significantly lower than the claimed population mean age of 50.

If the null hypothesis were true, the probability of getting such a


different sample mean would be very small. So we reject the null
hypothesis .

In other words, getting a sample mean of 20 is highly unlikely if the


population mean was 50, you conclude that the population mean must
not be 50.
The Hypothesis Testing Process

Sampling Distribution of the Mean

It is unlikely
that we would ... therefore, we
get a sample reject the
mean of this hypothesis that
value ... 𝛍= 50.

... if in fact this were


the population mean

20 𝛍= 50 Sample Means
H0
Taking a decision
If the sample mean is close enough to the stated population mean, the null
hypothesis is not rejected.
If the sample mean is too far from the stated population mean, the null
hypothesis is rejected.

How far is “too far” to reject H0?


To answer that question, we must first calculate the test statistic: it is a
sample statistic, computed from information provided in the sample, that
the researcher uses to decide between the null and alternative
hypotheses.

Then, we take a decision using either the critical value(s) method which
defines rejection region(s), or the p-value method.
Rejection Regions (Two-Tailed Test)

Sampling Distribution of test statistic

Rejection Rejection
Region Region
1–𝛂
𝛂 /2 𝛂 /2
Fail to Reject
Region

Ho
Critical Value Critical
Value Value
Rejection Region (One-Tailed Test)

Sampling Distribution of test statistic

Rejection
Region
1–𝛂
𝛂
Fail to Reject
Region

Ho
Critical Value
Value
p-value

The p-value is the conditional probability of obtaining a test statistic


equal to or more extreme than the observed sample value, given H0 is
true.
It is obtained from a statistical table based on the sampling distribution of
the test statistic.

It is also called observed level of significance.

It is used to take a rejection decision


• If p-value > 𝛂, do not reject H0
• If p-value < 𝛂, reject H0
Note that p-value (two-tailed) = 2 * p-value (one-tailed)
Steps in a Hypotheses Test
1. State the Null hypothesis & Alternative
hypothesis

Draw a picture!
2. Check assumptions/conditions Show the sampling
this ensures that the sampling distribution follows a distribution based on
given model (Normal, Student or other) the null hypothesis and
where the statistic
3. Find the test statistic from your data lies
with respect to this
z-score, t-score or other
distribution.

4. Find the Critical Value(s) or P-value


Use z-table, t-table or other

5. Conclude
Reject or fail to reject null hypothesis
Interpret in context
Hypothesis Tests for the Mean

Hypothesis
Tests for µ

z-test: t-test:
s Known s Unknown
s Unknown and small sample
but large sample
Hypothesis Tests for the Mean

Hypothesis
Tests for µ

z-test: t-test:
s Known s Unknown
s Unknown and small sample
but large sample
Hypothesis for the Mean: z-test
The test statistic is:

𝑋% − 𝜇$
𝑍!"#" = 𝜎
𝑛

(If 𝛔 unknown, it is estimated with s).


The critical value(s) or p-value are found using a z-table and based
on the level of significance 𝛂.
The conditions required for inference are the same as for the z-
interval for the mean.
Most commonly used critical values
(z-test)

Test α 10% 5% 1%

Lower tailed < -1.28 -1.645 -2.33

Upper tailed > 1.28 1.645 2.33

Two tailed -1.645 -1.96 -2.58


(also for CI) 1.645 1.96 2.58

Obtained from the z-table or the last row of the t-table.


25

Example 1

A manufacturer claims that the mean


diameter of bolts produced in his factory
respects the safety standard of 30mm.
For quality control purposes, we measure
the diameters of bolts in a random sample of
100 units, and find the mean to be 29.84mm.
Can we conclude that the manufacturer is
not telling the truth? We assume σ = 0.8mm.

The claimed value for the mean (30) will be noted 𝛍0


We will set a = 0.05 (default value).
26

Example 1
1. State the appropriate null and alternative hypotheses
H0: µ = 30 the manufacturer’s claim holds
Ha: µ ≠ 30 the manufacturer’s claim doesn’t hold
(we will use a two-tailed test, since no direction is explicitly
indicated in the question)

2. Check the assumptions: random sample and large enough


(n>30) so the CLT works and we will use a Normal distribution

3. Compute the test statistic:

X - μ0 29.84 - 30 - .16
ZSTAT = = = = -2.0
σ 0.8 0.08
n 100
27

Example 1
4. Critical Values Method:
For a = 0.05, the critical z values are ±1.96

a/2 = 0.025 a/2 = 0.025

Reject H0 Do not reject H0 Reject H0

-Zα/2 = -1.96 0 +Zα/2 = +1.96

-2.0
5. Since ZSTAT = -2.0 < -1.96, the test statistic is in the
rejection region, so we reject the null hypothesis and conclude
there is sufficient evidence that the mean diameter of a
manufactured bolt is significantly different from 30.
28

Example 1
4. p-value Method: how likely is it to get a ZSTAT of -2 or
something further from the mean, in either direction, if H0 is
true?

P(Z < -2.0) P(Z > 2.0)


= 0.0228 = 0.0228

0 Z

-2.0 2.0
p-value = 0.0228 + 0.0228 = 0.0456

5. Since p-value < a (0.05), we reject the null hypothesis and


conclude there is sufficient evidence that the mean diameter of a
manufactured bolt is significantly different from 30.
Thinking Challenge #1

Does an average box of cereal


contain more than 368 grams
of cereal?
A random sample of 25 boxes
showed a mean of 372.5.
The company has specified s to
be 25 grams.
Test at the 0.05 level of
significance. 368 gm.
Thinking Challenge #2

Does an average box of cereal


contain 368 grams of cereal?
A random sample of 25 boxes
had a mean of 372.5.
The company has specified s to
be 25 grams.
Test at the 0.05 level of
significance. 368 gm.
Hypothesis Tests for the Mean

Hypothesis
Tests for µ

z-test: t-test:
s Known s Unknown
s Unknown and small sample
but large sample
Hypothesis for the Mean: t-test
The test statistic is:

𝑋% − 𝜇$
𝑡!"#" = 𝑠
𝑛

The critical value(s) or p-value are found using a t-table, based on the
degree of freedom df=n-1 and a level of significance 𝛂.
The conditions required for inference are the same as for the t-interval
for the mean.
33

Example 2

The average cost of a hotel room in New


York is said to be $168 per night.
To determine if this is true, a random sample
of 25 hotels is taken. It showed a mean of
$172.50 and a standard deviation of $15.40.

Can we say that hotels in New York are more


expensive than claimed?

The claimed value for the mean (168) will be noted 𝛍0


We will set a = 0.05 (default value).
34

Example 2
1. State the appropriate null and alternative hypotheses
H0: µ = 168 the average cost of a hotel room in NY is 168$
Ha: µ > 168 the average cost of a hotel room in NY is more
than 168$
(we will use a one-tailed test, upper tail)

2. Check the assumptions: random sample, but s unknown and


sample is small (n<30), so we will use a Student distribution,
assuming that hotel costs in NY have a distribution that is
approximately normal

3. Compute the test statistic:


X - μ0 172.50 - 168
t STAT = = = 1.46
S 15.40
n 25
Example 2
4. Critical Values Method:
For a=0.05, the critical t value for df=25-1=24 is 1.711

a = 0.05

Do not reject H0 Reject H0

0 tα = 1.711

1.46
5. Since tSTAT = 1.46< 1.711, the test statistic is NOT in the
rejection region, so we FAIL to reject the null hypothesis and
conclude there isn’t sufficient evidence that the average cost
of a hotel room in NY more than 168$
36

Example 2
4. p-value Method: how likely is it to get a tSTAT of 1.46 or
more, if H0 is true?

P(t > 1.46)

0 t

1.46
For df=24, p-value is between 5% and 10%
(using a statistical package we get 7.85%)
5. Since p-value > a, FAIL to reject the null hypothesis and
conclude there isn’t sufficient evidence that the average cost of a
hotel room in NY more than 168$
Note about finding the p-value for a t-test
Finding the p-value using our t-table is a complicated and not exact
process because our t-table is incomplete.

This means that we cannot read an exact p-value for a calculated tstat.
In fact, we can only make an approximation of the p-value by bounding
it between 2 alpha values.
You have an example with detailed explanation on p.415 of the ebook.

To make our life simpler, we agree that it’s easier to use the critical
value(s) method with rejection region(s) for a Student t-test, unless we
can read the exact p-value using a software.
Thinking Challenge #3

Does an average box of


cereal contain 368 grams of
cereal?

A random sample of 25
boxes had a mean of 372.5
and a standard deviation of
12 grams.

Test at the 0.05 level of


368 gm.
significance.
Hypothesis Tests for the Proportion: z-test

The test statistic is:


𝑝̂ − 𝑝$ Hypothesis
𝑍!"#" =
𝑝$ (1 − 𝑝$ ) Tests for p
𝑛

The critical value(s) or p-value np0 ³ 15 np0 < 15


are found using a z-table, and and and
based on a level of significance 𝛂.
n(1-p0) ³ 15 n(1-p0) < 15
The conditions required for
inference are the same as for the
Not discussed
z-interval for the proportion
in this chapter
(using p0)
40

Example 3
Following a marketing campaign for a new
product, a company claims that it receives
8% responses from its client mailing list.
To test this claim, a random sample of 500
clients were surveyed and 25 of them said
they responded to the mail.
Can we conclude that the client response
rate is less than claimed?

The claimed value for the proportion (8%) will be noted p0


We will set a = 0.05 (default value).
41

Example 3
1. State the appropriate null and alternative hypotheses
H0: p = 8% the client response rate is 8%
Ha: p < 8% the client response rate is less than 8%
(we will use a one-tailed test, lower-tail)

2. Check the assumptions: random sample,


np0=(500)(0.08)=40>15 and n(1-p0)=(500)(0.92)=460>15

3. Compute the test statistic:


% !
&'& ()/)++'+.+-
𝑍"#$# = = =-2.47
"! ($%"! ) !.!)($%!.!))
' *!!
42

Example 3
4. Critical Values Method:
For a = 0.05, the critical z value is -1.645

a= 0.05

Reject H0 Do not reject H0

-Zα = -1.645 0

-2.47
5. Since ZSTAT = -2.47 < -1.645, the test statistic is in the
rejection region, so we reject the null hypothesis and conclude
there is sufficient evidence that the client response rate is less
than claimed.
43

Example 3
4. p-value Method: how likely is it to get a ZSTAT of -2.47 or
less, if H0 is true?

P(Z < -2.47)


= 0.0068

0 Z

-2.47
p-value = 0.0068

5. Since p-value < a, we reject the null hypothesis and conclude


there is sufficient evidence that the client response rate is less
than claimed.
Thinking Challenge #4
The present packaging system
produces 10% defective cereal
boxes.
Using a new system, a random
sample of 200 boxes had 11
defects.
Does the new system produce
fewer defects?
Test at the 0.05 level of
significance.
More about p-values

When the sample data are consistent with the value of the null
hypothesis, the p-value is high and we are unable to reject the null
hypothesis.

We “retain” the null hypothesis we started with.


We can’t claim to have proved it; instead we “fail to reject the null
hypothesis”

If the p-value is low enough (lower than the significance level), we


“reject the null hypothesis,” since what we observed would be very
unlikely if the null hypothesis was true.
Example 1 - pvalue

p-value = 0.0456 = 4.56%

Interpretation:
There is a 4.56% chance of finding a test statistic equal to or
more extreme than our observed sample mean diameter of
29.84mm, IF H0: µ = 30 is true.

This is considered to be a low probability when compared to


a=0.05 (even though it’s quite close).
It implies that our sample value would be unlikely IF H0 is true.

Hence, we decide to reject the null hypothesis (and therefore


“trust” our sample).
Example 2 - pvalue

p-value = 7.85%

Interpretation:
There is a 7.85% chance of finding a test statistic equal to or
more extreme than our observed sample mean cost of $
172.50, IF H0: µ = 168 is true.

This is considered to be a high probability when compared to


a=0.05.
It implies that our sample value is not so unlikely IF H0 is true.

Hence, we decide not to reject the null hypothesis (since our


sample doesn’t provide enough evidence contradicting it).
Confidence intervals and Hypothesis tests

If you reject the null hypothesis, then it is often useful to make a


confidence interval using your sample statistic to show where one
might expect the true value of the population parameter to be found.
(Using the same level of significance.)

Of course you would expect the null hypothesis value to lie OUTSIDE
this confidence interval as this is more or less equivalent to rejecting
the null hypothesis.

You might also like