0% found this document useful (0 votes)
18 views32 pages

Note 08 - Hypothesis Testing

Uploaded by

anupriya6105
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)
18 views32 pages

Note 08 - Hypothesis Testing

Uploaded by

anupriya6105
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/ 32

IT3011 - Theory & Practices in Statistical Modelling

Hypothesis Testing

H.M. Samadhi Chathuranga Rathnayake


MSc, PgDip, BSc
Hypothesis Testing

When making a statistical inquiry, we often put forward a claim (hypothesis) about a population parameter.
Ex-
• Mean height of 15 year old boys is 1.62m
• The proportion of diabetes in a particular district is 0.05
• The mean number of telephone calls received by a telephone operator over a period of 60 minutes is 20.

The hypothesis we put forward is called the Null Hypothesis and is denoted by 𝑯𝟎 . Just define Null
Hypotheses for above examples as below.
• 𝐻0 ∶ 𝜇 = 1.62
• 𝐻0 ∶ 𝑝 = 0.05
• 𝐻0 ∶ 𝜇 = 20
In order to test the validity of 𝐻0 we consider observations made on the random sample taken from the
populations and perform a statistical test.
Hypothesis Testing

This test shows that whether we should reject the null hypothesis (rejecting the claim stated under 𝐻0 ), we do
so in favor of an Alternative Hypothesis, which is usually the opposite of what is stated in the null hypothesis
and is denoted by 𝑯𝟏 or 𝑯𝒂 .
Consider we do not reject 𝑯𝟎 . Not rejecting 𝑯𝟎 means should we accept it?
Are above defined hypotheses correct?
Ex-

Took a sample (income) and found that 𝑋=35000. Suppose we want to test the hypothesis that the mean
income is greater than 37000. Then,
𝐻0 ∶ 𝜇 ≤ 37000 𝑎𝑛𝑑 𝐻1 ∶ 𝜇 > 37000
𝐻0 ∶ 𝜇 > 37000 𝑎𝑛𝑑 𝐻1 ∶ 𝜇 ≤ 37000
𝐻0 ∶ 𝜇 = 37000 𝑎𝑛𝑑 𝐻1 ∶ 𝜇 ≠ 37000
𝐻0 ∶ 𝜇 ≠ 37000 𝑎𝑛𝑑 𝐻1 ∶ 𝜇 = 37000
Type I Versus Type II Errors

When testing hypotheses there are essential two errors that can be made.
1. Type I error - Rejecting the null hypothesis when the null is correct actually.
2. Type II error - Not rejecting the null hypothesis when the null is not correct actually.

Reality
Decision
𝐻0 is true 𝐻0 is false
Reject 𝐻0 Type I error Correct
Do not reject 𝐻0 Correct Type II error

𝑃 𝑇𝑦𝑝𝑒 𝐼 𝑒𝑟𝑟𝑜𝑟 = 𝛼
𝑃 𝑇𝑦𝑝𝑒 𝐼𝐼 𝑒𝑟𝑟𝑜𝑟 = 𝛽
𝑃𝑜𝑤𝑒𝑟 = 1 − 𝛽
Defining Hypotheses

Our convention is to set the hypotheses so that Type I error is more serious.
Ex-
An inspector has to choose between certifying a building as safe or saying that the building is not safe.
There are two hypothesis:
1. Building is safe
2. Building is not safe

Focus on making Type 1 error more serious which is that “Rejecting the null hypothesis when the null is
correct actually” should be more serious.
Defining Hypotheses

Consider,
𝐻0 ∶ 𝐵𝑢𝑖𝑙𝑑𝑖𝑛𝑔 𝑖𝑠 𝑠𝑎𝑓𝑒

Type 1 error – Stating the building is not safe when it is safe actually.
Defining Hypotheses

Consider,
𝐻0 ∶ 𝐵𝑢𝑖𝑙𝑑𝑖𝑛𝑔 𝑖𝑠 𝑛𝑜𝑡 𝑠𝑎𝑓𝑒

