1/71
Statistics
Tests of
Goodness of Fit and Independence
2/71
Contents
STATISTICS in PRACTICE
Goodness of Fit Test:  A MultinomialPopulation
Test of Independence
Goodness of Fit Test:
 Poisson and Normal Distributions
3/71
STATISTICS in PRACTICE
United Way of Greater
    Rochester is a nonprofit
    organization dedicated
    to improving the quality
    of life for people. Because of enormousvolunteer involvement, United Way of GreaterRochester is able to hold its operating costs atjust eight cents of every dollar raised.
4/71
STATISTICS in PRACTICE
One of statistical tests was to determine whetherperceptions of administrative expenses wereindependent of occupation.
In this chapter, you will learn how a statisticaltest of independence.
5/71
Hypothesis (Goodness of Fit)Test for Proportions of aMultinomial Population
Consider the case that each element of apopulation is assigned to one and only oneof several classes or categories.
Such a population is a multinomialpopulation(多項母體).
We want to test if the population follows amultinominal distribution with specifiedprobabilities for each of the k categories.
6/71
Hypothesis Test for Proportionsof a Multinomial Population--Procedures
1.Set up the null and alternative hypotheses.
 2.Select a random sample and record theobserved frequency,  fi , for each of the kcategories.
 3.Assuming H0 is true, compute the expectedfrequency, ei , in each category bymultiplying the category probability by thesample size.
7/71
4.   Compute the value of the test statistic.
fi = observed frequency for category i
ei = expected frequency for category i
k = number of categories
where:
Hypothesis Test for Proportionsof a Multinomial Population--Procedures
Note:  The test statistic has chi-square distribution with (k – 1) dfprovided that the expected frequencies are or more for allcategories.Note:  The test statistic has chi-square distribution with (k – 1) dfprovided that the expected frequencies are or more for allcategories.
8/71
where   is the significance level and
there are k - 1 degrees of freedom
p-value approach:
Critical value approach:
Reject H0 if p-value < Reject H0 if p-value < 
5.   Rejection rule:
Reject H0 ifReject H0 if
Hypothesis Test for Proportionsof a Multinomial Population--Procedures
9/71
Hypothesis (Goodness of Fit) Testfor Proportions of a MultinomialPopulation
Example:
The market share study being conducted by ScottMarketing Research. Over the past year market sharesstabilized at 30% for company A, 50% for company B,and 20% for company C.
Recently company C developed a “new and improved”product to replace its current entry in the market.
Company C retained Scott Marketing Research todetermine whether the new product will alter marketshares.
10/71
Hypothesis (Goodness of Fit) Testfor Proportions of a MultinomialPopulation
Scott Marketing Research  conduct a sample surveyand compute the proportion preferring eachcompany’s product.
A hypothesis test will then be conducted to seewhether the new product caused a change in marketshares.
The null and alternative hypotheses are
11/71
Hypothesis (Goodness of Fit) Testfor Proportions of a MultinomialPopulation
Perform a goodness of fit test that willdetermine whether the sample of 200 customerpurchase preferences is consistent with the nullhypothesis.
Data
12/71
Hypothesis (Goodness of Fit) Testfor Proportions of a MultinomialPopulation
Expected: the expected frequency for eachcategory is found by multiplying the samplesize of 200 by the hypothesized proportion forthe category.
 
