Hypothesis

Download as pdf or txt
Download as pdf or txt
You are on page 1of 71

Business Statistics

Hypothesis Tests
Hypothesis Testing
• Hypothesis testing can be used to determine whether a statement about the
value of a population parameter should or should not be rejected.
• The null hypothesis, denoted by H0 , is a tentative assumption about a
population parameter.
• The alternative hypothesis, denoted by Ha, is the opposite of what is stated
in the null hypothesis.
• The hypothesis testing procedure uses data from a sample to test the two
competing statements indicated by H0 and Ha.
Objective of Hypothesis Testing
The objective of hypothesis testing is to either reject or
retain a null hypothesis.

In many cases, for example, in regression models, one


would like to reject the null hypothesis to establish
statistically significant relationship between the
dependent and the independent variable.

However, in goodness of fit tests, that are used for


checking whether the data follows a specific distribution
or not, we would like to retain the null hypothesis.
INTRODUCTION TO HYPOTHEIS TESTING

Hypothesis testing is a statistical process of either rejecting or


retaining a claim or belief or association related to a business
context, product, service, processes, etc
INTRODUCTION TO HYPOTHEIS TESTING

• Hypothesis test consists of two complementary


statements called null hypothesis and alternative
hypothesis, and only one of them is true

• Hypothesis is an integral part of many predictive


analytics techniques such as multiple linear
regression and logistic regression
IMPORTANCE OF HYPOTHESIS TESTING
• Hypothesis is an integral part of many predictive analytics techniques such as
multiple linear regression and logistic regression.
• It plays an important role in providing evidence of an association relationship
between an outcome variable and predictor variables.

Few examples of such claims are listed below:

• Children who drink the health drink Complan (a health drink owned by the
company Heinz in India) are likely to grow taller
• If you drink Horlicks, you can grow taller, stronger, and sharper (3 in 1).
• Beautiful people are likely to have girl child (Miller and Kanazawa, 2007).
Description of Hypothesis
Hypotheses are claims that are usually stated in simple
words as listed below:
• Average annual salary of machine learning experts is
different for males and females.
• On average people with Ph.D. in analytics earn more
than people with Ph.D. in engineering.
• The average box-office collection of comedy genre
movies is more than that of action movies.
• Average life of vegetarians is more than meat eaters.
• Proportion of married people defaulting on loan
repayment is less than proportion of singles defaulting
on loan repayment.
Null and Alternative Hypothesis

• Null hypothesis, usually denoted as H0 (H zero and H


naught), refers to the statement that there is no
relationship or no difference between different groups
with respect to the value of a population parameter.

• Alternative hypothesis, usually denoted as HA (or H1), is


the complement of null hypothesis.
Hypothesis statement to definition of null and alternative
hypothesis
S. No. Hypothesis Description Null and Alternative Hypothesis
1 Average annual salary of machine learning H0: m = f
experts is different for males and females. HA: m  f
m and f are average annual salary of male and
(In this case, the null hypothesis is that there is female machine learning experts, respectively.
no difference in male and female salary of
machine learning experts)
H0: a  e
2 On average people with Ph.D. in analytics earn
HA: a > e
more than people with Ph.D. in engineering.
a = Average annual salary of people with Ph.D. in

analytics.

e = Average annual salary of people with Ph.D. in

engineering.

It is essential to have the equal sign in null hypothesis


statement.
Hypothesis Testing
Hypothesis test checks the validity of the null hypothesis
based on the evidence from the sample. At the beginning of
the test, we assume that the null hypothesis is true. Since
the researcher may believe in alternative hypothesis, she/he
may like to reject the null hypothesis. However, in many
cases (such as goodness of fit tests), we would like to retain
or fail to reject the null hypothesis.
One-Tailed and Two-Tailed Test
Consider the following three hypotheses

1. Salary of machine learning experts on average is at


