Hypo Test
Hypo Test
• Alternative denoted 𝐻 or 𝐻
usually opposite of Null
that for which we need empirical evidence
Idea: Unless data evidence strongly favors Alternative, we will not reject Null
Example 1
A pharma company wants to demonstrate to the regulator that, on consuming its
new drug for 30 days, the average reduction in triglyceride level (𝜇) is more than 40
units. Which one of the following is the correct formulation of null and alternative?
a) 𝐻 : 𝜇 ≥40, 𝐻 : 𝜇 <40
x
b) 𝐻 : 𝜇 ≤ 40, 𝐻 : 𝜇 > 40
c) 𝐻 : 𝜇 = 40, 𝐻 : 𝜇 ≠ 40
d) 𝐻 : 𝜇 ≠ 40, 𝐻 : 𝜇 = 40
Example 2
Currently the proportion (𝑝) of dissatisfied employees in a company is believed to
be more than 30%. Recently, several new HR incentive schemes were introduced.
The company wanted to test if the proportion of dissatisfied employees has now
decreased. Based on a random sample of 100 employees it was found that 𝑝̂ = .28
of employees are dissatisfied. Which one of the following is the correct formulation
of null and alternative?
Quo
a) 𝐻 : 𝑝 ≥ 0.3, H : p < 0.3 status
know abtpopl
b) 𝐻 : 𝑝 ≥ 0.28, H : p < 0.28 is to Nullthypt
Antension in
c) 𝐻 : 𝑝 ≤ 0.3, H : p > 0.3
always is
d) 𝐻 : 𝑝 ≤ 0.28, H : p > 0.28 to
e) 𝐻 : 𝑝̂ ≥ 0.3, H : 𝑝̂ < 0.3 Equal
f) 𝐻 : 𝑝 = 0.3, H : p ≠ 0.3
g) 𝐻 : 𝑝̂ ≤ 0.3, H : 𝑝̂ > 0.3
Example 3
A production process for manufacturing has been running smoothly for many months. The
machine is designed to manufacture screws of expected length (𝜇) of 2cm. If at any time
there is evidence to suggest the average has deviated from intended design, the machine
has to be stopped, checked for issues and recalibrated if need be, which involves significant
cost. A testing process is put in place to check this, based on a random sample of 35
screws manufactured in each batch and computing the average length (𝑥)̅ in the sample.
Which one of the following is the correct formulation of null and alternative?
w̅ test form
a) 𝐻 : 𝑥̅ = 2, 𝐻 : 𝑥̅ ≠ 2 We don't testfor we
w̅
b)
c)
𝐻 : 𝜇 = 2, 𝐻 : 𝜇 ≠ 2
𝐻 : 𝜇 ≠ 2, 𝐻 : 𝜇 = 2
d) 𝐻 : 𝜇 ≥ 2, 𝐻 : 𝜇 < 2
e) 𝐻 : 𝑥̅ ≠ 2, 𝐻 : 𝑥̅ = 2
f) 𝐻 : 𝜇 ≤ 2, 𝐻 : 𝜇 > 2
Hypothesis Testing
for Proportions
2-sided test at 5% significance level
To test this, a sample of n=40 will be taken and 𝑝̂ will be computed after sample is
obtained.
is true
if Ho
Even
Is it necessary that 𝑝̂ that will result from the sample be same as ?
r
2-sided test at 5% significance level
To test this, a sample of n=40 will be taken and 𝑝̂ will be computed after sample is
obtained.
If H0 is TRUE, Is it necessary that 𝑝̂ that will result from the sample be same as ?
Not Necessarily
1
Possible values of 𝑝̂
3
2-sided test at 5% significance level
To test this, a sample of n=40 will be taken and 𝑝̂ will be computed after sample is
obtained.
If H0 is TRUE, Is it necessary that 𝑝̂ that will result from the sample be same as ?
Not Necessarily
So, instead of checking whether 𝑝=1/3,
̂ we
will give a buffer and check if either
𝑝̂ < − 𝑐 or 𝑝̂ > + 𝑐
1 values of 𝑝̂ 1 1
Possible
−𝑐 +𝑐
3 3 3
2-sided test at 5% significance level
To test this, a sample of n=40 will be taken and 𝑝̂ will be computed after sample is
obtained.
If H0 is TRUE, Is it necessary that 𝑝̂ that will result from the sample be same as ?
Not Necessarily
So, instead of checking whether 𝑝=1/3,
̂ we
will give a buffer and check if either
𝑝̂ < − 𝑐 or 𝑝̂ > + 𝑐 Reject H0 if 𝑝̂ falls Reject H0 if 𝑝̂ falls
here here
1 values of 𝑝̂ 1 1
Possible
−𝑐 +𝑐
3 3 3
2-sided test at 5% significance level
Suppose we want to test H : 𝑝 = vs. H : 𝑝 ≠
To test this, a sample of n=40 will be taken and 𝑝̂ will be computed after sample is
obtained.
If H0 is TRUE, Is it necessary that 𝑝̂ that will result from the sample be same as ?
Not Necessarily
To test this, a sample of n=40 will be taken and 𝑝̂ will be computed after sample is
obtained.
If H0 is TRUE, Is it necessary that 𝑝̂ that will result from the sample be same as ?
Not Necessarily
×( )
Reject H if 𝑝̂ is outside: ± 1.96
P 71.96s
(Equivalently) Reject H if |z|= > 1.96 [note: 1.96=97.5th pctile of N(0,1)]
×( )
Heuristic:
We will reject H0 if sample proportion turns out to be too far from the hypothesized value
of 1/3
Upper(or Right)-tail test at 5% significance level
H :𝑝 ≤ vs. H : 𝑝 >
Heuristic: We will reject H0 if sample proportion turns out to be too far to the right of hypothesized
value of 1/3
×( )
Reject H if 𝑝̂ > + 1.645
IF
3 3
Lower(or Left)-tail test at 5% significance level
H :𝑝 ≥ vs. H : 𝑝 <
Heuristic: We will reject H0 if sample proportion turns out to be too far to the left of hypothesized
value of 1/3
×( )
Reject H if 𝑝̂ < − 1.645
1 values of 𝑝̂ 1
Possible−𝑐
3 3
Use Case 1: Complaints on utility services
A government department handled complaints from citizens related to a utility
service. There was a concern that many complaints were not resolved satisfactorily
in time. The head of the department introduced a new process wherein she held
the senior officers of different functions accountable for the complaints requiring
them to give a weekly update on the same, while promising all support in terms of
resources required for their efficient functioning. Her goal was to reduce
percentage complaints not resolved satisfactorily in time, to less than 10%. To see
whether the changes have helped achieve her goal, she conducted a survey on 200
randomly chosen consumers who had filed complaints post the changes. 19 of
them reported that their complaints were not resolved satisfactorily in time. Is
there statistical evidence at 5% level to support that the goal of the department
head has been achieved?
unresolved complaints on 2200
P 2 prop of I If
Ho 0 1 µ true
p
i
H p c o L
0.0651
0 0950
obtsvalue
Use Case 2: Free Dinner Incentive
A large company decided to provide free dinner to all those employees who had to
stay back late due to work beyond 8:30 pm. They had consistently seen that about
30% of employees stayed back beyond this time and it would be a nice
thankfulness gesture. To engage a caterer it was important for the company to
commit and pay upfront for the volume of food required, which was of course
directly dependent on the proportion “p” who would stayed back beyond 8:30 pm.
It was important for the company to monitor this proportion. While the proportion
was believed to be stable, if at all it changed significantly, it would result in either
over or under supply of required food. The company decided to take a sample of
300 employees every week to test this. What should be the null and alternative
hypothesis, what is the testing rule based on 𝑝̂ at 1% level?.
If in a given week, the sample proportion turned out to be 0.27, what would you
conclude from the test?
p 0 3
Ho Ho
H 0 3
p
any.se
3 I S
P o 3 a 0.27 0.3
I Don't eject
l
o 27 3 50
Norm in
0.955,0
2 57
P-value
Test rule (in terms of test-statistic) is usually stated as
“ reject H0 if test statistic is beyond some cut-off”
em
Mphl
P-value
The test rule can be stated either
in terms of test-statistic :
2-sided test:“Reject H0 if |𝑝-1/3|>c”
̂ [c chosen to ensure level=alpha]
Upper tail test: "Reject H0 if 𝑝>c”
̂ [c chosen to ensure level=alpha]
OR
equivalently in terms of P-value as
“Reject H0 if P-value < alpha”
P-value for Lower tail test, e.g. 𝐻 : 𝑝 <
𝒑 𝟏/𝟑
𝒏𝒐𝒕𝒆: 𝒊𝒏 𝒕𝒉𝒆 𝒑𝒊𝒄𝒕𝒖𝒓𝒆, 𝒕𝒆𝒔𝒕 𝒔𝒕𝒂𝒕𝒊𝒔𝒕𝒊𝒄 𝒊𝒔 𝒕𝒂𝒌𝒆𝒏 𝒕𝒐 𝒃𝒆
𝑺𝑬
FI
Et
If the company wanted the power of the test (at p=0.25) to be 90% what should be the
sample size?
i
i
Concepts of Hypothesis Testing
• Null and Alternative Hypothesis
• Type I Error and Significance Level
• Type II Error and Power
̅
Test statistic= t-statistic =
/√
̅
Test statistic= t-statistic =
/√
̅
Test statistic= t-statistic =
/√