Type 1 error – Stating the building is safe when it is not safe actually.
Defining Hypotheses

So the null and alternative hypotheses are defined as,

𝐻0 ∶ 𝐵𝑢𝑖𝑙𝑑𝑖𝑛𝑔 𝑖𝑠 𝑛𝑜𝑡 𝑠𝑎𝑓𝑒


𝐻1 ∶ 𝐵𝑢𝑖𝑙𝑑𝑖𝑛𝑔 𝑖𝑠 𝑠𝑎𝑓𝑒
Defining Hypotheses

Now you know the intuition behind defining null and alternative hypotheses. When you get a question, an easy
way to define hypotheses is, putting the question under the alternative hypothesis.

Ex-
1. The UGC Sri Lanka needs to know that whether the “majority of students at University of Moratuwa are
from Western Province”
𝑯𝟏 ∶ 𝒑 > 𝟎. 𝟓 𝑎𝑛𝑑 𝑯𝟎 ∶ 𝒑 ≤ 𝟎. 𝟓 −−→ 𝑯𝟎 ∶ 𝒑 = 𝟎. 𝟓

1. A consumer test agency wants to see whether the mean lifetime of a brand of tires is less than 42000 miles
as the tire manufacturer advertises that the average lifetime is at least 42000.
2. The length of a certain lumber from a national home building store is supposed to be 8.5 feet. A builder
wants to check whether the shipment of lumber she receives has a mean length different from 8.5 feet.
3. A political news company believes the national approval rating for the current president has fallen below
40%.
Defining Hypotheses

2. A consumer test agency wants to see whether the mean lifetime of a brand of tires is less than 42000 miles
as the tire manufacturer advertises that the average lifetime is at least 42000.
𝐻1 ∶ 𝜇 < 42000 𝑎𝑛𝑑 𝐻0 ∶ 𝜇 = 42000

3. The length of a certain lumber from a national home building store is supposed to be 8.5 feet. A builder
wants to check whether the shipment of lumber she receives has a mean length different from 8.5 feet.
𝐻1 ∶ 𝜇 ≠ 8.5 𝑎𝑛𝑑 𝐻0 ∶ 𝜇 = 8.5

4. A political news company believes the national approval rating for the current president has fallen below
40%.
𝐻1 ∶ 𝑝 < 0.4 𝑎𝑛𝑑 𝐻0 ∶ 𝑝 = 0.4
Significance Level

When we conduct a hypothesis test we will always have to specify a significance level. We basically have to
answer the question – “What is the probability of a Type I error we are willing to live with?”.
We cannot generally quantify the probability of a type II error. To avoid making Type ii errors we will always say
“Do not reject the null hypothesis” instead of “Accept the null hypothesis”.

Popular Significance Levels

0.1 0.05 0.01


Perform Hypothesis Testing

There are three approaches to the hypothesis testing.

(1) Classical Approach:


• Define null and alternative hypothesis.
• Check whether the hypothesis is one tailed or two tailed.
• Find the appropriate test statistic and its distribution.
• Compute the test statistic under 𝐻0 .
• Define the rejection region according to the given significance level.
• If the calculated test statistic falls in the rejection region, reject 𝐻0 and if not, do not reject 𝐻0 .
Perform Hypothesis Testing

There are three approaches to the hypothesis testing.

(2) Confidence Interval Approach:


• Define null and alternative hypothesis.
• Check whether the hypothesis is one tailed or two tailed.
• Construct appropriate confidence interval for specified level of significance under 𝐻0 .
• If the value of the parameter under 𝐻0 lies within the confidence interval, we do not reject 𝐻0 . If the value
of the parameter under 𝐻0 lies outside the confidence interval we reject 𝐻0 .
Perform Hypothesis Testing

There are three approaches to the hypothesis testing.