13/71
Hypothesis (Goodness of Fit) Testfor Proportions of a MultinomialPopulation
Computation of the Chi-square Test Statisticfor The Scott Marketing Research MarketShare Study
14/71
Hypothesis (Goodness of Fit) Testfor Proportions of a MultinomialPopulation
p-Value Approach
The test statistic χ2 = 7.34 and 5.991 < 7.34 <7.378. Thus, the corresponding upper tail areaor p-value must be between .05 and .025. withp-value  < .05, we reject H0.
Minitab or Excel can be used to show χ 2 = 7.34provides a  p-value = .0255.
15/71
Hypothesis (Goodness of Fit) Testfor Proportions of a MultinomialPopulation
Critical Value Approach
With α = .05 and 2 degrees of freedom, thecritical value for the test statistic is         =5.991. The upper tail rejection rule becomes
Reject H0 if χ 2 >  5.991
With 7.34 > 5.991, we reject H0.
Comparisons of the observed and expectedfrequencies for the other two companiesindicate that company C’s gain in market sharewill hurt company A more than company B.
16/71
Hypothesis (Goodness of Fit) Testfor Proportions of a MultinomialPopulation
Note:
The chi-square test is an approximate testand the test result may not be valid whenthe expected value for a category is lessthan 5.
If one or more categories have expectedvalues less than 5, you can combine themwith adjacent categories to achieve theminimum required expected value. 
17/71
Multinomial DistributionGoodness of Fit Test
  Example:  Finger Lakes Homes (A)
Finger Lakes Homes manufactures four models ofprefabricated homes, a two-story colonial, a logcabin, a split-level, and an A-frame.  To help
in production planning, management would like todetermine if previous customer purchases indicatethat there is a preference in the style selected.
18/71
                                          Split-       A-                                          Split-       A-
Model   Colonial   Log   Level   FrameModel   Colonial   Log   Level   Frame
Sold         30          20       35         15Sold         30          20       35         15
     The number of homes sold of each
model for 100 sales over the past two
years is shown below.
Multinomial DistributionGoodness of Fit Test
  Example:  Finger Lakes Homes (A)
19/71
Hypotheses
Multinomial DistributionGoodness of Fit Test
where:
   pC = population proportion that purchase a colonial
   pL  = population proportion that purchase a log cabin
   pS  = population proportion that purchase a split-level
   pA = population proportion that purchase an A-frame
H0:  pC pL pS pA .25H0:  pC pL pS pA .25
Ha:  The population proportions are notHa:  The population proportions are not
        pC .25, pL .25, pS .25, and pA .25        pC .25, pL .25, pS .25, and pA .25
20/71
Rejection Rule
χ2
χ2
  7.815
  7.815
Do Not Reject H0
Do Not Reject H0
Reject H0
Reject H0
With  .05 andWith  .05 and
     k 3     k 3
       degrees of freedom       degrees of freedom
  if p-value < .05 or  7.815. Reject H0 if p-value < .05 or χ2 7.815.
Multinomial DistributionGoodness of Fit Test
21/71
Expected Frequencies
Test Statistic
Multinomial DistributionGoodness of Fit Test
e .25(100) 25      e2 .25(100) 25e .25(100) 25      e2 .25(100) 25
  e3 .25(100) 25      e4 .25(100) 25  e3 .25(100) 25      e4 .25(100) 25
44
=   10=   10
22/71
Multinomial DistributionGoodness of Fit Test
Conclusion Using the p-Value Approach
  The p-value <  .  We can reject the null hypothesis.
Because χ2 = 10 is between 9.348 and 11.345, thearea in the upper tail of the distribution is
between  .025 and .01.
Area in Upper Tail      .10      .05      .025       .01       .005Area in Upper Tail      .10      .05      .025       .01       .005
2 Value (df 3)       6.251   7.815   9.348   11.345  12.8382 Value (df 3)       6.251   7.815   9.348   11.345  12.838
23/71
Conclusion Using the Critical ValueApproach
Multinomial DistributionGoodness of Fit Test
We reject, at the .05 level of significance, theassumption that there is no home style preference.We reject, at the .05 level of significance, theassumption that there is no home style preference.
χ2 = 10 > 7.815
24/71
Test of Independence:Contingency Tables(列聯表)
Another important application of the chi-square distribution involves using sampledata to test for the independence of twovariables.
Contingency table is a table that lists allpossible combinations of the two variables.
25/71
Test of Independence:  ContingencyTables
Example:
 A test of independence addresses the question ofwhether the beer preference (light, regular, or dark)is independent of the gender of the beer drinker(male, female).
