Tests of Goodness of Fit and
Independence
Learning Objectives
1 Know how to conduct a goodness of fit test
2 Know how to use sample data to test for independence of two variables
3 Understand the role of the chisquare distribution in conducting tests of goodness of fit and independence
4 Be able to conduct a goodness of fit test for cases where the population is hypothesized to have either a multinomial a Poisson or a normal probability distribution
5 For a test of independence be able to set up a contingency table determine the observed and expected frequencies and determine if the two variables are independent
Solutions
1 Expected frequencies e1 200 (40) 80 e2 200 (40) 80
e3 200 (20) 40
Actual frequencies f1 60 f2 120 f3 20
921034 with k 1 3 1 2 degrees of freedom
Since 35 > 921034 reject the null hypothesis The population proportions are not as stated in the null hypothesis
2 Expected frequencies e1 300 (25) 75 e2 300 (25) 75
e3 300 (25) 75 e4 300 (25) 75
Actual frequencies f1 85 f2 95 f3 50 f4 70
781473 with k 1 4 1 3 degrees of freedom
Since c2 1533 > 781473 reject H0
We conclude that the proportions are not all equal
3 H0 pABC 29 pCBS 28 pNBC 25 pIND 18
Ha The proportions are not pABC 29 pCBS 28 pNBC 25 pIND 18
Expected frequencies 300 (29) 87 300 (28) 84
300 (25) 75 300 (18) 54
e1 87 e2 84 e3 75 e4 54
Actual frequencies f1 95 f2 70 f3 89 f4 46
781 (3 degrees of freedom)
Do not reject H0 there is no significant change in the viewing audience proportions
4
Observed
Expected
Hypothesized
Frequency
Frequency
Category
Proportion
(fi)
(ei)
(fi ei)2 ei
Brown
030
177
1518
418
Yellow
020
135
1012
1129
Red
020
79
1012
487
Orange
010
41
506
182
Green
010
36
506
421
Blue
010
38
506
314
Totals
506
2951
1107 (5 degrees of freedom)
Since 2951 > 1107 we conclude that the percentage figures reported by the company have changed
5
Observed
Expected
Hypothesized
Frequency
Frequency
Category
Proportion
(fi)
(ei)
(fi ei)2 ei
Full Service
13
264
24933
086
Discount
13
255
24933
013
Both
13
229
24933
166
Totals
748
265
461 (2 degrees of freedom)
Since 265 < 461 there is no significant difference in preference among the three service choices
6
Observed
Expected
Hypothesized
Frequency
Frequency
Category
Proportion
(fi)
(ei)
(fi ei)2 ei
News and Opinion
16
20
1917
04
General Editorial
16
15
1917
91
Family Oriented
16
30
1917
612
BusinessFinancial
16
22
1917
42
Female Oriented
16
16
1917
52
AfricanAmerican
16
12
1917
268
Totals
115
1069
924 (5 degrees of freedom)
Since 1069 > 924 we conclude that there is a difference in the proportion of ads with guilt appeals among the six types of magazines
7 Expected frequencies ei (1 3) (135) 45
With 2 degrees of freedom 599
Do not reject H0 there is no justification for concluding a difference in preference exists
8 H0 p1 03 p2 28 p3 45 p4 24
df 3 1134
Reject H0 if c2 > 1134
Rating
Observed
Expected
(fi ei)2 ei
Excellent
24
03(400) 12
1200
Good
124
28(400) 112
129
Fair
172
45(400) 180
36
Poor
80
24(400) 96
267
400
400
c2 1631
Reject H0 conclude that the ratings differ A comparison of observed and expected frequencies show telephone service is slightly better with more excellent and good ratings
9 H0 The column variable is independent of the row variable
Ha The column variable is not independent of the row variable
Expected Frequencies
A
B
C
P
285
399
456
Q
215
301
344
737776 with (2 1) (3 1) 2 degrees of freedom
Since c2 786 > 737776 Reject H0
Conclude that the column variable is not independent of the row variable
10 H0 The column variable is independent of the row variable
Ha The column variable is not independent of the row variable
Expected Frequencies
A
B
C
P
175000
306250
218750
Q
287500
503125
359375
R
137500
240625
171875
948773 with (3 1) (3 1) 4 degrees of freedom
Since c2 1978 > 948773 Reject H0 Conclude that the column variable is not independent of f the row variable
11 H0 Type of ticket purchased is independent of the type of flight
Ha Type of ticket purchased is not independent of the type of flight
Expected Frequencies
e11 3559 e12 1541
e21 15073 e22 6527
e31 45568 e32 19732
Observed
Expected
Frequency
Frequency
Ticket
Flight
(fi)
(ei)
(fi ei)2 ei
First
Domestic
29
3559
122
First
International
22
1541
282
Business
Domestic
95
15073
2061
Business
International
121
6527
4759
Full Fare
Domestic
518
45568
852
Full Fare
International
135
19732
1968
Totals
920
10043
599 with (3 1)(2 1) 2 degrees of freedom
Since 10043 > 599 we conclude that the type of ticket purchased is not independent of the type of flight
12 a Observed Frequency (fij)
Domestic
European
Asian
Total
Same
125
55
68
248
Different
140
105
107
352
Total
265
160
175
600
Expected Frequency (eij)
Domestic
European
Asian
Total
Same
10953
6613
7233
248
Different
15547
9387
10267
352
Total
265
160
175
600
Chi Square (fij eij)2 eij
Domestic
European
Asian
Total
Same
218
187
026
432
Different
154
132
018
304
c2 736
Degrees of freedom 2 599
Reject H0 conclude brand loyalty is not independent of manufacturer
b Brand Loyalty
Domestic 125265 472 (472) ¬ Highest
European 55160 344 (344)
Asian 68175 389 (389)
13
Industry
Major
Oil
Chemical
Electrical
Computer
Business
30
225
175
30
Engineering
30
225
175
30
Note Values shown above are the expected frequencies
113449 (3 degrees of freedom 1 x 3 3)
c2 1239
Reject H0 conclude that major and industry not independent
14 Expected Frequencies
e11 310 e12 310
e21 295 e22 295
e31 130 e32 130
e41 55 e42 55
e51 70 e52 70
e61 140 e62 140
Observed
Expected
Frequency
Frequency
Most Difficult
Gender
(fi)
(ei)
(fi ei)2 ei
Spouse
Men
37
310
116
Spouse
Women
25
310
116
Parents
Men
28
295
008
Parents
Women
31
295
008
Children
Men
7
130
277
Children
Women
19
130
277
Siblings
Men
8
55
114
Siblings
Women
3
55
114
InLaws
Men
4
70
129
InLaws
Women
10
70
129
Other Relatives
Men
16
140
029
Other Relatives
Women
12
140
029
Totals
200
1343
110705 with (6 1) (2 1) 5 degrees of freedom
Since 1343 > 110705 we conclude that gender is not independent of the most difficult person to buy for
15 Expected Frequencies
e11 1716 e12 1284
e21 1488 e22 1112
e31 2803 e32 2097
e41 2231 e42 1669
e51 1716 e52 1284
e61 1545 e62 1155
Observed
Expected
Frequency
Frequency
Magazine
Appeal
(fi)
(ei)
(fi ei)2 ei
News
Guilt
20
1716
047
News
Fear
10
1284
063
General
Guilt
15
1488
000
General
Fear
11
1112
000
Family
Guilt
30
2803
014
Family
Fear
19
2097
018
Business
Guilt
22
2231
000
Business
Fear
17
1669
001
Female
Guilt
16
1716
008
Female
Fear
14
1284
011
AfricanAmerican
Guilt
12
1545
077
AfricanAmerican
Fear
15
1155
103
Totals
201
341
1509 with (6 1) (2 1) 5 degrees of freedom
Since 341 < 1509 the hypothesis of independence cannot be rejected
34 a Observed Frequency (fij)
Pharm
Consumer
Computer
Telecom
Total
Correct
207
136
151
178
672
Incorrect
3
4
9
12
28
Total
210
140
160
190
700
Expected Frequency (eij)
Pharm
Consumer
Computer
Telecom
Total
Correct
2016
1344
1536
1824
672
Incorrect
84
56
64
76
28
Total
210
140
160
190
700
Chi Square (fij eij)2 eij
Pharm
Consumer
Computer
Telecom
Total
Correct
14
02
04
11
31
Incorrect
347
46
106
255
753
c2 785
Degrees of freedom 3 781473
Do not reject H0 conclude order fulfillment is not independent of industry
b The pharmaceutical industry is doing the best with 207 of 210 (986) correctly filled orders
17 Expected Frequencies
Part Quality
Supplier
Good
Minor Defect
Major Defect
A
8876
607
514
B
17309
1183
1008
C
13315
910
775
c2 796
948773 (4 degrees of freedom 2 x 2 4)
Do not reject H0 conclude that the assumption of independence cannot be rejected
18 Expected Frequencies
Party Affiliation
Education Level
Democratic
Republican
Independent
Did not complete high school
28
28
14
High school degree
32
32
16
College degree
40
40
20
c2 1342
132767 (4 degrees of freedom 2 x 2 4)
Reject H0 conclude that party affiliation is not independent of education level
19 Expected Frequencies
e11 1181 e12 844 e13 2475
e21 840 e22 600 e23 1760
e31 2179 e32 1556 e33 4565
Observed
Expected
Frequency
Frequency
Siskel
Ebert
(fi)
(ei)
(fi ei)2 ei
Con
Con
24
1181
1257
Con
Mixed
8
844
002
Con
Pro
13
2475
558
Mixed
Con
8
840
002
Mixed
Mixed
13
600
817
Mixed
Pro
11
1760
248
Pro
Con
10
2179
638
Pro
Mixed
9
1556
277
Pro
Pro
64
4565
738
Totals
160
4536
1328 with (3 1) (3 1) 4 degrees of freedom
Since 4536 > 1328 we conclude that the ratings are not independent
20 First estimate m from the sample data Sample size 120
Therefore we use Poisson probabilities with m 13 to compute expected frequencies
x
Observed Frequency
Poisson Probability
Expected Frequency
Difference
(fi ei)
0
39
2725
32700
6300
1
30
3543
42516
12516
2
30
2303
27636
2364
3
18
0998
11976
6024
4 or more
3
0430
5160
2160
781473 with 5 1 1 3 degrees of freedom
Since c2 90348 > 781473 Reject H0
Conclude that the data do not follow a Poisson probability distribution
21 With n 30 we will use six classes with 16 23 of the probability associated with each class
2280 s 62665
The z values that create 6 intervals each with probability 1667 are 98 43 0 43 98
z
Cut off value of x
98
228 98 (62665) 1666
43
228 43 (62665) 2011
0
228 + 0 (62665) 2280
43
228 + 43 (62665) 2549
98
228 + 98 (62665) 2894
Interval
Observed Frequency
Expected Frequency
Difference
less than 1666
3
5
2
1666 2011
7
5
2
2011 2280
5
5
0
2280 2549
7
5
2
2549 2894
3
5
2
2894 and up
5
5
0
934840 with 6 2 1 3 degrees of freedom
Since c2 320 £ 934840 Do not reject H0
The claim that the data comes from a normal distribution cannot be rejected
22
Use Poisson probabilities with m 1
c2 430
599147 (2 degrees of freedom)
Do not reject H0 the assumption of a Poisson distribution cannot be rejected
23
x
Observed
Poisson Probabilities
Expected
0
15
1353
1353
1
31
2707
2707
2
20
2707
2707
3
15
1804
1804
4
13
0902
902
5 or more
6
0527
527
c2 498
777944 (4 degrees of freedom)
Do not reject H0 the assumption of a Poisson distribution cannot be rejected
24 245 s 3 n 30 Use 6 classes
Interval
Observed Frequency
Expected Frequency
less than 2156
5
5
2156 2321
4
5
2321 2450
3
5
2450 2579
7
5
2579 2744
7
5
2741 up
4
5
c2 28
625139 (3 degrees of freedom 6 2 1 3)
Do not reject H0 the assumption of a normal distribution cannot be rejected
25 71 s 17 n 25 Use 5 classes
Interval
Observed Frequency
Expected Frequency
less than 567
7
5
567 665
7
5
665 746
1
5
746 845
1
5
845 up
9
5
c2 112
921034 (2 degrees of freedom)
Reject H0 conclude the distribution is not a normal distribution
26
Observed
60
45
59
36
Expected
50
50
50
50
c2 804
781473 (3 degrees of freedom)
Reject H0 conclude that the order potentials are not the same in each sales territory
27
Observed
48
323
79
16
63
Expected
3703
30682
12696
2116
3703
Since 4169 > 132767 reject H0
Mutual fund investors' attitudes toward corporate bonds differ from their attitudes toward corporate stock
28
Observed
20
20
40
60
Expected
35
35
35
35
Since 3143 > 781473 reject H0
The park manager should not plan on the same number attending each day Plan on a larger staff for Sundays and holidays
29
Observed
13
16
28
17
16
Expected
18
18
18
18
18
c2 744
948773
Do not reject H0 the assumption that the number of riders is uniformly distributed cannot be rejected
30
Observed
Expected
Hypothesized
Frequency
Frequency
Category
Proportion
(fi)
(ei)
(fi ei)2 ei
Very Satisfied
028
105
140
875
Somewhat Satisfied
046
235
230
011
Neither
012
55
60
042
Somewhat Dissatisfied
010
90
50
3200
Very Dissatisfied
004
15
20
125
Totals
500
4253
949 (4 degrees of freedom)
Since 4253 > 949 we conclude that the job satisfaction for computer programmers is different than the job satisfaction for IS managers
31 Expected Frequencies
Quality
Shift
Good
Defective
1st
36844
3156
2nd
27633
2367
3rd
18422
1578
c2 811
599147 (2 degrees of freedom)
Reject H0 conclude that shift and quality are not independent
32 Expected Frequencies
e11 104619 e12 63281
e21 2866 e22 1734
e31 25859 e32 15641
e41 51655 e42 31245
Observed
Expected
Frequency
Frequency
Employment
Region
(fi)
(ei)
(fi ei)2 ei
FullTime
Eastern
1105
104619
331
Fulltime
Western
574
63281
546
PartTime
Eastern
31
2866
019
PartTime
Western
15
1734
032
SelfEmployed
Eastern
229
25859
339
SelfEmployed
Western
186
15641
560
Not Employed
Eastern
485
51655
193
Not Employed
Western
344
31245
319
Totals
2969
2337
781 with (4 1) (2 1) 3 degrees of freedom
Since 2337 > 781 we conclude that employment status is not independent of region
33 Expected frequencies
Loan Approval Decision
Loan Offices
Approved
Rejected
Miller
2486
1514
McMahon
1864
1136
Games
3107
1893
Runk
1243
757
c2 221
781473 (3 degrees of freedom)
Do not reject H0 the loan decision does not appear to be dependent on the officer
34 a Observed Frequency (fij)
Never Married
Married
Divorced
Total
Men
234
106
10
350
Women
216
168
16
400
Total
450
274
26
750
Expected Frequency (eij)
Never Married
Married
Divorced
Total
Men
210
12787
1213
350
Women
240
14613
1387
400
Total
450
274
26
750
Chi Square (fij eij)2 eij
Never Married
Married
Divorced
Total
Men
274
374
38
686
Women
240
327
33
600
c2 1286
Degrees of freedom 2 921
Reject H0 conclude martial status is not independent of gender
b Martial Status
Never Married
Married
Divorced
Men
669
303
29
Women
540
420
40
Men 100 669 331 have been married
Women 100 540 460 have been married
35 Expected Frequencies
948773 (4 degrees of freedom)
Since 976 < 948773 reject H0
Banking tends to have lower PE ratios We can conclude that industry type and PE ratio are related
36 Expected Frequencies
Days of the Week
County
Sun
Mon
Tues
Wed
Thur
Fri
Sat
Total
Urban
567
476
551
567
601
726
442
393
Rural
113
94
109
113
119
144
88
78
Total
68
57
66
68
72
87
53
471
c2 620
125916 (6 degrees of freedom)
Do not reject H0 the assumption of independence cannot be rejected
37 7683 s 1243
Interval
Observed Frequency
Expected Frequency
less than 6254
5
5
6254 6850
3
5
6850 7285
6
5
7285 7683
5
5
7683 8081
5
5
8081 8516
7
5
8516 9112
4
5
9112 up
5
5
c2 2
110705 (5 degrees of freedom)
Do not reject H0 the assumption of a normal distribution cannot be rejected
38 Expected Frequencies
Los Angeles
San Diego
San Francisco
San Jose
Total
Occupied
1657
1243
1864
1657
642
Vacant
343
257
386
343
133
Total
2000
1500
2250
2000
775
781473 with 3 degrees of freedom
Since c2 778 £ 781473 Do not reject H0
We cannot conclude that office vacancies are dependent on metropolitan area but it is close the pvalue is slightly larger than 05
39 a
x
Observed Frequencies
Binomial Prob
n 4 p 30
Expected Frequencies
0
30
2401
2401
1
32
4116
4116
2
25
2646
2646
3
10
0756
756
4
3
0081
81
100
10000
The expected frequency of x 4 is 81 Combine x 3 and x 4 into one category so that all expected frequencies are 5 or more
x
Observed Frequencies
Expected Frequencies
0
30
2401
1
32
4116
2
25
2646
3 or 4
13
837
100
10000
b With 3 degrees of freedom 781473 Reject H0 if c2 > 781473
Do not reject H0 conclude that the assumption of a binomial distribution cannot be rejected
文档香网(httpswwwxiangdangnet)户传
《香当网》用户分享的内容,不代表《香当网》观点或立场,请自行判断内容的真实性和可靠性!
该内容是文档的文本内容,更好的格式请下载文档