(3) P-Value Approach:


• Define null and alternative hypothesis.
• Check whether the hypothesis is one tailed or two tailed.
• Find the appropriate test statistic and its distribution.
• Compute the P-value based on computed value of the test statistic under 𝐻0 .
• If the P-value is less than the significance level, we reject 𝐻0 . Otherwise we do not reject 𝐻0 .
Tests About Mean : Z – test when population variance is known

Consider the following hypothesis for the population mean, suppose to be tested using a random sample of
size 𝑛. This is a two tailed test.
𝐻0 ∶ 𝜇 = 𝐴
𝐻1 ∶ 𝜇 ≠ 𝐴

Get a sample from the population and calculate the sample mean 𝑋.
Now consider the test statistic,

𝑋ത − 𝜇
Z= 𝜎 ~𝑁(0,1)
ൗ 𝑛

Now compute the values of the test statistic under 𝐻0 . Then,

𝑋ത − 𝐴
Z𝑐𝑎𝑙 = 𝜎
ൗ 𝑛
Tests About Mean : Z – test when population variance is known

Since this is a two tail test,

𝛼 𝛼
2 2

−𝑍𝛼 𝑍𝛼
2 2

If Z𝑐𝑎𝑙 > 𝑍𝛼 or Z𝑐𝑎𝑙 < −𝑍𝛼 we reject 𝐻0


2 2
Tests About Mean : Z – test when population variance is known

In a one tail – right tail test,, 𝐻0 ∶ 𝜇 = 𝐴 and 𝐻1 ∶ 𝜇 > 𝐴

𝑍𝛼

If Z𝑐𝑎𝑙 > 𝑍𝛼 we reject 𝐻0


Tests About Mean : Z – test when population variance is known

In a one tail – left tail test,, 𝐻0 ∶ 𝜇 = 𝐴 and 𝐻1 ∶ 𝜇 < 𝐴

−𝑍𝛼

If Z𝑐𝑎𝑙 < − 𝑍𝛼 we reject 𝐻0


Ex-

Boys of a certain age are known to have a mean weight of 85 pounds. A complaint is made that the boys living
in a municipal children’s home are underfed. 25 boys from the home are weighed and found to have a mean
weight of 80.94 pounds. It is known that the population standard deviation is 11.6 pounds. Based on the
available data what should be concluded concerning the complaint? (Significance level 5%)

𝐻0 ∶ 𝜇 = 85
𝐻1 ∶ 𝜇 < 85

Under 𝐻0 ,

80.94 − 85
Z𝑐𝑎𝑙 = = −1.75
11.6ൗ
25
5%

−𝑍5% = −1.645
Z𝑐𝑎𝑙 = −1.75 < − 𝑍5% ,so we reject 𝐻0 at 5% level of significance.

Conclusion – There is an evidence to say that, the boys living in a municipal children’s home are underfed at
5% level of significance.
Tests About Mean : t – test when population variance is unknown

Consider the following hypothesis for the population mean, suppose to be tested using a random sample of
size 𝑛. This is a two tailed test.
𝐻0 ∶ 𝜇 = 𝐴
𝐻1 ∶ 𝜇 ≠ 𝐴

Get a sample from the population and calculate the sample mean 𝑋.
Now consider the test statistic,

𝑋ത − 𝜇
T= ~𝑡(𝑛−1)
𝑆ൗ
𝑛
Now compute the values of the test statistic under 𝐻0 . Then,

𝑋ത − 𝐴
t 𝑐𝑎𝑙 =
𝑆ൗ
𝑛
Tests About Mean : t – test when population variance is unknown

Since this is a two tail test,

𝛼 𝛼
2 2

−𝑡 𝛼 𝑡 𝛼
𝑛−1 , 2
𝑛−1 , 2

If t 𝑐𝑎𝑙 > 𝑡 𝛼
𝑛−1 , 2 or t 𝑐𝑎𝑙 < −𝑡 𝛼
𝑛−1 , 2 we reject 𝐻0
Tests About Mean : t – test when population variance is unknown

