Вы находитесь на странице: 1из 39

Hypothesis Testing

Hypothesis Testing
A statistical hypothesis is some statement about the
population, which may or may not be true. Under
Hypothesis Testing , we have to test the validity of this
statement on the basis of the evidence from a random
sample.
Null Hypothesis: if we want to test any statement
about the population, we setup null hypothesis which
says that the statement is true, e.g. if we want to find
out if the population mean has a specified value say 0,
then null hypothesis is set up as:
Alternative Hypothesis:
0 0
: = H
0 1
: = H
Procedure For Hypothesis Testing
Step I : setup the null Hypothesis e.g.
Step II : setup the Alternative Hypothesis e.g.
Step III: Decide level of significance e.g. = 5%
Step IV: Compute test statistic under the validity of
null hypothesis as
0 0
: = H
0 1
: = H
) 1 , 0 ( ~
) ( .
) (
N
x E S
x E x
Z

=
statistic any for V N S Variate Normal
a as defined be can Z x E where
) . . ( Standard
, ) ( =
Step V: Conclusion: We compare the computed value of Z in
step (iv) with the significant value Z

(tabulated value)
at given level of significance
if |Z| < Z

, then Z is not significant i.e. difference b/w


statistic and the difference is just due to sampling fluctuations
H
0
can not be rejected & Vice Versa.
Types of Error in Hypothesis Testing
Type I Error: Reject H
0
when it is true P (Type I Error)=
: Level of significance
1- = P (Rejecting H
0
when it is false)

Type II Error: Accept H
0
when it is false
P (Type II Error)=
1- = P (Accepting H
0
when it is true)
Critical Values Level of Significance ()
Two Tailed Test
Right Tailed Test
Left Tailed Test
1% 5% 10%
2.58
2.33
-2.33 -1.645
1.645
1.96 1.645
1.28
-1.28
Hypothesis Testing
Single Mean
Difference of Mean
Single Proportion
Difference of Proportion
Z Test Statistic for the Mean
Z Test Statistic for the Mean
of a Normal Population
of a Normal Population
Assumptions
Population is normally distributed
If not normal, requires large samples
z test statistic
n
x
x
z
x
o

o

=
Sampling Distribution of Mean
has a sampling distribution with mean
i.e. E( ) =
X

X

n
X
o

Z =
n
as
X E S and mean with on Distributi Normal f ollows X
o

2
) .( .
Acceptance and Rejection Region
1.96 1.96
Acceptance Region
P-value (Observed Significance Level)
P-value - Measure of the strength of evidence the
sample data provides against the null hypothesis:

) ( :
obs
z Z P p val P > =
Large Sample Test
Sample is large if n > 30

S.N.V to a statistic:

= n as N
t E S
t E t
Z ) 1 , 0 ( ~
) .( .
) (
(i) Testing the significance of mean ) (x
n
x
x E S
x E x
Z
/
) ( .
) (
2
o

=

=
Compare Z
0.05
= 1.96 with |Z|
Critical values of Z Level of Significance
Two - tailed
One - tailed
5% 10% 1%
1.96 1. 645 2.58
1. 645
Company dealing in readymade garmnets wants to
know consumers rating of their product.
One set of consumers selected in Delhi. Asked to rate
their brand on a scale of 5. Now market researcher
wants to know whether the consumers rating exceeds
4 or not.
Example
471 . 2
293 . 0
4 724 . 4
/
05 . 0
4 :
4 :
2
1
0
=

=
=
>
s
n
x
Z
H
H
o

o

z
0.05
(one- tailed)=1.645
|Z| > z
0.05
H
1
accepted
(ii) Test of significance for difference of Means


Whether the two population means are same or not?
2 1 1
2 1 0
:
:


=
=
H
H
) 1 , 0 ( ~
2
2
2
1
2
1
2 1
N
n n
x x
Z
o o
+

=
Sampling Distribution of Difference in Means
In large samples, the difference in two sample means is
approximately normally distributed:
|
|
.
|

\
|
+
2
2
2
1
2
1
2 1
2 1 , ~
n n
N Y Y
o o

Under the null hypothesis,
1
-
2
=0 and:
) 1 , 0 ( ~
2
2
2
1
2
1
2 1
N
n n
Y Y
Z
o o
+

=
o
1
2
and o
2
2
are unknown and estimated by s
1
2
and s
2
2
Example - Efficacy Test for New drug
Null hypothesis - New drug is no better than standard trt
Std New
H = :
0
Alternative hypothesis - New drug is better than standard trt
Std New A
H > :
Experimental (Sample) data:
Std New
Std New
Std New
n n
s s
y y
Example - Efficacy Test for New drug
Type I error - Concluding that the new drug is better than the
standard (H
A
) when in fact it is no better (H
0
). Ineffective drug is
deemed better.
Traditionally o = P(Type I error) = 0.05

Type II error - Failing to conclude that the new drug is better (H
A
)
when in fact it is. Effective drug is deemed to be no better.
Traditionally a clinically important difference (A) is assigned
and sample sizes chosen so that:
| = P(Type II error |
1
-
2
= A) s .20
Example:
In order to make a survey of the buying habits, two markets A
& B are chosen at two different parts of a city.
Market A Market B
40
250
400
1
1
1
=
=
=
s
x
n
55
220
400
2
2
2
=
=
=
s
x
n
i
x
Average weekly expenditure on food

Test at 1 % level of significance whether the average
weekly food expenditure of two populations of shoppers
is equal.
Example: Suppose company wants to know the rating
of their brand in two different cities is same or not.
Average rating on internal scale in Delhi is same as in
Bombay or different.
2 1 1
2 1 0
:
:


=
=
H
H
Z-test
(ii) Significance of Proportion:
n PQ
P p
p E S
p E p
Z
/
) ( .
) (
=

=
Compare Z
0.05
=1.96 with |Z|
Example:
(i) say, 65% of customers will like the new package design
(ii) 80% of the dealers will prefer the new pricing policy

65 . :
65 . :
1
0
=
=
p H
p H
80 . :
80 . :
1
0
=
=
p H
p H
Small Sample Tests
If the sample size n is small (less than 30), then the sampling
distribution of the statistics is far from normality. The normal
test cant be applied Exact Sample Tests are applied in such
cases.
Assumptions:
(i) The Parent population from which the sample is
drawn is normally distributed.
(ii) The sample is random and independent of each other.
T- test
1
2 2
~
/ 1 /

=
n
t
n S
x
n s
x
t

Confidence Limits for
1
=
n
s
t x
o

2 2
2 2
2
2
) 1 (
) ( ) 1 (
1
) (
s S
n
n
x x S n
n
x x
S
=

T-test for difference of Means


Whether the population means are equal?
| |

+
+
=
+

=
=
=

2
2
2
1
2 1
2
2
2 1
2
2 1
2 1 1
2 1 0
) ( ) (
2
1
~
)
1 1
(
:
:
2 1
x x x x
n n
s
t
n n
s
x x
t
H
H
n n


Example:
A group of 5 patients treated with medicine A weight 42,
39, 48, 60 and 41 Kgs. Second group of 7 patients treated
with Medicine B weigh 38, 42, 56, 64, 68, 69, 62 Kgs. Do
you agree with the claim that the medicine B increases
the weight significantly ?

t
0.05
at v=10 is 2.23
t
0.10
at v=10 is 1.81

Note:
Two samples in this test are independent
Difference of Means(Independent Samples)
Product rated on 7- point interval scale
S.No Delhi Bombay
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
2
3
3
4
5
4
4
5
3
4
5
4
3
3
4
3
4
5
6
5
5
5
4
3
3
5
6
6
6
5
(Separate set
of consumers)
H
0
: Mean ratings are same i.e. consumer rate the product in
two cities in same way.
rejected H t t
f d at t
t
H
0
2 1 1
2 1
| |
05 . 2 . . 28
75 . 2 | |
% 5
:
o
o
o


>
=
=
=
=
=
Significant Values Of t-Distribution
(Two-Tail Areas) P(|t| > t

) =
Rejection
region (/2)
Rejection
region (/2)
Acceptance
region (1-)
t=0 -t

()
t

()
d.f.
y
Probability ()
0.50 0.10 0.05 0.02 0.01 0.001
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
1.00
0.82
0.77
0.74
0.73
0.72
0.71
0.71
0.70
0.70
0.70
0.70
0.69
0.69
0.69
0.69
0.69
0.69
0.69
0.69
0.69
0.69
0.69
0.69
0.68
0.68
0.68
0.68
0.68
0.68
0.67
6.31
2.92
2.35
2.19
2.02
1.94
1.90
1.86
1.83
1.81
1.80
1.78
1.77
1.76
1.75
1.75
1.74
1.73
1.73
1.73
1.72
1.72
1.71
1.71
1.71
1.71
1.70
1.70
1.70
1.70
1.65
12.71
4.30
3.18
2.78
2.57
2.45
2.37
2.31
2.26
2.23
2.20
2.18
2.16
2.15
2.13
2.12
2.11
2.10
2.09
2.09
2.08
2.07
2.07
2.06
2.06
2.06
2.05
2.05
2.05
2.04
1.96
31.82
6.97
4.54
3.75
3.37
3.14
3.00
2.90
2.82
2.76
2.72
2.63
2.65
2.62
2.60
2.58
2.57
2.55
2.54
2.53
2.52
2.51
2.50
2.49
2.49
2.48
2.47
2.47
2.46
2.46
2.33
63.66
9.93
5.84
4.60
4.03
3.71
3.50
3.36
3.25
3.07
3.11
3.05
3.01
2.98
2.95
2.92
2.90
2.88
2.86
2.85
2.83
2.82
2.81
2.80
2.79
2.78
2.77
2.76
2.76
2.75
2.58
636.62
31.60
12.94
8.61
6.86
5.96
5.41
5.04
4.78
4.59
4.44
4.32
4.22
4.14
4.07
4.02
3.97
3.92
3.88
3.85
3.83
3.79
3.77
3.75
3.73
3.71
3.69
3.67
3.66
3.65
3.29
Paired t-test for difference of Mean
The two samples are dependent



1
~
:
:

=
=
=
n
y x
y x o
t
n
S
d
t
H
H

=
=
=
2 2
) (
1
1
d d
n
S
d
n
d
y x d
i
i i i
Ex. An IQ test was administered to 5 persons before and after they were
trained . The results sre given below

Candidates: I II III IV V
IQ B.T 110 120 123 132 125
IQ A.T 120 118 125 136 121

Test whether there is any change in IQ after training program
t
0.01
(4) = 4.6
Difference of Means (Dependent Samples)

Attitude measurement towards a brand before and after the ad campaign.
rating done on 10 point scale .
10: Highly disliked 1: Highly liked


SN Before Test After Test
1 3 5
2 4 6
3 2 6
4 5 7
5 3 8
6 4 4
7 5 6
8 3 7
9 4 5
10 2 4
11 2 6
12 4 7
13 1 4
14 3 6
15 6 8
16 3 4
17 2 5
18 3 6
o
o
o


t t
t
t
H
H
o
>
=
=
=
=
=
11 . 2
19 . 8
% 5
:
:
2 1 1
2 1
H
o
rejected hence Consumers rate the product differently in two cities.

Nonparametric Test (Applicable on non metric data i.e


nominal and ordinal data)
2


tests the statistical significance of the observed association in a cross
tabulation
2
) 1 )( 1 (
2
2
~
) (
(


=
c r
i
i i
E
E O

Find at (r-1)(c-1) d.f and compare with
2
05 . 0

Here Ei = (row total)(Column total) Grand total


Example
Gender and Internet usage
Internet
Usage
Male Female Row Total
Light(1) 5 10 15
Heavy(2) 10 5 15
Column 15 15 30
(responses are nominal)

O
i
E
i
(O
i
-E
i
) (Oi-Ei)
2
(Oi-Ei)
2
/E
i
5 15*15/30 = 7.5 |
10 15*15/30 = 7.5 |
11 15*15/30 = 7.5 |
5 15*15/30 = 7.5 |


(


i
i i
E
E O
2
) (
333 . 3
2
=
841 . 3 1
2
05 . 0
= at
Steps in testing the significance of statistics

Step I
H
o
: There is no association b/w Gender and Internet usage
Step II
H1 : Association b/w G & I is statistically significant
Step III
Level of significance = 0,05
Step IV
Under the validity of H
o
, test statistic would be





Step V Conclusion

<

2

2
) 1 )( 1 (
2
2
~
) (
(


=
c r
i
i i
E
E O

333 . 3
2
=
1
2
05 . 0
at
2









There is not enough evidence to reject the null hypothesis.
Therefore , the association between sex and internet usage is not
statistically significant.

2

Test for independence of attributes



In this case d.f = (r-1)(c-1)
Example:
Suppose that , in a public opinion survey answers to the questions :--
(a) Do you drink ?
(b) Are you in favor of local option on sale of liquor ?

were tabulated below







Can you infer that opinion on local option is dependent on whether or not
an individual drinks ?
Question (b) Question(a) Total
Yes No
Yes 56 31 87
No 18 6 24
Total 74 37 111
Examples on Square:

1. Survey of newspaper readership






H
o
Does income category influences the choice of paper

2. Ownership of Machines




H
o
Does income category influences the ownership
2

HIG MIG LIG Total


Times of India 35 72 172 279
Hindustan Times 21 62 164 247
Indian Express 14 26 84 124
Total 70 160 420 650
MIG HIG
Owners 23 13
Non owners 12 52
Hypothesis Testing on ranked data

Q: Rank the five brands of refrigerator shown on a scale of 1 to 5.
(1 = Best and 5 = Worst )

BRAND Rank
Whirlpool
Kelvinator
Godrej
Samsung
Videocon
Rank 1 2 3 4 5 Total
Wh 40 30 20 5 5 100
Kel 20 10 30 15 25 100
Godrj 15 20 10 15 40 100
Samsng 25 10 20 15 30 100
Vid 10 20 30 10 30 100
Can we say ranks given by the respondents are independent of the brand
or not
Significant Values Of CHI Square
Distribution (Right -Tail Areas)
P[x
2
> x
2
v
()] =
x
2
v
()
Rejection
region ()
X
2

Distribution
Curve
d.f.
(v)
Probability ()
99 95 .50 .10 .05 .02 .01
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
.000157
.0201
.115
.297
.554
.872
1.239
1.646
2.088
2.558
3.053
3.571
4.107
4.660
5.229
5.812
6.408
7.015
70.633
8.260
8.897
9.542
10.196
10.856
11.524
12.198
12.879
13.565
14.256
14.953

.000393
.103
.352
.711
1.145
1.635
2.167
2.733
3.325
3.940
4.575
5.226
5.892
6.571
7.261
7.962
8.672
9.390
10.117
10.851
11.591
12.338
13.091
13.848
14.611
15.379
16.151
16.928
17.708
18.493
.455
1.386
2.366
3.357
4.351
5.348
6.346
7.344
8.343
9.342
10.341
11.340
12.340
13.339
14.339
15.338
16.338
17.338
18.338
19.337
20.337
21.337
22.337
23.337
24.337
25.336
26.336
27.336
28.336
29.336
2.706
4.605
6.251
7.779
9.236
10.645
12.017
13.362
14.684
15.987
17.275
18.549
19.812
21.064
22.307
23.542
24.769
25.989
27.204
28.412
29.615
30.813
32.007
33.196
34.382
35.563
36.741
37.916
39.087
40.256
3.841
5.991
7.815
9.488
11.070
12.592
14.067
15.507
16.919
18.307
19.675
21.026
22.362
23.635
24.996
26.296
27.587
28.869
30.144
31.410
32.671
33.924
35.172
36.415
37.652
38.885
40.113
41.337
42.557
43.773
5.214
7.824
9.837
11.668
13.388
15.033
16.622
18.268
19.679
21.161
22.618
24.054
25.472
26.173
28.259
29.633
30.995
32.346
33.687
35.020
36.343
37.659
38.968
40.270
41.566
43.856
44.140
45.419
46.693
47.962

6.635
9.210
11.341
13.277
15.086
16.812
18.475
20.090
21.666
23.209
24.725
26.217
27.688
29.141
30.578
32.000
33.409
34.802
36.191
37.566
38.932
40.289
41.638
42.980
44.314
45.642
46.963
48.278
49.588
50.892

Вам также может понравиться