least US $100,000.
2. Average waiting time at the London Heathrow
airport security check is less than 30 minutes.
3. Average annual salaries of male and female MBA
students are different at the time of graduation.
Example 1
Statement 1  Salary of machine learning experts on
average is at least US $100,000:
The null and alternative hypotheses in this case are given
by

H0: m  100,000
HA: m > 100,000

where m is the average annual salary of machine learning


experts. Note that the equality symbol is always part of
the null hypothesis since we have to measure the
difference between estimated value from the sample and
the hypothesis value. In this case, reject or retain decision
will depend on the direction of deviation of the estimated
parameter from the sample from hypothesis value.
Solution
Below figure shows the rejection region on the right side
of the distribution. Since the rejection region is only on
one side this is a one-tailed test (right tailed test).
Specifically, since the alternative hypothesis in this case is
m > 100,000, this is called right-tailed test.
Example 2
• Statement 2  Average waiting time at the London
Heathrow airport security check is less than 30 minutes:
The null and alternative hypotheses in this case are given
by
H0: w  30
HA: w < 30

where w is the average waiting time at London Heathrow


security check. In this case, reject region will on the left
side (known as left tailed test) of the distribution as shown
in Figure
Solution

Rejection region in case of left-sided test


Example 3
Statement 3  Average salary of male and female MBA students
at graduation is different:

The null and alternative hypotheses in this case are given by


H0: m = f
HA: m  f

Where m and f are the average salaries of male and female


MBA students, respectively, at the time of graduation.
In this case, the rejection region will be on either side of the
distribution and if the significance level is  then the rejection
region will be /2 on either side of the distribution. Since the
rejection region is on either side of the distribution, it will be a
two-tailed test.
Solution

Rejection region in case of two-tailed test


Decisions of Hypothesis Test
In hypothesis test we end up with the following two
decisions:

• Reject null hypothesis.

• Fail to reject (or retain) null hypothesis.

Type I Error, Type II Error, and Power of the Hypothesis Test


TYPE I ERROR
Type I Error: Conditional probability of rejecting a null hypothesis when it is
true is called Type I Error or False Positive (falsely believing claim made in
alternative hypothesis is true). The significance value  is the value of Type I
error.

Type I Error = = P(Rejecting null hypothesis | H0 is true)

• Probability value (p-value) is the evidence against the null hypothesis


whereas significance value  is the error based on repetitive sampling.
• Whereas the significance level  refers to incorrect rejection of null
hypothesis when it is true under repeated trials.
TYPE II ERROR
• Type II Error: Conditional probability of failing to reject a
null hypothesis (or retaining a null hypothesis) when the
alternative hypothesis is true is called Type II Error or
False Negative (falsely believing there is no relationship).
Usually Type II error is denoted by the symbol .
Mathematically, Type II error can be defined as follows:

Type II Error =  = P(Retain null hypothesis | H0 is false)


Description of Type I error, Type II error, and the Power
of Test

Decision made about null hypothesis based on the hypothesis test

Actual value of H0 Reject H0 Retain H0

H0 is true Type I error Correct Decision

P(Reject H0|H0 = true) =  P(Retain H0|H0 = true) = (1  )

H0 is false Correct Decision (Power of test) Type II Error

P(Reject H0|H0 = false) = 1   P(Retain H0|H0 = false) = 


Test Statistic
• Test statistic is the standardized difference between the estimated value of
the parameter being tested calculated from the sample(s) and the

hypothesis value (that is standardized difference between X and ) in
order to establish the evidence in support of the null hypothesis.

• It measures the standardized distance (measured in terms of number of


standard deviations) between the value of the parameter estimated from
the sample(s) and the value of the null hypothesis.
P - Value
• The p-value is the conditional probability of
observing the statistic value when the null hypothesis
is true.

• For example, consider the following hypothesis:


Average annual salary of machine learning experts is at
least 100,000. The corresponding null hypothesis is H0:
 m  100,000. Assume that estimated value of the