If the independence assumption is valid, we arguethat the fraction of drinking light beer, regular beerand dark beer must be applicable to both male andfemale beer drinker.
26/71
Test of Independence:Contingency Tables
1.Set up the null and alternative hypotheses.
2.Select a random sample and record theobserved  frequency, fij , for each cell of thecontingency table.
3.  Compute the expected frequency, eij , foreach cell.
27/71
5.   Determine the rejection rule.
Reject H0 if -value <   or           .Reject H0 if -value <   or           .
4.   Compute the test statistic.
where   is the significance level and,
with n rows and m columns, there are
(n - 1)(m - 1) degrees of freedom.
Test of Independence:Contingency Tables
28/71
Test of Independence:  ContingencyTables
Example:
 A test of independence addresses the question ofwhether the beer preference (light, regular, or dark)is independent of the gender of the beer drinker(male, female).
The hypotheses for this test of independence are:
    H0: Beer preference is independent of the gender
          of  the beer drinker
     Ha: Beer preference is not independent of the
          gender of  the beer drinker
29/71
Sample Results
Expected Frequencies
Test of Independence:Contingency Tables
1/3
7/15
1/5
1
80*1/3=26.67
30/71
Test of Independence:Contingency Tables
31/71
Computation of the Chi-square TestStatistic
p-value = .0468. At the .05 level ofsignificance, p-value < α= .05. Wereject the null hypothesis
Test of Independence:Contingency Tables
32/71
     Each home sold by Finger Lakes Homes can beclassified according to price and to style.  FingerLakes’manager would like to determine if theprice of the home and the style of the home areindependent variables.
  Example:  Finger Lakes Homes (B)
Test of Independence:Contingency Tables
33/71
     The number of homes sold for each modeland price for the past two years is shown below.For convenience, the price of the home is listedas either $99,000 or less or more than $99,000.
     Price     Colonial      Log     Split-Level    A-Frame     Price     Colonial      Log     Split-Level    A-Frame
$99,000        12             14           16                    3$99,000        12             14           16                    3
< $99,000        18        6              19                  12< $99,000        18        6              19                  12
  Example:  Finger Lakes Homes (B)
Test of Independence:Contingency Tables
34/71
Hypotheses
H0:  Price of the home is independent of theH0:  Price of the home is independent of the
        style of the home that is purchased        style of the home that is purchased
Ha:  Price of the home is not independent of theHa:  Price of the home is not independent of the
        style of the home that is purchased        style of the home that is purchased
Test of Independence:Contingency Tables
35/71
Expected Frequencies
   Price      Colonial     Log      Split-Level     A-Frame     Total   Price      Colonial     Log      Split-Level     A-Frame     Total
< $99K< $99K
$99K$99K
   Total   Total
30            20              35                15           10030            20              35                15           100
12           14              16                  3            4512           14              16                  3            45
18              6              19                12            5518              6              19                12            55
Test of Independence:Contingency Tables
36/71
Contingency Table(Independence) Test
Rejection Rule
Reject H0 if p-value < .05 or 2 > 7.815Reject H0 if p-value < .05 or 2 > 7.815
Test Statistic
With α = .05 and (2 - 1)(4 - 1) = 3 d.f.,         =7.815
= .1364 + 2.2727 + . . . + 2.0833 =    9.149
37/71
Conclusion Using the p-ValueApproach
  The p-value <  .  We can reject the null
  hypothesis.
   Because χ2 9.145 is between 7.815 and 9.348,
  the area in the upper tail of the distribution is
  between  .05 and .025.
Area in Upper Tail      .10      .05      .025       .01       .005Area in Upper Tail      .10      .05      .025       .01       .005
2 Value (df 3)       6.251   7.815   9.348   11.345  12.8382 Value (df 3)       6.251   7.815   9.348   11.345  12.838
Contingency Table(Independence) Test
38/71
Conclusion Using the Critical ValueApproach
     We reject, at the .05 level of significance,     We reject, at the .05 level of significance,
