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

testing of hypothesis

testing of hypothesis

Uploaded by

shubhamc16
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
16 views

testing of hypothesis

testing of hypothesis

Uploaded by

shubhamc16
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 52

Hypothesis Testing

Prof Shovan Chowdhury


Terms - Definition
A hypothesis is a statement or assertion or assumption or
claim or belief about the state of nature (about the true value
of an unknown population parameter):
Examples of Hypothesis
• The accused is innocent
• Average size of deal is more than 8 million
USD
• Chance of winning a lead is not the same
for different products
• Average size of deal in Africa is better than
UK

2/4/2024
Examples of Hypothesis

– Average amount spent has increased due to


the campaign
– Brand choice and age are independent
– Average page views under restaurant types
is same
– Demand is normally distributed
– Advertising expenditure impacts sales

2/4/2024
Terms-Definition

A Hypothesis Test is a statistical procedure


that involves formulating a hypothesis and
using sample data to decide on the validity of
the hypothesis (to support or not to support)
Terms-Definition
• A null hypothesis, denoted by H0, is a statement about one or
more population parameters. This is the statement we hold to be
true until we have sufficient statistical evidence to conclude
otherwise.
✓ H0:  = 100
• The alternative hypothesis, denoted by H1, is the assertion of
all situations not covered by the null hypothesis.
✓ H1:   100
• H0 and H1 are:
✓ Mutually exclusive
– Only one can be true.
✓ The null hypothesis (H0) will always state that the parameter
equals the value specified in the alternative hypothesis (H1)
Example
– Average size of a deal is more than 8 million USD
H0: µ ≤ 8
H1: µ > 8

– Average amount spent has increased due to the campaign


H0: µ ≤ 375
H1: µ > 375

– Average size of deal in Africa is more than UK


H0: μA=μU
H1: μA>μU

2/4/2024
Example
– Average credit card balance across ethnic groups is same
H0: μ1=μ2 = μ3
H1: At least one inequality

– Demand is normally distributed


H0: X~N(µ,σ2)
H1: X doesn’t follow normal distribution

– Advertising expenditure impacts sales


H0: ρ=0
H1: ρ >0 Sales=a + b Adv Exp
H0: b=0
H1: b >0
2/4/2024
Example
• Producer of electric bulbs claims that proportion
of defectives in a lot can never be more than 1%.
Wholesaler throws challenge to the claim and
wants to test.
Example
• Producer of electric bulbs claims that proportion
of defectives in a lot can never be more than 1%.
H0: p = 0.01
H1: p > 0.01
Example
• I believe that on an average a PGP student at
IIMK spends 15 hours per week using library
resources
Example
• I believe that on an average a PGP student at
IIMK spends 15 hours per week using library
resources

• H0: μ = 15
H1: μ ≠ 15
Example
Suppose a bank knows that their customers are waiting
in line an average of 10.2 minutes during the lunch
hour. The branch manager has decided to add an
additional teller during the 12-2 p.m. period and wishes
to test the hypothesis that the average wait has
decreased due to the additional teller. Set up the null
and alternative hypothesis for the bank manager.
Example
Suppose a bank knows that their customers are waiting
in line an average of 10.2 minutes during the lunch
hour. The branch manager has decided to add an
additional teller during the 12-2 p.m. period and wishes
to test the hypothesis that the average wait has
decreased due to the additional teller. Set up the null
and alternative hypothesis for the bank manager.

H0: μ = 10.2
H1: μ < 10.2
One-Tailed and Two-Tailed Tests
The tails of a statistical test are determined by the need for an action. If action
is to be taken if a parameter is greater than some value a, then the alternative
hypothesis is that the parameter is greater than a, and the test is a right-tailed/
upper-tail test.
H0:  = 50 H1:   50

If action is to be taken if a parameter is less than some value a, then the


alternative hypothesis is that the parameter is less than a, and the test is a left-
tailed / lower tailed test.
H0:  = 50 H1:   50

If action is to be taken if a parameter is either greater than or less than some


value a, then the alternative hypothesis is that the parameter is not equal to a,
and the test is a two-tailed test. H0:  = 50
H1:   50
Concepts of Hypothesis Testing
• Test Statistic : Test statistic is a sample statistic
computed from sample data. The value of the test statistic
is used in determining whether or not we may reject the
null hypothesis.
A test statistic measures how close the point estimate of
the population parameter is to the null hypotheses value (of
the parameter). This “closeness" is measured in terms of
the standard error of the point estimate.
Test statistic can be sample mean, sample variance, sample
proportion etc.
Example – contd..
•Producer of electric bulbs claim that proportion of
defectives in a lot can never be more than 1%.
H0: p = 0.01
H1: p > 0.01
A wholesaler takes a random sample of 100 bulbs from
the lot and found 3 defectives.

ˆ = 0.3
Test Statistic : Sample proportion= p
Concepts of Hypothesis Testing
• The decision rule of a statistical hypothesis test is a rule
that specifies the conditions under which the null
hypothesis may be rejected.
• Critical Region (ω) : The set of values of the test statistic
which cause us to reject the null hypothesis (H0)
• Rejection of null hypothesis implies that the test is
significant, otherwise is insignificant