salary from a sample is 1,10,000 (that isX  1,1 0, 0 0 0 and
assume that the standard deviation of population is
known and standard error of the sampling distribution
is 5000 (that is, / n  5000 where n is the sample size
using which X 1,10,000 was calculated).
Hypothesis Testing
• The standardized distance between estimated salary from
hypothesis salary is (1,10,000 – 1,00,000)/5000 = 2.

• That is, the standardized distance between estimated value


and the hypothesis value is 2 and we can now find the
probability of observing this statistic value from the sample
if the null hypothesis is true (that is if m  100,000).

• A large standardized distance between the estimated value


and the hypothesis value will result in a low p-value.

• Note that the value 2 is actually the value under a standard


normal distribution since it is calculated from

X  
 / n
Standard normal distribution and the p-value
corresponding to Z = 2 are shown below:
Hypothesis Testing
• Probability of observing a value of 2 and higher from a
standard normal distribution is 0.02275.

• That is, if the population mean is 1,00,000 and standard


error of the sampling distribution is 5000 then probability of
observing a sample mean greater than or equal to 1,10,000
is 0.02275.

• The value 0.02275 is the p-value, which is the evidence in


support of the statement in the null hypothesis.

p-value = P(Observing test statistics value | null hypothesis is


true)
P-value
Note that the p-value is a conditional probability. It

is the conditional probability of observing the statistic

value given that the null hypothesis is true. P-value is

the evidence in support of null hypothesis.


Decision Criteria – Significance Value

• Significance level, usually denoted by , is the criteria used


for taking the decision regarding the null hypothesis (reject
or retain) based on the calculated p-value.

• The significance value  is the maximum threshold for p-


value.

• The decision to reject or retain will depend on whether


the calculated p-value crosses the threshold value  or not
Decision making under hypothesis testing

Criteria Decision

p-value <  Reject the null hypothesis

p-value   Retain (or fail to reject) the null hypothesis


• Usually  = 0.05 is used by researchers (recommended by
Fisher, 1956); however, values such as 0.1, 0.02, and 0.01 are
also frequently used.

• The value of  chosen is very low (0.05) for reason that we


start the process of hypothesis testing with an assumption that
null hypothesis is true

• The value of statistic for which the probability is  is called the


critical value.

• The areas beyond the critical values are known as rejection


region.
Significance Value ()

The significance value  is the threshold conditional

probability of rejecting a null hypothesis when it is

true. It is the value of Type I error.


Hypothesis Testing for Population Mean with known
Variance: Z-Test
• Z-test (also known as one-sample Z-test) is used when a
claim (hypothesis) is made about the population parameter
such as population mean or proportion when population
variance is known.
• Since the hypothesis test is carried out with just one sample,
this test is also known as one-sample Z-test.
• Z-test uses CLT to conduct a hypothesis test for population
mean when the population variance is known; the test
statistics for Z-test is given by

Z-statistic = X  
 / n
• The critical value in this case will depend on the significance
value  and whether it is a one-tailed or two-tailed test
Condition for rejection of null hypothesis H0

Type of Test Condition Decision

Left-tailed test p-value < α Reject H0

p-value > α Retain H0

Right-tailed test p-value < α Reject H0

p-value > α Retain H0

Two-tailed test p-value < α/2 Reject H0

p-value > α/2 Retain H0


Example
• An agency based out of Bangalore claimed that the
average monthly disposable income of families
living in Bangalore per month is greater than INR
4200 with a standard deviation of INR 3200. From
a random sample of 40,000 families, the average
disposable income was estimated as INR 4250.
Assume that the population standard deviation is
INR 3200. Conduct an appropriate hypothesis test
at 95% confidence level ( = 0.05) to check the
validity of the claim by the agency.
Solution
Claim: Average disposable income is more than INR 4200.
Let  and  denote the mean and standard deviation in the population. The
corresponding null and alternative hypotheses are
H0:   4200
HA:  > 4200
Since we know the population standard deviation, we can use the Z-test
This is a right-tailed test.
p-value (area based on given sample information)
� 3200
� = 4200, � = 4250, � = 3200, � = 40000, �� ̅ = =
� 40000
3200
p-value =1-norm.dist(4250,4200, ,1)=0.000889
40000
Solution Continued…
The corresponding p-value = 0.00088
If significance level α=0.05 then p-value< α. So reject
null hypotheses.
Example
A passport office claims that the passport applications
are processed within 30 days of submitting the
application form and all necessary documents. Table 6.6
shows processing time of 40 passport applicants. The
population standard deviation of the processing time is
12.5 days.
Conduct a hypothesis test at significance level  = 0.05 to
verify the claim made by the passport office.

16 16 30 37 25 22 19 35 27 32

34 28 24 35 24 21 32 29 24 35

28 29 18 31 28 33 32 24 25 22

21 27 41 23 23 16 24 38 26 28
Solution
Null and alternative hypotheses in this case are given by
H0:   30
HA:  < 30
From the data in Table 6.6, the estimated sample mean is
27.05 days.
The standard deviation of the sampling distribution is 12.5.
This is left tail problem.
� 12.5
� = 30, � = 27.05, � = 12.5, � = 40, �� ̅ = =
� 40
12.5
P-value= norm.dist(27.05,12.5, 40
,1)= 0.067772
Solution Continued…
•  = 0.05
• The p-value is greater than the value of . So, we fail to reject the null
hypothesis.
• That is, there is no strong evidence against null hypothesis so we
retain the null hypothesis, which is   30
Example
According to the company IQ Research, the average
Intelligence Quotient (IQ) of Indians is 82 derived based
on a research carried out by Professor Richard Lynn, a
British Professor of Psychology, using the data collected
from 2002 to 2006 (Source: IQ Research). The population
standard deviation of IQ is estimated as 11.03. Based on
a sample of 100 people from India, the sample IQ was
estimated as 84.
(a) Conduct an appropriate hypothesis test at  = 0.05 to
validate the claim of IQ Research (that average IQ of
Indians is 82).
(b) Ministry of education believes that the IQ is more
than 82. If the actual IQ (population mean) of Indians is
86, calculate the Type II error and the power of
hypothesis test.
Solution
a)Hypothesis test: It is given that  = 82,  = 11.03, n = 100, and
X =84. � = � = 11.03
�̅ � 100
The null and alternative hypotheses in this case are:
H0:  = 82
HA:   82
Since the direction of alternative hypothesis is both ways, we have a two-
tailed t-test.
X is 84 which is greater than  = 82. So, we have to find right side area
for sample information. According to confidence level=95% the right side
area α/2=5%/2=0.025
P-value=0.034898, p-value > α/2. So, fail to reject null hypothesis.
Statistic, critical values, and the rejection region
Hypothesis Testing for Population Proportion:
Z-Test for Proportion
According to the central limit theorem of proportions,
the sampling distribution of proportions p̂ for a large
sample follows an approximate normal distribution with
mean p (the population proportion) and standard
deviation p ( 1 n p ).