the assumption that the price of the home isthe assumption that the price of the home is
independent of the style of home that isindependent of the style of home that is
purchased.purchased.
 χ2 = 9.145 > 7.815
Contingency Table(Independence) Test
39/71
Goodness of Fit Test:  PoissonDistribution
 In general, the goodness of fit test can be usedwith any hypothesized probability distribution.
Here we will demonstrate the cases of Poissondistribution and Normal distribution.
40/71
Goodness of Fit Test:  PoissonDistribution
1.   Set up the null and alternative hypotheses.
    H0: Population has a Poisson probabilitydistribution
    Ha: Population does not have a Poissondistribution
2.   Select a random sample and
      a.  Record the observed frequency fi for eachvalue of the Poisson random variable.
      b.  Compute the mean number of occurrences .
41/71
Goodness of Fit Test:  PoissonDistribution
3.   Compute the expected frequency of occurrences  ei
      for each value of the Poisson random variable.
4.  Compute the value of the test statistic.
fi = observed frequency for category i
ei = expected frequency for category i
k = number of categories
where:
42/71
where   is the significance level and
   there are k - 2 degrees of freedom
p-value approach:
Critical value approach:
Reject H0 if p-value < Reject H0 if p-value < 
5.  Rejection rule:
Reject H0 ifReject H0 if
Goodness of Fit Test:  PoissonDistribution
43/71
Goodness of Fit Test:  PoissonDistribution—Example
Consider the arrival of customers atDubek’s Food Market in Tallahassee,Florida.
A statistical test conducted to seewhether an assumption of a Poissondistribution for arrivals is reasonable.
44/71
Goodness of Fit Test:  PoissonDistribution—Example
Hypotheses are
      H0:  The number of customers enteringthe store during 5-minute intervalshas a Poisson probability distribution
     Ha:  The number of customers entering thestore during 5-minute intervals doesnot have a Poisson distribution
45/71
Goodness of Fit Test:  PoissonDistribution—Example
The Poisson probability function,
 
where
--μ represents the expected number of customersarriving per 5-minute period,
--x is the random variable indicating the number ofcustomers arriving during a 5-minute period, and
--f (x) is the probability that x customers will arrive ina 5-minute interval.
46/71
Goodness of Fit Test:  PoissonDistribution—Example
Sample Data
μ known, an estimateof μ is 640/128 = 5customers
47/71
Goodness of Fit Test:  PoissonDistribution—Example
Expected frequency
48/71
Goodness of Fit Test:  PoissonDistribution—Example
Computation of the Chi-square TestStatistic
p-value = .1403. With p-value > α= .05, we cannot reject H0.
49/71
Example:  Troy Parking Garage
     In studying the need for an additionalentrance to a city parking garage, aconsultant has recommended an analysisapproach that is applicable only in situationswhere the number of cars entering during aspecified time period follows a Poissondistribution.
Goodness of Fit Test:Poisson Distribution
50/71
 A random sample of 100 one-minute timeintervals resulted in the customer arrivalslisted below.  A statistical test must beconducted to see if the assumption of aPoisson distribution is reasonable.
Goodness of Fit Test:Poisson Distribution
Arrivals   0    1    2    3    4    5    6    7    8    9   10   11   12Arrivals   0    1    2    3    4    5    6    7    8    9   10   11   12
Frequency  0    1    4   10  14  20  12  12   9    8     6    3     1Frequency  0    1    4   10  14  20  12  12   9    8     6    3     1
51/71
Hypotheses
Goodness of Fit Test:Poisson Distribution
Ha:  Number of cars entering the garage during a
       one-minute interval is not Poisson distributed
H0:  Number of cars entering the garage during
        a one-minute interval is Poisson distributed
52/71
Estimate of Poisson ProbabilityFunction
Goodness of Fit Test:Poisson Distribution
otal Arrivals = 0(0) + 1(1) + 2(4) + . . . + 12(1) = 600
Hence,
Estimate of  = 600/100 = 6
Total Time Periods = 100
53/71
Expected Frequencies
Goodness of Fit Test:Poisson Distribution
x       ()      nf ()x       ()      nf ()
00
11
22
33
44
55
66
  13.77  13.77
  10.33  10.33
    6.88    6.88
    4.13    4.13
    2.25    2.25
    2.01    2.01
100.00100.00
  .1377  .1377
  .1033  .1033
  .0688  .0688
  .0413  .0413
  .0225  .0225
  .0201  .0201
1.00001.0000
    7    7
    8    8
    9    9
  10  10
  11  11
  12+  12+
TotalTotal
.0025.0025
.0149.0149
.0446.0446
.0892.0892
.1339.1339
.1606.1606
.1606.1606
    .25    .25
  1.49  1.49
  4.46  4.46
  8.92  8.92
13.3913.39
16.0616.06
16.0616.06
x            ()    nf ()x            ()    nf ()
54/71
Observed and Expected Frequencies
Goodness of Fit Test:Poisson Distribution
       i                  fi                     ei             fi ei       i                  fi                     ei             fi ei
-1.20-1.20
 1.08 1.08
 0.61 0.61
 3.94 3.94
-4.06-4.06
-1.77-1.77
-1.33-1.33
 1.12 1.12
 1.61 1.61
  6.20  6.20
  8.92  8.92
13.3913.39
16.0616.06
16.0616.06
13.7713.77
10.3310.33
  6.88  6.88
  8.39  8.39
  5  5
1010
1414
2020
1212
1212
  9  9
  8  8
1010
or or 2or or 2
        3        3
        4        4
        5        5
        6        6
        7        7
        8        8
        9        9
10 or more10 or more
55/71
Test Statistic
Goodness of Fit Test:Poisson Distribution
Reject H0 if p-value < .05 or 2 > 14.067.Reject H0 if p-value < .05 or 2 > 14.067.
Rejection Rule
     With  = .05 and k - p - 1 = 9 - 1 - 1 = 7 d.f.
(where k = number of categories and p = number
of population parameters estimated),
56/71
Conclusion Using the p-Value Approach
The p-value  .  We cannot reject the null hypothesis.There is no reason to doubt the assumption of a Poissondistribution.
 Because χ2 = 3.268 is between 2.833 and 12.017 in theChi-Square Distribution Table, the area in the upper tailof the distribution is between .90 and .10.
Area in Upper Tail      .90       .10        .05       .025       .01Area in Upper Tail      .90       .10        .05       .025       .01
2 Value (df 7)        2.833  12.017  14.067  16.013  18.4752 Value (df 7)        2.833  12.017  14.067  16.013  18.475
Goodness of Fit Test:Poisson Distribution
57/71
Goodness of Fit Test:  NormalDistribution
1.   Set up the null and alternative hypotheses.
3.   Compute the expected frequency, ei , for each interval.
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
58/71
4.   Compute the value of the test statistic.
Goodness of Fit Test:  NormalDistribution
5.   Reject H0 if         (where  is the significance
      level and there are k - 3 degrees of freedom).
59/71
Goodness of Fit Test:  NormalDistribution--Example
Chemline EmployeeAptitude Scores
To test the nullhypothesis that thepopulation of testscores has a normaldistribution.
Sample Data
60/71
Goodness of Fit Test:  NormalDistribution—Example
Estimates of μ and     are     = 68.42,  s = 10.41.
Hypotheses
     H0:  The population of test scores has anormal distribution with mean68.42 and standard deviation 10.41.
    Ha: The population of test scores does nothave a normal distribution with mean68.42 and standard deviation 10.41
61/71
Goodness of Fit Test:  NormalDistribution—Example
Expected Frequency
Normal Distribution with 10 Equal-Probability Intervals (The ChemilineExample)
Note:  55.10 = 68.42 - 1.28(10.41)
62/71
Goodness of Fit Test:  NormalDistribution—Example
63/71
Goodness of Fit Test:  NormalDistribution—Example
Computation of the Chi-square TestStatistic
p-value = .4084 >α = .10. Cannot rejectH0.
64/71
Normal DistributionGoodness of Fit Test
Example:  IQ Computers
BS01070_
IQIQ
IQIQ
          IQ Computers (one better than
HP?) 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 theannual sales volume (number of units sold by asalesperson) follows a normal probabilitydistribution.
65/71
A simple random sample of 30 of thesalespeople was taken and theirnumbers of units sold are below.
Normal DistributionGoodness of Fit Test
Example:  IQ Computers
(mean = 71, standard deviation = 18.54)
33    43    44    45    52    52    56    58    63    6433    43    44    45    52    52    56    58    63    64
64    65    66    68    70    72    73    73    74    7564    65    66    68    70    72    73    73    74    75
83    84    85    86    91    92    94    98   102  10583    84    85    86    91    92    94    98   102  105
BS01070_
IQIQ
IQIQ
66/71
Hypotheses
BS01070_
Normal DistributionGoodness of Fit Test
Ha:  The population of number of units sold
        does not have a normal distribution with
        mean 71 and standard deviation 18.54.
H0:  The population of number of units sold
        has a normal distribution with mean 71
        and standard deviation 18.54.
67/71
Interval Definition
BS01070_
Normal DistributionGoodness of Fit Test
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.
68/71
Interval Definition
  Areas
 = 1.00/6
 = .1667
  Areas
 = 1.00/6
 = .1667
71
71
53.02
53.02
71  .43(18.54) = 63.03
71  .43(18.54) = 63.03
78.97
78.97
88.98 = 71 + .97(18.54)
88.98 = 71 + .97(18.54)
BS01070_
Normal DistributionGoodness of Fit Test
69/71
Observed and Expected Frequencies
BS01070_
Normal DistributionGoodness of Fit Test
 1 1
-2-2
 1 1
 0 0
-1-1
 1 1
  5  5
  5  5
  5  5
  5  5
  5  5
  5  5
3030
  6  6
  3  3
  6  6
  5  5
  4  4
  6  6
3030
Less than 53.02Less than 53.02
  53.02 to 63.03  53.02 to 63.03
  63.03 to 71.00  63.03 to 71.00
  71.00 to 78.97  71.00 to 78.97
  78.97 to 88.98  78.97 to 88.98
More than 88.98More than 88.98
        i                     fi                     ei          fi ei        i                     fi                     ei          fi ei
TotalTotal
70/71
Test Statistic
Reject H0 if p-value < .05 or 2 > 7.815.Reject H0 if p-value < .05 or 2 > 7.815.
Rejection Rule
BS01070_
Normal DistributionGoodness of Fit Test
          With  = .05 and k - p - 1 = 6 - 2 - 1 = 3 d.f.
(where k = number of categories and p = number
of population parameters estimated),
71/71
BS01070_
Normal DistributionGoodness of Fit Test
Conclusion Using the p-Value Approach
 Because χ2 = 1.600 is between .584 and 6.251 in the Chi-Square Distribution Table, the area in the upper tail of thedistribution is between .90 and .10. The p-value  .  Wecannot reject the null hypothesis.
There is little evidence to support rejecting theassumption the population is normally distributed with    =71 and  = 18.54.
Area in Upper Tail       .90     .10        .05       .025       .01Area in Upper Tail       .90     .10        .05       .025       .01
2 Value (df 3)         .584   6.251   7.815     9.348   11.3452 Value (df 3)         .584   6.251   7.815     9.348   11.345