0% found this document useful (0 votes)
46 views55 pages

3 Testing1

Download as pptx, pdf, or txt
Download as pptx, pdf, or txt
Download as pptx, pdf, or txt
You are on page 1/ 55

Testing of Statistical Hypothesis

(One Sample Tests)

• Concept of Hypothesis testing


• Hypothesis testing for mean
• Hypothesis testing for proportion
• Hypothesis testing for variance
• Power of the test

Gaurav Garg (IIM Lucknow)


The Hypothesis

• Research Hypothesis
 a statement of what the researcher believes will be
the outcome of an experiment or a study

• Statistical Hypothesis
 a formal structure used to statistically (based on a
sample) test the research hypothesis

Gaurav Garg (IIM Lucknow)


• Examples of Research Hypotheses

 Older workers are more loyal to a company.

 Companies with more than $1 billion of assets spend


a higher percentage of their annual budget on
advertising than do companies with less than $1
billion of assets.

Gaurav Garg (IIM Lucknow)


Statistical Hypotheses
• A claim (assumption) about a population
parameter
• Examples:
 The average monthly cell phone bill of the people in
Lucknow is Rs. 1000.00
 The proportion of children below 10 years in this city
with cell phones is more than 0.80
• Statistical Hypothesis has two parts
 Null Hypothesis
 Alternative Hypothesis
Gaurav Garg (IIM Lucknow)
The Null Hypothesis
• Denoted as H0
• Nothing new is happening
• The null condition exists
• It refers to the status quo (current or existing state of
affairs)
• Similar to the notion of innocent until proven guilty
• Usually a hypothesis of no difference.
• Example: The average number of TV sets in U.S.
Homes is equal to three. H0: μ = 3
• Begin with the assumption that the H0 is true
• It is tested for rejection or acceptance.
Gaurav Garg (IIM Lucknow)
The Alternative Hypothesis
• Denoted as H1 or Ha
• Something new is happening
• It is the opposite of the null hypothesis
 E.g., The average number of TV sets in U.S. homes is
not equal to 3 ( H1: μ ≠ 3 )
• It challenges the status quo
• It is generally the hypothesis that the researcher is
trying to prove
• The Null and Alternative Hypotheses are mutually
exclusive.
• Only one of them can be true.
Gaurav Garg (IIM Lucknow)
• Example:
• Because of the increased marketing efforts,
company officials believe the company’s market
share is now greater than 18%, and the officials
would like to prove it.

H 0 :   0.18
H1 :   0.18

Gaurav Garg (IIM Lucknow)


Errors in Decision Making
Possible Hypothesis Test Outcomes
Actual Situation

Decision H0 True H0 False

Accept H0 No Error Type II Error


Probability 1 - α Probability β
Reject H0 Type I Error No Error
Probability α Probability 1 - β

Gaurav Garg (IIM Lucknow)


• Two types of error:
 Type I Error: Reject H0, when it is true
 Type II Error: Accept H0, when it is wrong
 Size of Type I Error = P(Type I Error)
=P(Reject H0, when it is true)
=P(Reject H0| H0)
=α (Also called as Producer’s risk)
 Size of Type II Error = P(Type II Error)
=P(Accept H0, when it is wrong)
=P(Accept H0| H1)
=β (Also called as Consumer’s risk)
• Size of Type I Error (α) is called Level of Significance.
• α is set by the researcher in advance.
Gaurav Garg (IIM Lucknow)
The Hypothesis Testing
• Claim: The population mean age is 50 years.
 H0: μ = 50, H1: μ ≠ 50
• Sample the population and find sample mean.
Population

Sample

Gaurav Garg (IIM Lucknow)


• Suppose the sample mean age is 20 years.

• This is significantly lower than the claimed mean


population age 50 years.

• If the claim (H0) is true, the probability of getting such


a different sample mean would be very small.

• Getting a sample mean of 20 is very unlikely.

• So, when we get sample mean as 20, we do not


believe on the claim (H0).
Gaurav Garg (IIM Lucknow)
• If the sample mean is close to the assumed
population mean, H0 is accepted.

• If the sample mean is far from the assumed


population mean, H0 is rejected.

• How far is “far enough” to reject H0?

• The critical value of the test statistic is used to


decide on this.

Gaurav Garg (IIM Lucknow)


Critical (Rejection) and Acceptance Region
• Critical value divides the whole area under probability
curve into two regions:
• Critical (Rejection) region
 When the statistical outcome falls into this region,
H0 is rejected.
 Size of this region is α.

• Acceptance Region
 When the statistical outcome falls into this region,
H0 is accepted.
 Size of this region is (1-α).
Gaurav Garg (IIM Lucknow)
Critical Values

Acceptance Region
Distribution of the test statistic (1- a)

Region of Region of
Rejection Rejection
a/2 a/2

Critical Values

Two Tail Test


Example: H0: μ = 50 Vs H1: μ ≠ 50
Gaurav Garg (IIM Lucknow)
a
1- a

0
Upper-tail test or Right Tail Test
Example:
H0: μ = 50 Vs H1: μ > 50

a 1- a

0
Lower-tail test or Left Tail Test
Example:
H0: μ = 50 Vs H1: μ < 50

Gaurav Garg (IIM Lucknow)


Hypothesis Testing for μ
(First Method)
• Assumptions:
 σ is known.
 Population is normal or sample size is large (n ≥ 30).
• Test Statistic:
 Compute the value of test statistic using following formula:
x
Zc 
 n
• Level of Significance:
 Fix the value of a, say 0.05 or 0.10
• Critical Values:
 Distribution of test statistic is N(0,1)
 Critical values are obtained using N(0,1)
Gaurav Garg (IIM Lucknow)
• For two tail test (H0: μ = μ0, H1: μ ≠ μ0): zα/2

N(0,1)

(0.025)
(0.025) (0.95)

-1.96 1.96

Gaurav Garg (IIM Lucknow)


• For right tail test (H0: μ = μ0, H1: μ > μ0): zα
N(0,1)
(0.05)

(0.95)

1.645

• For left tail test (H0: μ = μ0, H1: μ < μ0): -zα
N(0,1)
(0.05)
(0.95)

-1.645
Gaurav Garg (IIM Lucknow)
• Decision Making
• We reject H0 in the favor of H1 at α x100% level
• If |Zc| >= zα/2 (for two tailed test)
• If Zc >= zα (for right tailed test)
• If Zc <= -zα (for left tailed test)
• Accepting H0 means that
 The difference between sample mean and
hypothetical population mean is not significant.
 (The difference is because of sampling fluctuation only.)

 Or, sample has no enough evidence to reject H0.


Gaurav Garg (IIM Lucknow)
• Steps:
• State H0 and H1
• Compute the value of test statistic Zc
• Obtain critical value for fixed α and according to H1
(Right/ Left/ Two tailed test)
• Compare computed value of Zc with critical value
• Make the decision accordingly.
• Some useful critical values of N(0,1) distribution
Level of Significance
Test 1% 5% 10%

Two Tailed 2.58 1.96 1.645


Right Tailed 2.33 1.645 1.28
Left Tailed -2.33 -1.645 -1.28
Gaurav Garg (IIM Lucknow)
Example:
• A survey, done 10 years ago, of CPAs in the U.S.
found that their average salary was $74,914.
• A sample of 112 CPAs produced a mean salary of
$78,695.
• Assume that  = $14,530.
• An accounting researcher would like to test
whether over the years
 this average has increased?
 this average has decreased?
 this average has changed?
Gaurav Garg (IIM Lucknow)
• Has the average salary of CPAs in the U.S. increased?
• Right or Upper Tailed Test
• (H0: μ = 74914, H1: μ > 74914)
• Test Statistic Z  x    78695  74914  2.7539
c
 n 14530 112

• At 5% level of significance, critical value for a right tailed


test, z(0.05) =1.645
• Since, computed value > critical value at 5% level of
significance
• we reject H0 at 5% level of significance in favor of H1
• and conclude that average salary of CPAs in the U.S. has
increased.
Gaurav Garg (IIM Lucknow)
• Has the average salary of CPAs in the U.S. decreased?
• Left or Lower Tailed Test
• (H0: μ = 74914, H1: μ < 74914)
• Test Statistic Z  x    78695  74914  2.7539
c
 n 14530 112

• At 5% level of significance, critical value for a left tailed


test, z(0.05) = -1.645
• Since, computed value > critical value at 5% level of
significance
• we accept H0 at 5% level of significance against H1
• and conclude that average salary of CPAs in the U.S. has
not decreased.
Gaurav Garg (IIM Lucknow)
• Has the average salary of CPAs in the U.S. is changed?
• Two Tailed Test
• (H0: μ = 74914, H1: μ ≠ 74914)
• Test Statistic Z  x    78695  74914  2.7539
c
 n 14530 112

• At 5% level of significance, critical value for a right tailed


test, z(0.025) =1.96
• Since, |computed value| > critical value at 5% level of
significance
• we reject H0 at 5% level of significance in favor of H1
• and conclude that average salary of CPAs in the U.S. is
changed.
Gaurav Garg (IIM Lucknow)
p – value Approach
• Let Zc be the computed value of test statistic
• Let Z ~ N(0,1)
• Then p – value is given by the following probability
 For two tailed tests:
• 2P(Z> |Zc|)
 For right tailed tests:
• P(Z> Zc)
 For left tailed tests:
• P(Z< Zc)
• Decision: H0 is rejected in the favor of H1 at α x100% level of
significance, if
• p – value < α
• The p – value is the smallest level of significance at which H0 would be
rejected.
Gaurav Garg (IIM Lucknow)
• Example:
• A phone industry manager thinks that customer monthly cell
phone bills have increased, and now average more than $52 per
month.
• The company wishes to test this claim.
• Suppose a sample is taken with the following results
• Sample size = 64, sample mean = $53.1 per month
• Past company records indicate that the standard deviation is
about $10.
• To Test
• H0: μ = 52 Against H1: μ > 52
• Test Statistic: x μ 53.1  52
Zc    0.88
σ 10
n 64
Gaurav Garg (IIM Lucknow)
PZ  Z c   P(Z  0.88 )  1  0.8106  0.1894
p-value = 0.1894
Zc = 0.88
Reject H0
 = 0.10

0
Do not reject H0 1.28 Reject H0

Do not reject H0 since p-value = 0.1894 >  = 0.10

Gaurav Garg (IIM Lucknow)


• Consider the example of average salary of CPAs in the U.S.
• computed value of test statistic, Zc = 2.7539
 For two tailed tests (H0: μ = 74914, H1: μ ≠ 74914):
• p = 2P(Z > 2.7539) = 0.005888 (using N(0,1))
• H0 is rejected for all α ≥ 0.005888
 For right tailed tests (H0: μ = 74914, H1: μ > 74914):
• p = P(Z > 2.7539) = 0.002944
• H0 is rejected for all α ≥ 0.002944
 For left tailed tests (H0: μ = 74914, H1: μ < 74914):
• p = P(Z < 2.7539) = 0.997056
• H0 is rejected for all α ≥ 0.997056
• We can not have this much high value of α
• So, we accept H0
Gaurav Garg (IIM Lucknow)
Hypothesis Testing for μ
(Second Method)
• Assumptions:
 σ is unknown.
 sample size is large (n ≥ 30).
• Test Statistic:
 Compute the value of test statistic using following formula:
x
Zc 
s1 n

• Level of Significance:
 Fix the value of a, say 0.05 or 0.10
• Critical Values:
 Distribution of test statistic is N(0,1)
 Critical values are obtained using N(0,1)
Gaurav Garg (IIM Lucknow)
• Example:
• An insurance agent claims that the average age of policy
holders who have insured through him is less than the
average for all agents, which is 30.5 years.
• A random sample of 100 policy holders who had insured
through him gave the following age distribution:
Age no. of people
16-20 12
21-25 22
26-30 20
31-35 30
36-40 16
• Test his claim at 5% level of significance.
Gaurav Garg (IIM Lucknow)
• Example:
• An engineer has developed a new, energy-
efficient lawn mower engine.
• He claims that the engine will run continuously
for an average of at least 300 minutes on a single
gallon of regular gasoline.
• Suppose a simple random sample of 50 engines
is tested.
• The engines run for an average of 295 minutes,
with a standard deviation of 20 minutes.
• Test the appropriate hypothesis.
Gaurav Garg (IIM Lucknow)
Hypothesis Testing for μ
(Third Method)
• Assumptions:
 σ is unknown.
 Population is normal.
 Sample size is small (n < 30).
• Test Statistic: xμ
Tc 
s1 n

• Test statistic Tc has t(n-1) distribution.


• Critical values of t(n-1) distribution can be obtained
from the t table for given d.f. and significance level.
Gaurav Garg (IIM Lucknow)
• For right tail test (H0: μ = μ0, H1: μ > μ0): tα
T~t(n-1)
• P( T < tα) = 1- α Rejection
Region (α)
• P(T > tα ) = α Acceptance
Region (1- α)

• For left tail test (H0: μ = μ0, H1: μ < μ0): -tα
T~t(n-1)
• P( T > -tα) = 1- α Rejection
Region (α)
• P(T < -tα ) = α Acceptance
Region (1- α)

-tα

Gaurav Garg (IIM Lucknow)


• For two tail test (H0: μ = μ0, H1: μ ≠ μ0): tα/2
T~t(n-1)

Rejection Rejection
Region (α/2) Acceptance Region (α/2)
Region (1- α)

- tα/2 tα/2

• P(- tα/2 < T< tα/2 ) = 1- α


• P(T > tα/2 ) = α/2 P( T < -tα/2 ) = α/2
• We reject H0 in the favor of H1 at α x100% level
• If |Tc| > tα/2 (for two tailed test)
• If Tc > tα (for right tailed test)
• If Tc < -tα (for left tailed test)
Gaurav Garg (IIM Lucknow)
• Example:
• A sample of 25 people is taken.
• The length of time to prepare dinner is recorded in
minutes, as given below:
• 44.0 51.9 49.7 40.0 55.5 33.0 43.4 41.3
45.2 40.7 41.1 49.1 30.9 45.2 55.3 52.1 55.1
38.8 43.1 39.2 58.6 49.8 43.2 47.9 46.6
• Is there any evidence that the population mean
time to prepare dinner is greater than 40 minutes?
• Use a level of significance of 0.05.
• Computed value of Test Statistic = 4.04388267
Gaurav Garg (IIM Lucknow)
• Example:
• The mean tariff of a hotel room in New York is said to be
$168 per night.
• A random sample of 25 hotels resulted in mean tariff
$172.50 with standard deviation $15.40.
• Test at the  = 0.05 level:
• if the mean tariff of a hotel room in New York is more than
$168 per night;
• if the mean tariff of a hotel room in New York is not $168
per night.
• A stem-and-leaf display and a normal probability plot
indicate the data are approximately normally distributed.
• Computed Value of Test Statistic = 1.461039
Gaurav Garg (IIM Lucknow)
• p – value Approach in t Distribution:
• Let tc be the computed value of test statistic
• Let T ~ t(n-1)
• Then p – value is given by the following probability
 For two tailed tests:
• 2P(T > |tc|)
 For right tailed tests:
• P(T > tc)
 For left tailed tests:
• P(T < tc)
• Decision: H0 is rejected in the favor of H1 at α x100% level of
significance, if
• p – value < α
• In case of t distribution, p – value may not always be obtained from
the table. (Use Excel) Gaurav Garg (IIM Lucknow)
Testing of Hypothesis for μ

σ known σ Unknown

n small n large n small n large

Normal Any Normal Any


Distribution Distribution Distribution Distribution

Z test Z test.
. .
t test.
For critical value/ p- For critical value/ p-value:
.
value: Use N(0,1)
For critical value/ p-
Use N(0,1) value:
Use t(n-1)

Gaurav Garg (IIM Lucknow)


Hypothesis Testing of
Population Proportion 𝝅
• Example:
• A manufacturer believes that exactly 8% of its products
contain at least one minor flaw.
• The company wants to test this belief.
• A sample of 200 products resulted in 33 items have at
least one minor flaw.
• Population is divided into 2 mutually exclusive and
exhaustive classes “A” and “Ac”
• 𝝅= Actual proportion of individuals in class “A”
• A sample is selected from this population
• p= sample proportion of individuals in class “A”
Gaurav Garg (IIM Lucknow)
• We want to test:
 H0: 𝝅 = 𝝅0, H1: 𝝅 > 𝝅0 (Right or Upper Tail Test)
 H0: 𝝅 = 𝝅0, H1: 𝝅 < 𝝅0 (Left or Lower Tail Test)
 H0: 𝝅 = 𝝅0, H1: 𝝅 ≠ 𝝅0 (Two Tail Test)
• Test Statistic p 
Z c 
 (1   ) n
• Assumption: Sample is large.
• n ≥ 30 or n𝝅 ≥ 5 as well as n(1-𝝅) ≥ 5
• Zc ~ N(0,1)
• So, N(0,1) distribution is used to obtain critical value.
• Decision rules are the same as discussed earlier.
• p – value approach can also be used.
Gaurav Garg (IIM Lucknow)
• Example:
• A marketing company claims that it receives 8%
responses from its mailing.
• To test this claim, a random sample of 500 were
surveyed with 30 responses.
• Test at the  = 0.05 significance level.
• H0: 𝝅 = 0.08 H1: 𝝅 ≠ 0.08 Reject H0 Reject H0

• n = 500, p = 0.06 0.025 Accept H0 0.025

• α = 0.05,
0 z
• Critical Value = ± 1.96 -1.96 1.96

• Computed Test Statistic = -1.6485


• Accept H0 at α = 0.05
Gaurav Garg (IIM Lucknow)
• Example:
• A political group ABC Party claims that the
proportion of voters who support it is more than
0.4.
• A news channel conduct a survey to test this claim.
• A sample of 200 people is selected.
• Out of them only 65 are the supporters of ABC
Party.
• Can you help the news channel in the analysis.
• Computed value of Test Statistic = -2.1651
• p – value = ?
Gaurav Garg (IIM Lucknow)
• Example:
• A manufacturer believes exactly 8% of its
products contain at least one minor flaw.
• The company wants to test this belief.
• A sample of 200 products resulted in 33 items
have at least one minor flaw.
• Use a probability of a Type I error of 0.10.
• Help the company officials.
• Computed value of Test Statistic = 4.4309
• p – value = ?

Gaurav Garg (IIM Lucknow)


Hypothesis Testing of Population Variance σ2
Example:
• A pharmaceutical company is considering the
purchase of new bottling machines to increase
efficiency.
• The factory currently makes use of machines that fill
cough syrup bottles whose volume of medicine has a
standard deviation of 1.6 mL.
• The new machine they are considering was tested on
30 bottles, producing a batch with a standard
deviation of 1.2 mL.
• Does this machine produce a standard deviation less
than 1.6 mL at the 0.05 significance level?
Gaurav Garg (IIM Lucknow)
• Assumptions:
 Population is normal.
• Test Statistic: n

 i
( x  x ) 2
(n  1) s12
 c2  i 1

 2
2

• Distribution of above test statistic is Chi Square


with (n-1) degree of freedom.

• Critical values are obtained from the Chi Square


table for given level of significance and d.f.
Gaurav Garg (IIM Lucknow)
• For two tail test (H0: σ = σ0, H1: σ ≠ σ0):
Critical Region
(α/2) Critical Region
(α/2)
Acceptance Region
(1-α)

0
 (21 / 2 )  (2 / 2)

• This distribution is not symmetric.


• So, we have different notations for critical values.
• Area after the point is mentioned in subscript.
• Wereject
2
 H 0 or 1   
2in the favor of H at α 2x100% 2level, if
c ( / 2 ) c (1 / 2 )
Gaurav Garg (IIM Lucknow)
• For right tail test (H0: σ = σ0, H1: σ > σ0):

Critical Region
(α)

Acceptance Region
(1-α)

0
 (2 )

 c   (of
• We reject H0 in the2
favor 2
H at α x100% level, if
) 1

Gaurav Garg (IIM Lucknow)


• For left tail test (H0: σ = σ0, H1: σ < σ0):
Critical Region
(α)

Acceptance Region
(1-α)

0
 (21 )

• We reject H0 in the2 favor2of H1 at α x100% level, if


 c   (1 )

Gaurav Garg (IIM Lucknow)


• Example:
• Consider the “bottling machines” example.
• Sample size = 30, sample standard deviation= 1.2
• We want to test:
• H0: σ = 1.6, H1: σ < 1.6
• Test Statistic:
n

 (x i  x)2
(n  1) s12 29  1.2  1.2
 
2
c
i 1
   16.3125
2 2 1.6  1.6
• For
 left tail test, 5% level of significance, d.f = 29,
• Critical Value is  (20.95)  17.708
• Reject H0 at 5% level

Gaurav Garg (IIM Lucknow)


Power of the test
• β = P(Type II Error)= P(Accept H0| when H0 is false)
• When we reject H0, there is a strong evidence to
support our conclusion.
• When we accept (can’t reject) H0,
 Either H0 is true, or
 We commit a Type II error
• Type II error can occur only if H0 is false.
• We obtain β for the values of population parameter for
which H0 is false.
• β will be different for every value of population
parameter.
Gaurav Garg (IIM Lucknow)
• β = P(Accept H0| when H0 is false)
• 1 – β = P(Reject H0| when H0 is false)
• (1 – β) is called as Power of the test.
• This is the decision, we aim for.
• Remember, we test H0 because we think it is wrong.
• Deciding to reject a false H0 is the power.
• Let population mean is actually μ*.
• And you take μ = μ0 under H0
• Larger the difference between μ0 and μ* more the
power.
• Because, it is more likely to reject H0 .
Gaurav Garg (IIM Lucknow)
Power of the test of mean (σ known)
• In a two tailed test, we accept H0 when
 z / 2  Z c  z / 2
x  0
or  z / 2   z / 2
 n Here μ0 = value of μ taken
  under H0
or  0  z / 2  x   0  z / 2
n n
• Let us fix some value of μ = μ* ≠ μ0.
• When μ = μ* , H0 is false.
• Thus, when μ = μ*,
 β = P(Accept H0| μ = μ*)
   
 P   0  z / 2  x   0  z / 2 |   *
 n n 
Gaurav Garg (IIM Lucknow)
• Thus for a right tailed test:

  
  P  x   0  z |   *
 n 

• For a left tailed test

  
  P   0  z  x |   *
 n 

Gaurav Garg (IIM Lucknow)


Power of the test of proportion
• Suppose, you take 𝝅 = 𝝅0 under H0
• Power of the test at Population proportion 𝝅* is

  0 (1   0 )  0 (1   0 ) 
  Prob 0  z / 2  p   0  z / 2 |   
*

 n n 
(for two tailed test)
  0 (1   0 ) 
  Prob p   0  z |   
*
(for right tailed test)
 n 
  0 (1   0 ) 
  Prob 0  z  p |   
*
(for left tailed test)
 n 

Gaurav Garg (IIM Lucknow)


Summary
Testing of Mean
x x
Zc  ~ N (0,1) Tc  ~ t( n 1)
 n s1 n
Testing of Proportion
p 
Zc  ~ N (0,1)
 (1   ) n
Testing of Variance
n

 i
( x  x ) 2
(n  1) s12 ns 2
 c2  i 1
  ~  (2n 1)
2 2 2

Gaurav Garg (IIM Lucknow)

You might also like