To calculate the standard deviation p (1  p ) we need the


n
knowledge of p. However, we can use the value of p̂ estimated
from large samples. One of the thumb rules used is that the
 
value of n  p (1  p)  10 to use.
Example
According to a study exactly 12% of gift cards purchased
from e-commerce portals are never used. The manager of
an e-commerce company wanted to test whether this claim
is true. She collected data of 250 gift card purchases and
found that 22 gift cards were not used till its expiry data.

(a) Conduct an appropriate hypothesis test to check


whether the claim that exactly 12% gift cards are never used
is true or not.
(b) Calculate the 95% confidence interval for the proportion
of gift cards that are not used.
Solution
ØThe estimated value of proportion of gift cards not used is
22
pˆ   0.088
250
n  pˆ  (1  pˆ )  2 5 0  0 .0 8 8  (1  0 .0 8 8 )  2 0 .0 6 4  1 0
so we can use 
p to calculate the population standard deviation.

a) The initial claim is that the percentage of unused gift cards in


equal to 12%. The null and alternative hypotheses are
H0: p = 0.12
HA: p  0.12
The value of the Z-statistic is given by
� 1−�
p= 12, � = . 088, � = 250, �� ̅ = = 0.020552
√�
Left value in 95% confidence level=p1= norm.inv(.025,12, . 020552)= 0.079718
right value in 95% confidence level=p2= norm.inv(.975,12, . 020552)= 0.160282
Hypothesis Test for Population Mean Under Unknown Population
Variance: t-Test