Consider H0:  = 15. We may have a decision rule that says:


“Reject H0 if the sample mean is less than 10 or more than 20 hrs.”
Concepts of Hypothesis Testing
There are two possible decisions that can be made:

Conclude that there is enough evidence to support the


alternative hypothesis
(also stated as: rejecting the null hypothesis in favor
of the alternative)

Conclude that there is not enough evidence to reject


Ho
NOTE: we do not say that we accept the null
hypothesis
Concepts of Hypothesis Testing
• A decision may be correct in two ways:
✓Fail to reject a true H0
✓Reject a false H0
• A decision may be incorrect in two ways:
✓Type I Error: Reject a true H0
• The Probability of a Type I error is denoted
by .
✓Type II Error: Fail to reject a false H0
• The Probability of a Type II error is denoted
by .
Concepts of Hypothesis Testing
Errors in Hypothesis Testing
 = P(Reject H 0 H 0 is true)
 = P(Accept H 0 H 0 is false)
One is inversely proportional to the other.
Can not minimize both the errors simultaneously
Hence, we fix P(type I error) at a pre-assigned value
and then minimize P(type II error)
Level of Significance
Upper bound of P(type I error) is called Level of Significance and
is denoted by α.

Level of significance gives maximum allowable error that can


be committed in testing a hypothesis.

Significance level is usually set at 0.05, 0.1 or 0.01.

Significance level tells us how strong the evidence should be for


us to reject H0.
The p-Value
p-value is the probability of getting a test statistic value more
extreme than the observed value (we have obtained), given the
null hypothesis is true.

Smaller p-values represent stronger evidence against the null


hypotheses.

Policy: When the p-value is less than  , reject H0.


Interpreting the p-value
The smaller the p-value, the more statistical evidence exists
to support the alternative hypothesis.
If the p-value is less than 1%, there is overwhelming
evidence that supports the alternative hypothesis.
If the p-value is between 1% and 5%, there is a strong
evidence that supports the alternative hypothesis.
If the p-value is between 5% and 10% there is a weak
evidence that supports the alternative hypothesis.
If the p-value exceeds 10%, there is no evidence that
supports the alternative hypothesis.
We observe a p-value of .0069, hence there is
overwhelming evidence to support H1: > 170.
Power of a Test
The power of a statistical hypothesis test is the
probability of rejecting the null hypothesis when the
null hypothesis is false.

Power = (1 - )

Lesser is the P(type II error), more is the power


One Sample Test
Type of Tests
The type of test is determined by the Alternative
Hypothesis (H1)

Left Tailed Test - H1: parameter < value

Note that the inequality points to the left


Decision Rule: Reject Ho if test statistic < critical value
Type of Tests
The type of test is determined by the Alternative
Hypothesis (H1)

Right Tailed Test - H1: parameter > value

Note that the inequality points to the right


Decision Rule: Reject Ho if test statistic > critical value
Type of Tests
Two Tailed Test - H1: parameter ≠ value

Note that the inequality points to both sides


Decision Rule: Reject H0 if test statistic < critical value
(left) or test statistic > critical value (right)
Six Steps of Hypothesis Testing
Any significance test procedure has five distinct steps

1. Making assumptions
2. Constructing hypotheses
3. Determining the test statistic
4. Constructing critical region
5. Determining p-values
6. Drawing conclusion
Univariate Population
Significance test for
population mean
(when σ is known)
Assumptions :
• A random sample is drawn from a population (normal
distribution) with mean μ and sd σ
• Sample size should be large (small)
• Population sd is known

Hypotheses:
H 0 :  = 0 H 0 :  = 0 H 0 :  = 0
H1 :   0 H 0 :   0 H 0 :   0

Test Statistic: sample mean = x


By CLT,
 2 
x  (~) N   , 
n 
 
x − 0
z obs = ~ N (0,1), under H 0

n
The Critical Value Approach
✓ Determining the critical value(s) depending on the
specification of the competing hypotheses.

Reject H0 if
Reject H0 if z < −z z > z/2 or z < −z/2 Reject H0 if z > z

LO 9.4
Critical Region :
Right tail :  = {zobs  z }
Left tail :  = {zobs  − z }
Two tail :  = {zobs  z / 2 or z  − z / 2 }
Example
An automatic bottling machine fills cola into two liter (2000 cc)
bottles. A consumer advocate wants to challenge this average
amount. A random sample of 40 bottles coming out of the machine
was selected and the exact content of the selected bottles are
recorded. The sample mean was 1999.6 cc. The population
standard deviation is known from past experience to be 1.30 cc.
Test appropriate hypothesis.

Ho :  = 2000
H 1 :   2000
The p-value Approach
✓ Determining the p-value depending on the specification
of the competing hypotheses.

Reject H0 if p-value < level of significance

LO 9.3
Critical value and p-value approaches
lj 0
𝑥−𝜇
Test Statistic : 𝑧𝑜𝑏𝑠 = 𝜎
𝑛

Critical value approach:


𝑥lj − 𝜇0 1999.6−2000
𝑧𝑜𝑏𝑠 = 𝜎 = = − 1.95
1.3
𝑛 40
z0.05 = 1.645 ; zobs < −1.645

p-value approach
𝑝−value = P(Z < −1.95)
= 0.0256 < 0.05
Conclusion: Reject Null i.e. the test is significant
There is sufficient evidence for rejection
Example
I believe that on an average a PGP student at IIMK
spends 15 hours per week using library resources. A
random sample of 8 students were selected and
the average number of hours they spend in the library
came out to be 16.3 hrs. Assuming reading time to follow
normal distribution with sd 3.6 hrs, test a suitable
hypothesis
To test
H0: μ = 15 H1: μ ≠ 15
Critical value and p-value approaches
𝑥lj − 𝜇0 16.3−15
𝑧𝑜𝑏𝑠 = 𝜎 = = 1.02
3.6
𝑛 8
z0.025 = 1.96
zobs < 1.96

𝑝−value = P(Z > 1.02) + P(Z < −1.02)


= 0.1539∗2 = 0.3078 > 0.05
Conclusion:
Do not reject Null i.e. the test is insignificant
There is no enough evidence for rejection of the belief
Significance test for
population mean
(when σ is unknown)
small sample
Assumptions :
• An iid random sample is drawn from normal
distribution with mean μ and sd σ
• Population sd σ is unknown

Hypotheses:

H 0 :  = 0 H 0 :  = 0 H 0 :  = 0
H1 :   0 H 0 :   0 H 0 :   0

Test Statistic: sample mean= x ;


σ needs to be estimated. Unbiased estimator of σ is
n
1
̂ = s ' = 
n − 1 i =1
( xi − x ) 2
   ( n − 1) s
2 '2
x ~ N  ,
 
; ~  n −1
2

 n   2

x − 0
tobs = '
~ t n −1 , under H 0
s
n
This test statistic has a t distribution
with n - 1 degrees of freedom.
Critical Region :
Right tail :  = {tobs  t ;n −1}
Left tail :  = {tobs  −t ;n −1}
Two tail :  = {tobs  t / 2;n −1 or tobs  −t / 2;n −1}
Example
A State Highway Patrol periodically samples
vehicle speeds at various locations on a particular
roadway. The sample of vehicle speeds is used to
test the hypothesis H0: µ < 65.
The locations where H0 is rejected are deemed the
best locations for radar traps. At Location F, a
sample of 64 vehicles shows a mean speed of 66.2
mph with a standard deviation of 4.2 mph. Test
suitable hypothesis at 5% level of significance
Critical and p-value approaches

1. Determine the hypotheses. H0: µ < 65


Ha: µ> 65

2. Specify the level of significance. α = .05

3. Compute the value of the test statistic.

𝑥lj − 𝜇0 66.2 − 65
𝑡= = = 2.286
𝑠/ 𝑛 4.2/ 64
Critical value approach

4. Determine the critical value and rejection rule.

For α = .05 and d.f. = 64 – 1 = 63, t.05,63 = 1.669


Reject H0 if t > 1.669

5. Determine whether to reject H0.


Because 2.286 > 1.669, we reject H0.
We are at least 95% confident that the mean speed of
vehicles at Location F is greater than 65 mph. Location
F is a good candidate for a radar trap.
p-value approach

4. Compute the p –value.

For t = 2.286, need to calculate P(t>2.286).


the p–value is found to be less than .025 (for t = 1.998)
and greater than .01 (for t = 2.387).
.01 < p–value < .025
5. Determine whether to reject H0.
Because p–value < α = .05, we reject H0.
We are at least 95% confident that the mean speed
of vehicles at Location F is greater than 65 mph.
Graphical Presentation

Reject H0

Do Not Reject H0
 = 

t
0 t =
1.669
Example
New software companies that create programs for world wide web applications believe
that average staff age at these companies is 27. A random sample of 18 staff is chosen
from these companies and their age is given as follows: 41, 18, 25, 36, 26, 35, 24, 30, 28,
19, 22, 22, 26, 23, 24, 31, 22, 22. Test appropriate hypothesis.

H0:  = 27 n = 18
H1:   27 x = 26.3
n = 18 s = 6.15
For  = 0.05 and (18-1) = 17 df , x −  26.3 - 27
critical values of t are ±2.11 t = s 0 = 6.15
obs
x − 0 n 18
The test statistic is: t =
s = − 0.48  Do not reject H
n 0
Equivalence between Hypothesis
tests and Confidence intervals
The main idea is that a two-sided hypotheses test will give us
exactly the same conclusion (about the population parameter) as
a confidence interval
If we test H0: θ = θ0 vs H1: θ ≠ θ0 and fail to reject H0 at
significance level (=0.01/0.05/0.1), then the corresponding
100(1−)% (99%, 95%, 90%) confidence interval will contain
the null value (i.e θ0).

95% CI of 𝜇
[26.3−(2.11∗6.15/ 18) , 26.3−(2.11∗6.15/ 18)]
[23.46 , 29.14]

You might also like