Uploaded by 王寅楓

STAT CHAP 12 PPT

advertisement
Chapter 12
Chi-Squared Tests
NCCU-202203Stat-Prof SF Yang
© 2012 Cengage Learning. All Rights Reserved. May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole or in part.
A Common Theme…
What to do?
Data Type?
Number of
Categories?
Statistical
Technique:
Describe a
population
Nominal
Two or more
X2 goodness of fit
test
Compare two
populations
Nominal
Two or more
X2 test of a
contingency table
Compare two or
more populations
Nominal
--
X2 test of a
contingency table
Analyze relationship
between two
variables
Nominal
--
X2 test of a
contingency table
One data type…
…Two techniques
NCCU-202203Stat-Prof SF Yang
© 2012 Cengage Learning. All Rights Reserved. May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole or in part.
Two Techniques…
The first is a goodness-of-fit test applied to data produced by
a multinomial experiment, a generalization of a binomial
experiment and is used to describe one population of data.
The second uses data arranged in a contingency table to
determine whether two classifications of a population of
nominal data are statistically independent; this test can also
be interpreted as a comparison of two or more populations.
In both cases, we use the chi-squared (
) distribution.
NCCU-202203Stat-Prof SF Yang
© 2012 Cengage Learning. All Rights Reserved. May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole or in part.
Tests of Goodness of Fit and Independence
Goodness of Fit Test: A Multinomial Population
test for pi, i=1,2,..k.
 Test of Independence for two events:
 cancer indep. of cigarattee?
 Goodness of Fit Test: Poisson
and Normal Distributions
Test if data follows a given distribution
NCCU-202203Stat-Prof SF Yang
© 2012 Cengage Learning. All Rights Reserved. May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole or in part.
The Multinomial Experiment…
Unlike a binomial experiment which only has two possible
outcomes (e.g. heads or tails), a multinomial experiment:
• Consists of a fixed number, n, of trials.
• Each trial can have one of k outcomes, called cells.
• Each probability pi remains constant.
• Our usual notion of probabilities holds, namely:
p1 + p2 + … + pk = 1, and
• Each trial is independent of the other trials.
NCCU-202203Stat-Prof SF Yang
© 2012 Cengage Learning. All Rights Reserved. May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole or in part.
Goodness of Fit for Proportions of a Multinomial Population
•
examples
1. Global maket share for famous pad ( smart phone)company
•
P(Apple)= 0.8, P(Sumsong)= 0.1 P(HTC)= 0.1
•
( verify it!!)
2. In Taiwan. Notebook (PC) maket share for Acer, Asus,
•
others
•
P(Acer)=0.4, P(Asus)=0.5, P(others)=0.1
•
(is it ?)
NCCU-202203Stat-Prof SF Yang
© 2012 Cengage Learning. All Rights Reserved. May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole or in part.
examples
• 3.
• voting rate in Taipei=VR in Taichung=VR in Tainan
• =VR in Pingtung
•
•
H0: p1=p2=p3=p4=p5
H1: not all same
NCCU-202203Stat-Prof SF Yang
© 2012 Cengage Learning. All Rights Reserved. May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole or in part.
Chi-squared Goodness-of-Fit Test…
We test whether there is sufficient evidence to reject a
specified set of values for pi.
To illustrate, our null hypothesis is:
H0: p1 = a1, p2 = a2, …, pk = ak
where a1, a2, …, ak are the values we want to test.
Our research hypothesis is:
H1: At least one pi is not equal to its specified value
NCCU-202203Stat-Prof SF Yang
© 2012 Cengage Learning. All Rights Reserved. May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole or in part.
Example 15.1
Two companies, A and B, have recently conducted
aggressive advertising campaigns to maintain and possibly
increase their respective shares of the market for fabric
softener. These two companies enjoy a dominant position in
the market. Before the advertising campaigns began, the
market share of company A was 45%, whereas company B
had 40% of the market. Other competitors accounted for the
remaining 15%.
NCCU-202203Stat-Prof SF Yang
© 2012 Cengage Learning. All Rights Reserved. May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole or in part.
Example 15.1
To determine whether these market shares changed after the
advertising campaigns, a marketing analyst solicited the
preferences of a random sample of 200 customers of fabric
softener.(織物柔軟劑 ) Of the 200 customers, 102 indicated
a preference for company A's product, 82 preferred company
B's fabric softener, and the remaining 16 preferred the
products of one of the competitors. Can the analyst infer at
the 5% significance level that customer preferences have
changed from their levels before the advertising campaigns
were launched?
NCCU-202203Stat-Prof SF Yang
© 2012 Cengage Learning. All Rights Reserved. May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole or in part.
Example 15.1…
We compare market share before and after an advertising
campaign to see if there is a difference (i.e. if the advertising
was effective in improving market share). We hypothesize
values for the parameters equal to the before-market share.
That is,
H0: p1 = .45, p2 = .40, p3 = .15
The alternative hypothesis is a denial of the null. That is,
H1: At least one pi is not equal to its specified value
NCCU-202203Stat-Prof SF Yang
© 2012 Cengage Learning. All Rights Reserved. May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole or in part.
Example 15.1…
Test Statistic
If the null hypothesis is true, we would expect the number of
customers selecting brand A, brand B, and other to be 200 times the
proportions specified under the null hypothesis. That is,
e1 = 200(.45) = 90
e2 = 200(.40) = 80
e3 = 200(.15) = 30
In general, the expected frequency for each cell is given by
ei = npi
This expression is derived from the formula for the expected value of a
binomial random variable, introduced in Section 7.4.
NCCU-202203Stat-Prof SF Yang
© 2012 Cengage Learning. All Rights Reserved. May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole or in part.
Example 15.1…
If the expected frequencies and the observed frequencies are quite
different, we would conclude that the null hypothesis is false, and we
would reject it.
However, if the expected and observed frequencies are similar, we
would not reject the null hypothesis.
The test statistic measures the similarity of the expected and observed
frequencies.
NCCU-202203Stat-Prof SF Yang
© 2012 Cengage Learning. All Rights Reserved. May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole or in part.
Chi-squared Goodness-of-Fit Test…
Our Chi-squared goodness of fit test statistic is given by:
observed
frequency
expected
frequency
Note: this statistic is approximately Chi-squared with k–1
degrees of freedom provided the sample size is large. The
rejection region is:
NCCU-202203Stat-Prof SF Yang
© 2012 Cengage Learning. All Rights Reserved. May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole or in part.
Example 15.1…
COMPUTE
In order to calculate our test statistic, we lay-out the data in a
tabular fashion for easier calculation by hand:
Observed
Frequency
Expected
Frequency
Delta
Summation
Component
fi
ei
(fi – ei)
(fi – ei)2/ei
A
102
90
12
1.60
B
82
80
2
0.05
Others
16
30
-14
6.53
Total
200
200
Company
8.18
Check that these are equal
NCCU-202203Stat-Prof SF Yang
© 2012 Cengage Learning. All Rights Reserved. May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole or in part.
Example 15.1…
INTERPRET
Our rejection region is:
Since our test statistic is 8.18 which is greater than our
critical value for Chi-squared, we reject H0 in favor of H1,
that is,
“There is sufficient evidence to infer that the proportions
have changed since the advertising campaigns were
implemented”
NCCU-202203Stat-Prof SF Yang
© 2012 Cengage Learning. All Rights Reserved. May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole or in part.
Example 15.1…
p-value
NCCU-202203Stat-Prof SF Yang
© 2012 Cengage Learning. All Rights Reserved. May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole or in part.
Required Conditions…
In order to use this technique, the sample size must be large
enough so that the expected value for each cell is 5 or more.
(i.e. n x pi ≥ 5)
If the expected frequency is less than five, combine it with
other cells to satisfy the condition.
NCCU-202203Stat-Prof SF Yang
© 2012 Cengage Learning. All Rights Reserved. May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole or in part.
example
startbuck PA: Coffee market share for company
7-11 PB: Coffee market share for company
family Pc: Coffee market share for company
Ho: Pa=0.6, Pb=0.3, Pc=0.1 (Mulitnomial distri)
H1: not Ho
take 200 customers randomly
2
(
f

e
)
/e
f
e
f-e
A 130
120=0.6x200 10
100/120=0.83
B
50
60
-10
100/60=1.67
C
20
20
0
2
2
2
(130

120)
(50

60)
(20

20)
2 


 0.497
120
60
20
NCCU-202203Stat-Prof SF Yang
© 2012 Cengage Learning. All Rights Reserved. May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole or in part.
alpha=0.1, d.f=2,
 20.1 (2)  6.405
(1)  2  2.497   20.1 (2)  6.405 Do not reject Ho
(2)
p-value= P(  2  2.497) =?? >alpha=0.1
Using minitab to get p-value
NCCU-202203Stat-Prof SF Yang
© 2012 Cengage Learning. All Rights Reserved. May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole or in part.
Table 12.1
3 indep. binomial distr.
•
Aotu. Owners
•
Vjevrolet Ford Honda
total
• Like to ei Yes 69(78) 120(128.4) 123(109.2) 312
• repurchase
•
no 56(47) 80(71.6) 52(65.8) 188
•
total 125
200
175
500
• H0: p1=p2=p3(=p)
p^=312/500=0.624
• H1: not H0
e11=0.624x125=78
•
e21=0.624x200=124.8
•
e31=109.2
NCCU-202203Stat-Prof
SF Yang
© 2012 Cengage Learning. All Rights Reserved. May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole or in part.
Table 12.1
 2  ( fij  eij ) 2 / eij  7.89
 20.05 (2)  5.991
 2  7.89   20.05 (2)  5.991
NCCU-202203Stat-Prof SF Yang
© 2012 Cengage Learning. All Rights Reserved. May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole or in part.
Multinomial Distribution Goodness of Fit Test

Rejection Rule
Reject H0 if p-value <  or 2 > 2 (,k-1)
With  = .1 and
k-1=3-1=1
degrees of freedom
Do Not Reject H0
Reject H0
4.605
2
NCCU-202203Stat-Prof SF Yang
© 2012 Cengage Learning. All Rights Reserved. May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole or in part.
Goodness of Fit Test: Poisson Distribution

Example: Troy Parking Garage
A random sample of 100 oneminute time intervals resulted
in the customer arrivals listed
below. A statistical test must
be conducted to see if the assumption of a Poisson
distribution is reasonable.
# Arrivals 0
1
2
3
4
5
6
7
8
Frequency 0
1
4 10 14 20 12 12 9
9 10 11 12
8
6
3
1
NCCU-202203Stat-Prof SF Yang
© 2012 Cengage Learning. All Rights Reserved. May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole or in part.
Goodness of Fit Test: Poisson Distribution
• Hypotheses
H0: Number of cars entering the garage during
a one-minute interval is Poisson distributed
Ha: Number of cars entering the garage during a
one-minute interval is not Poisson distributed
NCCU-202203Stat-Prof SF Yang
© 2012 Cengage Learning. All Rights Reserved. May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole or in part.
Goodness of Fit Test: Poisson Distribution
• Estimate of Poisson Probability Function
otal Arrivals = 0(0) + 1(1) + 2(4) + . . . + 12(1) = 600
Estimate of  = 600/100 = 6
Total Time Periods = 100
Hence,
6 x e 6
f ( x) 
x!
NCCU-202203Stat-Prof SF Yang
© 2012 Cengage Learning. All Rights Reserved. May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole or in part.
Goodness of Fit Test: Poisson Distribution
• Expected Frequencies
x
f (x )
nf (x )
x
0
1
2
3
4
5
6
.0025
.0149
.0446
.0892
.1339
.1606
.1606
.25<5
1.49<5
4.46<5
8.92
13.39
16.06
16.06
7
8
9
10
11
12+
Total
f (x )
nf (x )
.1377
.1033
.0688
.0413
.0225
.0201
1.0000
13.77
10.33
6.88
4.13
2.25<5
2.01<5
100.00
NCCU-202203Stat-Prof SF Yang
© 2012 Cengage Learning. All Rights Reserved. May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole or in part.
Goodness of Fit Test: Poisson Distribution
• Observed and Expected Frequencies
i
fi
ei
f i - ei
0 or 1 or 2
3
4
5
6
7
8
9
10 or more
5
10
14
20
12
12
9
8
10
6.20
8.92
13.39
16.06
16.06
13.77
10.33
6.88
8.39
-1.20
1.08
0.61
3.94
-4.06
-1.77
-1.33
1.12
1.61
NCCU-202203Stat-Prof SF Yang
© 2012 Cengage Learning. All Rights Reserved. May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole or in part.
Goodness of Fit Test: Poisson Distribution

Rejection Rule
With  = .05 and k - p - 1 = 9 - 1 - 1 = 7 d.f.
(where k = number of categories and p = number
2
 14.067
of population parameters estimated), .05
Reject H0 if p-value < .05 or 2 > 14.067.
• Test Statistic
2
2
2
(

1.20)
(1.08)
(1.61)
2 

 ... 
 3.268
6.20
8.92
8.39
Do not reject H0
Follows Poisson
NCCU-202203Stat-Prof SF Yang
© 2012 Cengage Learning. All Rights Reserved. May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole or in part.
Exercise
Goodness of Fit Test: Normal Distribution
1. Set up the null and alternative hypotheses.
2. Select a random sample and
a. Compute the mean and standard deviation.
b. Define intervals of values so that the expected
frequency is at least 5 for each interval.
c. For each interval record the observed frequencies
3. Compute the expected frequency, ei , for each interval.
NCCU-202203Stat-Prof SF Yang
© 2012 Cengage Learning. All Rights Reserved. May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole or in part.
Goodness of Fit Test: Normal Distribution
4. Compute the value of the test statistic.
2
(
f

e
)
2   i i
ei
i 1
k
5. Reject H0 if  2  2 (where  is the significance level
and there are k - 3 degrees of freedom).
NCCU-202203Stat-Prof SF Yang
© 2012 Cengage Learning. All Rights Reserved. May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole or in part.
Normal Distribution Goodness of Fit Test
• Example: IQ Computers
IQ Computers (one better than HP?)
IQ
manufactures and sells a general
purpose microcomputer. As part of
a study to evaluate sales personnel, management
wants to determine, at a .05 significance level, if the
annual sales volume (number of units sold by a
salesperson) follows a normal probability distribution.
NCCU-202203Stat-Prof SF Yang
© 2012 Cengage Learning. All Rights Reserved. May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole or in part.
Normal Distribution Goodness of Fit Test

Example: IQ Computers
A simple random sample of 30 of
the salespeople was taken and their
numbers of units sold are below.
33
64
83
43
65
84
44
66
85
45
68
86
52
70
91
52
72
92
56
73
94
IQ
58 63 64
73 74 75
98 102 105
(sample mean = 71, sample standard deviation = 18.54)
NCCU-202203Stat-Prof SF Yang
© 2012 Cengage Learning. All Rights Reserved. May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole or in part.
Normal Distribution Goodness of Fit Test
• Hypotheses
H0: The population of number of units sold
has a normal distribution
Ha: The population of number of units sold
does not have a normal distribution
NCCU-202203Stat-Prof SF Yang
© 2012 Cengage Learning. All Rights Reserved. May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole or in part.
Normal Distribution Goodness of Fit Test
• Interval Definition
To satisfy the requirement of an expected
frequency of at least 5 in each interval we will
divide the normal distribution into 30/5 = 6
equal probability intervals.
NCCU-202203Stat-Prof SF Yang
© 2012 Cengage Learning. All Rights Reserved. May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole or in part.
Normal Distribution Goodness of Fit Test
• Interval Definition
Areas
= 1.00/6
= .1667
53.02
71
88.98 = 71 + .97(18.54)
71  .43(18.54) = 63.03 78.97
NCCU-202203Stat-Prof SF Yang
© 2012 Cengage Learning. All Rights Reserved. May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole or in part.
Normal Distribution Goodness of Fit Test
• Observed and Expected Frequencies
i
fi
ei
f i - ei
Less than 53.02
53.02 to 63.03
63.03 to 71.00
71.00 to 78.97
78.97 to 88.98
More than 88.98
Total
6
3
6
5
4
6
30
5
5
5
5
5
5
30
1
-2
1
0
-1
1
NCCU-202203Stat-Prof SF Yang
© 2012 Cengage Learning. All Rights Reserved. May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole or in part.
Normal Distribution Goodness of Fit Test

Rejection Rule
With  = .05 and k - p - 1 = 6 - 2 - 1 = 3 d.f.
(where k = number of categories and p = number
2
 7.815
of population parameters estimated), .05
Reject H0 if p-value < .05 or 2 > 7.815.

Test Statistic
2
2
2
2
2
2
(1)
(

2)
(1)
(0)
(

1)
(1)
2 





 1.600
5
5
5
5
5
5
Do not reject H0
Support normal with mean =71
and SD=18.54
NCCU-202203Stat-Prof SF Yang
© 2012 Cengage Learning. All Rights Reserved. May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole or in part.
Test for Normality
•
see page 597 Chap 15.4
•
test for Normality
NCCU-202203Stat-Prof SF Yang
© 2012 Cengage Learning. All Rights Reserved. May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole or in part.
Identifying Factors…
Factors that Identify the Chi-Squared Goodness-of-Fit Test:
ei=(n)(pi)
NCCU-202203Stat-Prof SF Yang
© 2012 Cengage Learning. All Rights Reserved. May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole or in part.
Chi-squared Test of a Contingency Table
The Chi-squared test of a contingency table is used to:
• determine whether there is enough evidence to infer
that two nominal variables are related, and
• to infer that differences exist among two or more
populations of nominal variables.
In order to use use these techniques, we need to classify the
data according to two different criteria.
NCCU-202203Stat-Prof SF Yang
© 2012 Cengage Learning. All Rights Reserved. May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole or in part.
Example 15.2
The MBA program was experiencing problems scheduling
their courses. The demand for the program's optional courses
and majors was quite variable from one year to the next.
In desperation the dean of the business school turned to a
statistics professor for assistance.
The statistics professor believed that the problem may be the
variability in the academic background of the students and
that the undergraduate degree affects the choice of major.
NCCU-202203Stat-Prof SF Yang
© 2012 Cengage Learning. All Rights Reserved. May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole or in part.
Example 15.2
As a start he took a random sample of last year's MBA
students and recorded the undergraduate degree and the
major selected in the graduate program.
The undergraduate degrees were BA, BEng, BBA, and
several others.
There are three possible majors for the MBA students,
accounting, finance, and marketing. Can the statistician
conclude that the undergraduate degree affects the choice of
major?
NCCU-202203Stat-Prof SF Yang
© 2012 Cengage Learning. All Rights Reserved. May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole or in part.
Example 15.2
Xm15-02
The data are stored in two columns. The first column consist of
integers 1, 2, 3, and 4 representing the undergraduate degree
where
1 = BA
2 = BEng
3 = BBA
4 = other
The second column lists the MBA major where
1= Accounting
2 = Finance
3 = Marketing
NCCU-202203Stat-Prof SF Yang
© 2012 Cengage Learning. All Rights Reserved. May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole or in part.
Example 15.2
IDENTIFY
The problem objective is to determine whether two variables
(undergraduate degree and MBA major) are related. Both
variables are nominal. Thus, the technique to use is the chisquared test of a contingency table. The alternative
hypotheses specifies what we test. That is,
H1: The two variables are dependent
The null hypothesis is a denial of the alternative hypothesis.
H0: The two variables are independent.
NCCU-202203Stat-Prof SF Yang
© 2012 Cengage Learning. All Rights Reserved. May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole or in part.
Test Statistic
The test statistic is the same as the one used to test
proportions in the goodness-of-fit-test. That is, the test statistic
is
2
(
f

e
)
2  i i
ei
Note however, that there is a major difference between the two
applications. In this one the null does not specify the
proportions pi, from which we compute the expected values ei,
which we need to calculate the χ2 test statistic. That is, we
cannot use
e = npi
because we don’t know the pi (they are not specified by the
null hypothesis). It is necessary to estimate the pi from the
data.
NCCU-202203Stat-Prof SF Yang
© 2012 Cengage Learning. All Rights Reserved. May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole or in part.
Example 15.2
The first step is to count the number of students in each of
the 12 combinations. The result is called a crossclassification table.
NCCU-202203Stat-Prof SF Yang
© 2012 Cengage Learning. All Rights Reserved. May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole or in part.
Example 15.2
MBA Major
Undergrad
Degree
Accounting
Finance
Marketing
Total
BA
31
13
16
60
BEng
8
16
7
31
BBA
12
10
17
39
Other
10
5
7
22
Total
61
44
47
152
NCCU-202203Stat-Prof SF Yang
© 2012 Cengage Learning. All Rights Reserved. May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole or in part.
Example 15.2
If the null hypothesis is true (Remember we always start with this
assumption.) and the two nominal variables are independent, then, for
example
under H0
P(BA and Accounting) = [P(BA)] [P(Accounting)]
Since we don’t know the values of P(BA) or P(Accounting)
We need to use the data to estimate the probabilities.
NCCU-202203Stat-Prof SF Yang
© 2012 Cengage Learning. All Rights Reserved. May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole or in part.
Test Statistic
There are 152 students of which 61 who have chosen
accounting as their MBA major. Thus, we estimate the
probability of accounting as
P(Accounting)

61
 .401
152
Similarly
P(BA)  60  .395
152
NCCU-202203Stat-Prof SF Yang
© 2012 Cengage Learning. All Rights Reserved. May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole or in part.
Example 15.2…
If the null hypothesis is true
P(BA and Accounting) = (60/152)(61/152)
Now that we have the probability we can calculate the expected value.
That is,
E(BA and Accounting) = 152(60/152)(61/152)
= (60)(61)/152 = 24.08
We can do the same for the other 11 cells.
NCCU-202203Stat-Prof SF Yang
© 2012 Cengage Learning. All Rights Reserved. May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole or in part.
Example 15.2
COMPUTE
We can now compare observed with expected frequencies…
MBA Major
Undergrad
Degree
Accounting
Finance
Marketing
BA
31
24.08
13
17.37
16
18.55
BEng
8
12.44
16
8.97
7
9.59
BBA
12
15.65
10
11.29
17
12.06
Other
10
8.83
5
6.37
7
6.80
and calculate our test statistic:
NCCU-202203Stat-Prof SF Yang
© 2012 Cengage Learning. All Rights Reserved. May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole or in part.
test
•
X^2(0.05, (3-1)(4-1))=X^2(0.05, 6)=12.5916
•
X^2=14.7 > X^2(0.05, 6)=12.5916
•
•
•
•
reject H0
evidence to support dependent
P-value=P(X^2> 14.7)=0.0227 < alpha=0.05
NCCU-202203Stat-Prof SF Yang
© 2012 Cengage Learning. All Rights Reserved. May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole or in part.
Example 15.2…
COMPUTE
Using Excel : Click Add-Ins, Data Analysis Plus, Contingency
Table [if the table has already been prepared] or Contingency
Table (Raw Data) [if the table has not been completed]
NCCU-202203Stat-Prof SF Yang
© 2012 Cengage Learning. All Rights Reserved. May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole or in part.
Example 15.2…
COMPUTE
The printout below was produced from file Xm15-02
using the Contingency Table (Raw Data) command
A
B
C
1 Contingency Table
2
3
Degree
4 MBA Major
1
5
1
31
6
2
8
7
3
12
8
4
10
9
TOTAL
61
10
11
12
chi-squared Stat
13
df
14
p-value
15
chi-squared Critical
D
E
F
2
13
16
10
5
44
3
16
7
17
7
47
TOTAL
60
31
39
22
152
14.7019
6
0.0227
12.5916
NCCU-202203Stat-Prof SF Yang
© 2012 Cengage Learning. All Rights Reserved. May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole or in part.
Example 15.2…
INTERPRET
The p-value is .0227. There is enough evidence to infer that
the MBA major and the undergraduate degree are related.
We can also interpret the results of this test in two other ways.
1.There is enough evidence to infer that there are differences
in MBA major between the four undergraduate categories.
2. There is enough evidence to infer that there are differences
in undergraduate degree between the majors.
NCCU-202203Stat-Prof SF Yang
© 2012 Cengage Learning. All Rights Reserved. May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole or in part.
Required Condition – Rule of Five…
In a contingency table where one or more cells have
expected values of less than 5, we need to combine rows or
columns to satisfy the rule of five.
Note: by doing this, the degrees of freedom must be changed
as well.
NCCU-202203Stat-Prof SF Yang
© 2012 Cengage Learning. All Rights Reserved. May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole or in part.
Test of Independence
• 1. 學歷和年薪:
•
(高中,大學,研究所) vs (50萬以下,50- <100萬, > 100萬)
• 2.景氣和失業率
•
(景氣藍,黃, 紅) vs (>5%, 3%- <5%, <3%)
• 3.學科別和性別
•
(理,工, 文, 法,商,醫) vs (男, 女)
•
i\j
理, 工, 文, 法,
•
男
•
•
女
•
• col j total
•
商, 醫
f11 f12 f13 f14 f15 f16
(e11 e12 e13 e14 e15 e16)
f21 f22 f23 f24 f25 f26
(e21 e22 e23 e24 e25 e26)
C1 C2 C3 C4 C5 C6
NCCU-202203Stat-Prof SF Yang
Total=Sum(Ci)=Sum(Ri)
row i total
row 1 Tot
row 2 Tot
© 2012 Cengage Learning. All Rights Reserved. May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole or in part.
Test of Independence
•
•
•
•
4. sigrate and cancer??
5. 無薪假人數和景氣情況
6. 支出和收入
7. 出生率和家戶薪水
NCCU-202203Stat-Prof SF Yang
© 2012 Cengage Learning. All Rights Reserved. May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole or in part.
Test of Independence: Contingency Tables
1. Set up the null and alternative hypotheses.
2. Select a random sample and record the observed
frequency, fij , for each cell of the contingency table.
3. Compute the expected frequency, eij , for each cell.
Under Ho, two events are indep.
pij=pi*pj eij=pij*Tot
pi= R i tot/Tot, pj= C j tot/ Tot
eij 
(Row i Total)(Column j Total)
Sample Size
NCCU-202203Stat-Prof SF Yang
© 2012 Cengage Learning. All Rights Reserved. May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole or in part.
Contingency Table (Independence) Test

Example: Finger Lakes Homes (B)
The number of homes sold for
each model and price for the past two
years is shown below. For convenience,
the price of the home is listed as either
$99,000 or less or more than $99,000.
Price Colonial
< $99,000
18
> $99,000
12
Log
6
14
Split-Level
19
16
A-Frame
12
3
NCCU-202203Stat-Prof SF Yang
© 2012 Cengage Learning. All Rights Reserved. May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole or in part.
Table 12.7
•
•
•
•
•
•
•
•
Gender
M
F
total
light
51(59.4)
39 (30.6)
90
Regular
56(50.82)
21(26.18)
77
Dark
25 (21.78)
8
33
total
132
68
200
Ho: beer preference and Gender are indep.
H1: beer preference and Gender are dep.
eij 
(Row i Total)(Column j Total)
Sample Size
NCCU-202203Stat-Prof SF Yang
© 2012 Cengage Learning. All Rights Reserved. May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole or in part.
Table 12.7
 2  ( fij  eij ) 2 / eij  6.45
 20.05 (2)  5.991
 2  6.45   20.05 (2)  5.991
NCCU-202203Stat-Prof SF Yang
© 2012 Cengage Learning. All Rights Reserved. May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole or in part.
Identifying Factors…
Factors that identify the Chi-squared test of a contingency
table:
NCCU-202203Stat-Prof SF Yang
© 2012 Cengage Learning. All Rights Reserved. May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole or in part.
Table 15.1 Statistical Techniques for Nominal Data
Problem Objective
Categories
Statistical Technique
Describe a population
2
z-test of p or the chi-squared
goodness-of-fit test
Describe a population
Compare two populations
More than 2
2
Chi-squared goodness-of-fit test
z-test p1–p2 or chi-squared test
of a contingency table
Compare two populations More than 2
Chi-squared test of a contingency table
Compare more than
two populations
2 or more
Chi-squared test of a contingency table
Analyze the relationship
between two variables
2 or more
Chi-squared test of a contingency table
NCCU-202203Stat-Prof SF Yang
© 2012 Cengage Learning. All Rights Reserved. May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole or in part.
Download