• We use the fact that a sampling distribution of a


sample from a population that follows normal
distribution with unknown variance follows a t-
distribution with (n  1) degrees of freedom.

• In many cases the population variance (and thus the


standard deviation) will not be known. In such cases we
will have to estimate the variance using the sample
itself.

• Let S be the standard deviation estimated from the


sample of size n.
t-test continued…
X  
• Then the statistic S / n will follow a t-distribution
with (n  1) degrees of freedom if the sample is drawn
from a population that follows a normal distribution.

• Here 1 degree of freedom is lost since the standard


deviation is estimated from the sample.

• Thus, we use the t-statistic (hence the test is called t-


test) to test the hypothesis when the population
standard deviation is unknown
t-statistic = X  
S / n
Example
Aravind Productions (AP) is a newly formed movie
production house based out of Mumbai, India. AP was
interested in understanding the production cost required
for producing a Bollywood movie. The industry believes
that the production house will require at least INR 500
million (50 crore) on average. It is assumed that the
Bollywood movie production cost follows a normal
distribution. Production cost of 40 Bollywood movies in
millions of rupees are shown in Table 6.7. Conduct an
appropriate hypothesis test at  = 0.05 to check whether
the belief about average production cost is correct.
Production cost of Bollywood movies

601 627 330 364 562 353 583 254 528 470

125 60 101 110 60 252 281 227 484 402

408 601 593 729 402 530 708 599 439 762

292 636 444 286 636 667 252 335 457 632
Solution
It is given that the production cost of Bollywood movies
follows a normal distribution; however, the standard
deviation of the population is not known and we need to
estimate the standard deviation value from the sample.
Thus, we have to use the t-test for testing the hypothesis.
From the sample data in Table we get the following values:
n = 40, X =429.55, and S = 195.0337

The null and alternative hypotheses are


• H0:   500
• HA:  > 500
Solution Continued…
The corresponding test statistic is

X  429.55  500
t - statistic     2.2845
S / n 195.0337 / 40

Note that this is a one-tailed test (right-tailed), So x-axis


value=-2.2845.  = 0.05.
p-value= 1-T.DIST(-2.2845,39,1)= 0.986067 .
P-value>  . So retain (accept) null hypothesis.
Solution Continued…
Example
According to statistics released by the Department of
Civil Aviation, the average delay of flights is equal to
16.8 minutes, flight delays are assumed to follow a
normal distribution. However, from a sample of 50
flights, the average delay was estimated to be 19.5
minutes and the sample standard deviation was 6.6
minutes.
Conduct a hypothesis test to disprove the claim that
the average delay is equal to 16.8 minutes at  = 0.01.
Solution
_
Given n = 50, X  19.5 , S = 6.6.
Null and alternative hypotheses are
H0:  = 16.8
HA:   16.8
The corresponding t-statistic value is

X   1 9 .5  1 6 .8
t    2 .8 9 2 7
S / n 6 .6 / 50
Solution Continued…
• The critical t-value for two-tailed t-test when  = 0.01 and
degrees of freedom = 49 is 2.67
• Since the calculated t-statistic value is greater than the t-critical
value, we reject the null hypothesis. The corresponding p-value is
0.0057. The values of t-statistic, t-critical value, rejection and
retention regions are shown in Figure
One-Tailed Tests About a Population Mean: σ
Known
Example: Metro EMS

The response times for a random sample of 40 medical emergencies were


tabulated. The sample mean is 13.25 minutes. The population standard
deviation is believed to be 3.2 minutes.

The EMS director wants to perform a hypothesis test, with a .05 level of
significance, to determine whether the service goal of 12 minutes or less is
being achieved.

56
One-Tailed Tests About a Population Mean: σ
Known
1. Develop the hypotheses.

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

3. Compute the p-value.


One-Tailed Tests About a Population Mean: σ
Known
p –Value Approach

p-value = = 0.0068

5. Determine whether to reject H0.


Because p-value = 0.0068 ≤ α = 0.05, we reject H0.
There is sufficient statistical evidence to infer that Metro EMS is not meeting the
response goal of 12 minutes.
One-Tailed Tests About a Population Mean: σ
Known
p –Value Approach
Two-Tailed Tests About a Population Mean: σ
Known
Example: Glow Toothpaste
The production line for Glow toothpaste is designed to fill tubes with a mean weight of 6 oz.
Periodically, a sample of 30 tubes will be selected in order to check the filling process.
Quality assurance procedures call for the continuation of the filling process if the sample
results are consistent with the assumption that the mean filling weight for the population of
toothpaste tubes is 6 oz.; otherwise the process will be adjusted.
Assume that a sample of 30 toothpaste tubes provides a sample mean of 6.1 oz. The
population standard deviation is believed to be 0.2 oz.
Perform a hypothesis test, at the 0.03 level of significance, to help determine whether the
filling process should continue operating or be stopped and corrected.
Two-Tailed Tests About a Population Mean: σ
Known
1. Develop the hypotheses.

2. Specify the level of significance. α = 0.03

3. Compute the p-value of the test statistic.


Two-Tailed Tests About a Population Mean: σ
Known
p –Value Approach
Compute the p –value.

p-value = = 0.0062

Determine whether to reject H0.


Because p-value = 0.0062 ≤ α = 0.03, we reject H0.
There is sufficient statistical evidence to infer that the alternative hypothesis is true
(i.e. the mean filling weight is not 6 ounces).
Two-Tailed Tests About a Population Mean: σ
Known
p-Value Approach
Confidence Interval Approach to Two-Tailed Tests About a Population Mean
• Select a simple random sample from the population and use the value
of the sample mean � to develop the confidence interval for the
population mean μ. (Confidence intervals are covered in Chapter 8.)
• If the confidence interval contains the hypothesized value μ0, do not
reject H0. Otherwise, reject H0. (Actually, H0 should be rejected if μ0
happens to be equal to one of the end points of the confidence interval.)
Example: Highway Patrol
One-Tailed Test About a Population Mean: σ Unknown

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. Use α = 0.05 to test the hypothesis.
One-Tailed Test About a Population Mean: σ
Unknown
1. Develop the hypotheses.

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

3. Compute the p-value of the test statistic.


One-Tailed Test About a Population Mean: σ
Unknown
p –Value Approach
4. Compute the p –value.

5. Determine whether to reject H0.


Because p-value < α = 0.05, we reject H0.
We are at least 95% confident that the mean speed of vehicles at Location F is
greater than 65 mph.
One-Tailed Test About a Population Mean: σ
Unknown
Two-Tailed Test About a Population Proportion
Example: National Safety Council (NSC)

For a Christmas and New Year’s week, the National Safety Council estimated
that 500 people would be killed and 25,000 injured on the nation’s roads. The
NSC claimed that 50% of the accidents would be caused by drunk driving.

A sample of 120 accidents showed that 67 were caused by drunk driving. Use
these data to test the NSC’s claim with α = 0.05.
Two-Tailed Test About a Population Proportion
Two-Tailed Test About a Population Proportion
p –Value Approach
4. Compute the p –value.

p-value = 2(1 – 0.8997) = 0.2006.

5. Determine whether to reject H0.


Because p-value = 0.2006 > α = 0.05, we cannot reject H0.
We do not have convincing evidence that the true proportion of accidents that would
be caused by drunk driving is different than 50%.

You might also like