In a one tail – right tail test,, 𝐻0 ∶ 𝜇 = 𝐴 and 𝐻1 ∶ 𝜇 > 𝐴

𝑡 𝑛−1 ,𝛼

If t 𝑐𝑎𝑙 > 𝑡 𝑛−1 ,𝛼 we reject 𝐻0


Tests About Mean : t – test when population variance is unknown

In a one tail – left tail test,, 𝐻0 ∶ 𝜇 = 𝐴 and 𝐻1 ∶ 𝜇 < 𝐴

−𝑡 𝑛−1 ,𝛼

If t 𝑐𝑎𝑙 < −𝑡 𝑛−1 ,𝛼 we reject 𝐻0


Ex-

Five readings of the resistance in Ohms (Ω) of a piece of wire gave the following results.
1.15, 1.49, 1.54, 1.52, 1.54
If the wire is pure silver, its resistance should be 1.5Ω. Test at 5% level of significance whether the wire is pure
silver. Assume the normality of the readings.

𝐻0 ∶ 𝜇 = 1.5
𝐻1 ∶ 𝜇 ≠ 1.5

Under 𝐻0 ,

1.448 − 1.5
t 𝑐𝑎𝑙 = = −0.78
0.15ൗ
5
2.5% 2.5%

−𝑡 4 ,2.5% = −2.7763 𝑡 4 ,2.5% = 2.7763

t 𝑐𝑎𝑙 = −0.78 > −𝑡 4 ,2.5% ,so we do not reject 𝐻0 at 5% level of significance.

Conclusion - There is an evidence to say that the wire is pure silver at 5% level of significance.
Confidence Interval Approach : Ex-

A random sample of 12 items is selected from a normal population with variance 4. Sample mean is 10.4. Test
the following hypothesis at 5% level of significance.

𝐻0 ∶ 𝜇 = 15
𝐻1 ∶ 𝜇 ≠ 15

Let’s create the confidence interval for 5% level of significance under 𝐻0 . 5% significance means 95%
confidence should be there.
2.5% 95% 2.5%

𝑍2.5% = −1.96 𝑍7.5% = 1.96

10.4 − 2ൗ 𝑍2.5% , 10.4 + 2ൗ 𝑍2.5% = 9.26 , 11.52


12 12

The parameter under 𝐻0 lies outside the confidence interval. So 𝐻0 will be rejected at 5% level of significance.
Conclusion - There is an evidence to say that the population mean is not equal to 15 at 5% level of significance.
P-Value Approach : Ex-

The average weight of all residents in town ABC is 168 lbs and the standard deviation is 3.9 lbs. A nutritionist
believes the true mean to be different. She measured the weight of 36 individuals and found the mean to be
169.5. Test whether her idea is true or false at 5% level of significance.
𝐻0 ∶ 𝜇 = 168
𝐻1 ∶ 𝜇 ≠ 168

Compute the test statistic under 𝐻0 .

169.5 − 168
Z𝑐𝑎𝑙 = = 2.31
3.9ൗ
36
𝑃𝑧 𝑃𝑧

𝑍𝑐𝑎𝑙 = −2.31 𝑍𝑐𝑎𝑙 = 2.31

𝑃𝑧 = 0.01044
𝑷 − 𝑽𝒂𝒍𝒖𝒆 = 2 × 𝑃𝑧 = 0.02088
𝑷 − 𝑽𝒂𝒍𝒖𝒆 < 𝑆𝑖𝑔𝑛𝑖𝑓𝑖𝑐𝑎𝑛𝑐𝑒 𝐿𝑒𝑣𝑒𝑙 = 0.05

So 𝐻0 will be rejected at 5% level of significance.


Conclusion - There is an evidence to say that the nutritionist’s idea is true at 5% level of significance.

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy