Download as ppt, pdf, or txt
Download as ppt, pdf, or txt
You are on page 1of 58

Hypothesis

Testing
vijay.gahlawat@gmail.com
Introduction
•A statistical hypothesis is an assumption about an
unknown population parameter.
•It is a well defined procedure which helps us to decide
objectively whether to accept or reject the hypothesis
based on the information available from the sample.
•In statistical analysis, we use the concept of probability to
specify a probability level at which a researchers
concludes that the observed difference between the sample
statistics and population parameter is not due to chance.
Hypothesis Testing
Procedure
Step 1: - Set Null and Alternative Hypothesis

Step 2:-Determine the appropriate Statistical Test

Step 3: -Set the level of Significance

Step 4: -Set the Decision Rule

Step 5: - Collect the Sample data

Step 6: - Analyze the data

Step 7: - Arrive at a statistical conclusion


Step 1: - Set Null and Alternative Hypothesis

• The null hypothesis is denoted by Ho, is the


hypothesis which is tested for the possible rejection
under the assumption that it is true.
• Theoretically, Ho is set as no difference considered
true, until and unless it is proved wrong by the
collected sample data.
• The alternative hypothesis is denoted by H 1 or Hα, is
a logical opposite of the Ho.
1. H0:  = 0 versus
Ha:   0 (two-sided)
2. H0:   0 versus
Ha:  < 0 (one-sided)
3. H0:   0 versus
Ha:  > 0 (one-sided)
Often H0 for a one-sided test is written as H0:  = 0.
Remember a p-value is computed assuming H0 is true,
and 0 is the value used for that computation.
Step 2: - Determine the appropriate Statistical Test

• After setting he hypothesis, the researches has to


decide on an appropriate statistical test that will be
tested for the statistical analysis.
• The statistic used in the study (mean, proportion,
variance etc.) must also be considered when a
researchers decides on appropriate statistical test,
which can be applied for hypothesis testing in order
to obtain the best results.
Step 3: -set the level of significance

• The level of significance is denoted by α is the probability,


which is attached to a null hypothesis, which may be
rejected even when it is true.
• The level of significance also known as the size of the
rejection region or the size of the critical region.
• Level of significance must be determined before we draw
samples, so that the obtained result is free from the bias of a
decision maker.
• 0.01, 0.05, 0.010
Step 4: - Set the decision Rule

• Next step is to establish a critical region, which is


the area under the normal curve . These regions are
termed as acceptance region (when the Ho is
accepted) and the rejection region or critical region.
• If the computed value of the test statistic falls in the
acceptance region , the null hypo is accepted .
• Otherwise Ho is rejected.
Step 5: - Collect the sample data

• In this stage data are collected and appropriate


sample statistics are computed.
• The first 4 steps should be completed before
collecting the data for the study.
Step 6: - Analyze the data

• In this step the researcher has to compute the test


statistic. This involves selection of appropriate
probability distribution for a particular test.
• For Example- When the sample is small, then t-
distribution is used. If sample size is large then use
Z-test.
• Some commonly used testing procedures are F, t, Z,
chi square.
Step 7: - Arrive at a statistical conclusion

• In this step the researcher draw a conclusion. A


statistical conclusion is a decision to accept or reject
a Ho. This depends whether the computed statistic
falls in the acceptance region or rejection region.
Critical Region

The critical region (or rejection


region) is the set of all values of
the test statistic that cause us to
reject the null hypothesis.
Significance Level

The significance level (denoted by


) is the probability that the test
statistic will fall in the critical
region when the null hypothesis is
actually true. Common choices
for  are 0.05, 0.01, and 0.10.
Critical Value
A critical value is any value separating the
critical region (where we reject the H0) from
the values of the test statistic that does not
lead to rejection of the null hypothesis, the
sampling distribution that applies, and the
significance level . For example, the critical
value of z = 1.645 corresponds to a
significance level of  = 0.05.
Two-tailed,
Right-tailed,
Left-tailed Tests

The tails in a distribution are the extreme


regions bounded by critical values.
Two-tailed Test
H0: =  is divided equally between
the two tails of the critical
H1:  region

Means less than or greater than


Right-tailed Test
H0: =
H1: >
Points Right
Left-tailed Test
H0: =
H1: <
Points Left
Conclusions
in Hypothesis Testing
We always test the null hypothesis.

1. Reject the H0

2. Fail to reject the H0


Accept versus
Fail to Reject
Some texts use “accept the null
hypothesis.”
We are not proving the null hypothesis.

The sample evidence is not strong enough


to warrant rejection (such as not enough
evidence to convict a suspect).
Decision Criterion

Reject H0 if the test statistic falls


within the critical region.
Fail to reject H0 if the test statistic
does not fall within the critical region.
The Two Types of Errors
and Their Probabilities
When the null hypothesis is true, the
probability of a type 1 error, the level of
significance, and the -level are all equivalent.
When the null hypothesis is not true,
a type 1 error cannot be made.
Type I Error
 A Type I error is the mistake of
rejecting the null hypothesis when it
is true.

 The symbol (alpha) is used to


represent the probability of a type I
error.
Type II Error
A Type II error is the mistake of failing
to reject the null hypothesis when it is
false.

The symbol (beta) is used to


represent the probability of a type II
error.
Type I and Type II Errors
Controlling Type I and
Type II Errors
For any fixed , an increase in the sample size
n will cause a decrease in 

For any fixed sample size n , a decrease in 


will cause an increase in . Conversely, an
increase in  will cause a decrease in  .

To decrease both  and , increase the sample


size.
Definition
Power of a Hypothesis Test
The power of a hypothesis test is the
probability (1 - ) of rejecting a false null
hypothesis, which is computed by using a
particular significance level  and a
particular value of the population
parameter that is an alternative to the
value assumed true in the null hypothesis.
Trade-Off in Probability for Two Errors
There is an inverse relationship between the
probabilities of the two types of errors.
Increase probability of a type 1 error =>
decrease in probability of a type 2 error
Type 2 Errors and Power
Three factors that affect probability of a type 2 error
1. Sample size; larger n reduces the probability of a type 2
error without affecting the probability of a type 1 error.
2. Level of significance; larger  reduces probability of a
type 2 error by increasing the probability of a type 1
error.
3. Actual value of the population parameter; (not in
researcher’s control. Farther truth falls from null value (in
Ha direction), the lower the probability of a type 2 error.

When the alternative hypothesis is true, the probability of


making the correct decision is called the power of a test.
Z-Test (For large Samples)

• Hypothesis testing for large samples is based on the


assumption that the population, from which the
sample is drawn, is normal. As a result the sampling
distribution of the mean is also normally distributed.
• Even when the population is not normally
distributed the sampling distribution of mean for a
large sample size is normally distributed.
Formula for single population mean

x  
z 
  
 
 n 

Where, µ =population mean,


σ = population standard Deviation,
n = sample size and
x bar is sample mean.
Example
• A marketing research firm conducted a survey 10 years ago
and found that the avg. household income of a particular
region is Rs. 10000. Mr. X, Who recently joined the firm as
vice president has expressed doubts about the accuracy of
the data. For verifying the data, the firm has decided to take
a random sample of 200 households that yields a sample
mean (income) of Rs. 11000. Assume that the population
S.D. of the household income is Rs. 1200. Verify Mr. X’s
doubts using the 7 step hypothesis testing. Let α=0.05.
Solution
Step-1: Set null and alternative hypothesis
Here researcher is trying to verify whether there is any
change in the avg. household income within 10
years. The Ho is set as no difference, i.e. the avg.
household income has not changed.
Ho: µ=10000, H1: µ#10000
Step-2: Determine Statistical Test
Sample size is > than 30, and the sample mean is used
x
as statistic. So Z formula is used z 
  
 
 n 
Solution
Step-3: Set the level of significance (α)
It is known as size of the rejection region or size of
the critical region. Here it is 0.05
Step-4: Set the decision rule
H1 shows that we have two-tailed test (means
household income can be less than or more than
10000 Rs.) and the level of significance is 0.05. The
acceptance region covers 95% of the area and the
rejection region covers the remaining 5% of the
area at the two ends of the distribution. (Zα/2=1.96)
1-.05=0.95

0.4750 0.4750
0.025 0.025

-1.96
+1.96
0
Solution
Step-5: Collect the sample data
Sample size is 200=n, and Sample Statistic (Sample
Mean) = 11000.
Step-6: Analyze the data.
n=200, µ=10000, σ =1200, x bar or mean = 11000

11000  10000
z  11 .79
 1200 
 
 200 
Solution
Step-7:Arrive at a Statistical Conclusion
Calculated value of Z is 11.79
And tabulated value of Z is 1.96
As Calculated > Tabulated , We reject the null Hypo
Means Mr. X’s doubts about this average
household income was right.
When population S.D. is unknown. The population
S.D. (σ) is replaced by sample S.D. (s).
Then z 
x
 s 
 
 n 

The above formula of Z is based on the assumption


that the sample is drawn from an infinite population.
If population is finite then Z formula is
x
z
   N n
 .
 n  N 1
Hypo Testing for a Population Proportion
In business research information is generally expressed in
terms of proportions. For ex. Market share of a company,
quality defects, consumer preferences etc.
This kind of data is highly dynamic in nature. Business
researchers sometimes want to test the hypothesis about
such proportions.
Formula pp
z
pq
n

Where, n= sample size, p = population proportion, q=1-p


and p bar is sample proportion
Example
The production manager of a company that manufactures
electric heaters believes that atleast 10% of the heaters are
defective. For testing his belief, he takes a random sample
of 100 heaters and finds that 12 heaters are defective. He
takes the level of significance at 5% for testing the
hypothesis. ( table value of Z at 5% is 1.96)
Sol.
Ho : p=0.10
H1 : p#0.10 (two-tailed test)
p= population proportions = 10/100=0.10
q= 1-p = 1- 0.10 = 0.90
p bar = sample proportion = 12/100 = 0.12
n = 100
pp 0.12  0.10
z   0.67
pq (0.10)(0.90)
n 100

Ho is accepted as Z calculated is < then Z tabulated (0.67<1.96)


Hypo Testing for the difference between two
means using
Formula x 1 
 x 2   μ1  μ 2 
z 2 2
σ1 σ 2

n1 n 2
n1  the size of sample 1. σ1  S.D. of Population1.
n 2  the size of sample 2. σ 2  S.D. of Population2.
x1  Mean of sample1. 1  Mean of Population1.
x 2  Mean of sample2.  2  Mean of Population2.

When Population S.D. are not given


z
x 1 
 x 2   μ1  μ 2 
2 2
s1 s
 2
n1 n 2
s1  S.D. of sample1.
s 2  S.D. of sample2.
Example
The means of two single large sample of 1000 and 2000
members are 67.5 inches and 68.0 inches respectively. Can
the samples be regarded as drawn from the same population
of S.D. 2.5 inches.(Z value at 5% is 1.96)
Sol.
Ho : 1   2  0 or 1   2 (samples are from the same population

H1 : 1 #  2
n1  1000. σ1  2.5 n 2  2000. σ 2  2.5
x1  67.5. x 2  68.0

z
 x 1 
 x 2   μ1  μ 2 

 67.5  68.0    0 
 -5.1
2 2
σ1 σ 2 (2.5) 2 (2.5) 2
 
n1 n2 1000 2000
Z  - 5.1  5.1

As Z calculated is > Z Tabulated .


So Ho is rejected. W conclude that samples are not drawn from the
same population.
Small Sample testing

When we have sample size < 30. to test the hypothesis about
population parameter we use t-test.
The t-statistic is a standardized score for measuring the
difference between the sample mean and the null
hypothesis value of the population mean:

sample mean  null value x   0


t 
standard error s
n
This t-statistic has (approx) a t-distribution with df = n - 1.
Example:
Royal tyres has launched a new brand of tyres for tractors and claims
that under normal circumstances the average life of the tyres is 40000
km. A retailer wants to test this claim and has taken a random sample
of 8 tyres. He tests the life of the tyres under normal conditions and
found a mean life of 39750 km. and S.D. (s) 2618.61. Test the
hypothesis at 5% . (t value with 7 d.f. at 5% is 2.365).
Sol.
X bar = 39750,
Ho : µ = 40000 S = 2618.61
H1 : µ # 40000 N=8

x  μ 39750  40000 As t calculated is < t tabulated


t   0.27
s 2618.61 We accept Ho
n 8
Hypo Testing for difference between two
population means (small samples)

t
x 1 
 x 2   μ1  μ 2 
s1 (n1  1)  s 2 (n 2  1) 1 1
2 2


n1  n 2  2 n1 n 2

With degrees of freedom n1+n2 -1


Chi-Square Test for Categorical data
Categorical Data: It is defined as the counting of
frequencies from one or more variables.
Chi square test is the category of non-parametric test.
i.e. here we are not sure about the population
distribution (whether it is normal or not). The
statistical tests that do not require prior knowledge
about the population are termed as non-parametric
tests.
Product Mobile Internet Personal Row Total
Age banking Banking Banking

17-27 125 175 145 445

28-35 155 180 197 532

36-44 167 210 150 527

45-57 146 156 142 444


58-70 133 156 176 465

Column Total 726 877 810 2413

Preference of type of banking across different age groups


χ  Test Statistic is
2

χ 
2  f0  fe 
,
fe
f 0  Observed Frequencies
f1  Expected Frequencies
Conditions for applying chi square
• The sample should consist of at least 50
observations and should be drawn randomly from
the population.
• The individual observation in a sample should be
independent to each other.
• Data should not be presented in the % or ratio form,
rather they should be expressed in original units.
• Sum of the frequencies must be 5 or more.
2
χ Goodness of fit Test
This test compares the theoretical frequencies with
the observed frequencies to determine the difference
between theoretical and observed frequencies.

Q.- Five coins are tossed 3200 times and the


following results are obtained. Test the
hypothesis that coins are biased at 5%. (chi
square value at 5% with 5 d.f. is 11.070
No. of Heads 0 1 2 3 4 5

Frequency 80 570 1100 900 500 50

Ho : coin is unbiased
Let p = the probability of getting a head = ½
From binomial distribution, expected frequencies
are:
F(x) = N.P(x), where
n!
P(x)  p x q n x
(n - x)!(x)!
N  3200, n  5, p  1/2, q  1 - p  1/2
n!
P(x)  p x q n x
(n - x)!(x)!
5!
Frequecny of 0 head  3200.P(0)  3200. (1/2)x (1/2)n  x
(5 - 0)!(5)!
F (0)  100
similarly
F (1)  3200.P (1)  500, F(2)  1000, F(3)  1000
F(4)  500, F(5)  100
No. of Observed Expected (fo-fe) (fo-fe)
Heads Frequency Frequency
(fo) (fe)

0 80 100 400 4
1 570 500 4900 9.8
2 1100 1000 10000 10
3 900 1000 10000 10
4 500 500 0 0
5 50 100 2500 25
58.8
Example
• A marketing research firm conducted a survey 4 years ago
and found that the avg. household income of a particular
region is Rs. 10050. Mr. X, Who recently joined the firm as
vice president has expressed doubts about the accuracy of
the data. For verifying the data, the firm has decided to take
a random sample of 200 households that yields a sample
mean (income) of Rs. 11000. Assume that the population
S.D. of the household income is Rs. 1500. Verify Mr. X’s
doubts using the 7 step hypothesis testing. Let α=0.05.

You might also like