You are on page 1of 25

Chapter 13 (13.

1): Chi-Square Tests

Tanvir Quadir

School of Mathematics and Statistics

Tanvir Quadir STAT 2601: Business Statistics I 1 / 25


13.1 Chi-Square Goodness-of-Fit Tests
Given the following:
Count Data (Nominal or Ordinal Level): Counts of items in each of
several categories.
A model that predicts the distribution of relative frequencies,
this question naturally arises: “Does the actual distribution differ from
the model (or sample) because of random error, or do the differences
mean that the model does not fit the data?” In other words, “How
good is the fit?”
Example: Stock Market “Up” Days. Is the distribution of “up” days
(of model or sample) different from the population distribution?

Tanvir Quadir STAT 2601: Business Statistics I 2 / 25


13.1 Chi-Square Goodness-of-Fit Tests
Individuals are classified (counted) in each category, e.g., grades;
exercise frequency; etc.
Observed Frequencies (fi ) are tabulated for each measurement
category (classification). Each individual is counted in one and only
one category (classification).
Construct Expected Frequencies (ei ) that are in perfect agreement
with the null hypothesis. Expected Frequency is the frequency value
that is predicted from H0 and the sample size; it represents an
idealized sample distribution.
Goodness-of-Fit test compares the Observed Frequencies from the
sample data with the Expected Frequencies predicted by null
hypothesis.
Chi-Square distribution includes values for all possible random
samples when H0 is true.
Tanvir Quadir STAT 2601: Business Statistics I 3 / 25
10.6 The Chi-Square Distribution
Chi-Square Distribution
Chi-square distribution is positively skewed.
Chi-square is a family of distributions
(i) Distributions determined by degrees of freedom (df )
(ii) Slightly different shape for each value of it

Tanvir Quadir STAT 2601: Business Statistics I 4 / 25


13.1 Chi-Square Goodness-of-Fit Tests

Step 1: Hypotheses
(i) Case I: No preference (equal proportions) among categories.
(a) H0 : p1 = p2 = · · · = pk = a,
where a is the probability value that we want to test and k is the
number of categories.

(b) HA : At least one pi is not equal to its specified value.

(ii) Case II: Specified proportions or preference from another known


population
(a) H0 : p1 = a1 , p2 = a2 , · · · = pk = ak ,
where a1 , a2 , · · · , ak are the probability values or relative preference of
each category that we want to test.

(b) HA : At least one pi is not equal to its specified value.

Tanvir Quadir STAT 2601: Business Statistics I 5 / 25


13.1 Chi-Square Goodness-of-Fit Tests
Step 2: Decision Zone and Type of Test:
(i) χ2 is the lower-case Greek letter Chi.
(ii) Right-tailed Test (0 < χ2 < ∞)
(iii) Reject H0 if χ2 > χ2cv where χ2cv is the critical value from chi-square
distribution with (k − 1) degrees of freedom.

Tanvir Quadir STAT 2601: Business Statistics I 6 / 25


13.1 Chi-Square Goodness-of-Fit Tests

Step 3 and 4: Observed and Expected Frequencies


k
X
(i) Observed Frequencies: Obs(fi ) (Property: fi = n)
i=1

(ii) Expected Frequencies: Exp(ei ) = npi (Property:


Xk Xk
fi = ei = n)
i=1 i=1

where pi are the probabilities of categories specified in H0 .

Step 5: Test Statistic

k
X (fi − ei )2
χ2 =
ei
i=1

Tanvir Quadir STAT 2601: Business Statistics I 7 / 25


13.1 Chi-Square Goodness-of-Fit Tests

Step 6: Make a Decision (Critical Value Approach)

If test statistic (χ2 ) is located in the critical region, the null hypothesis
is rejected.
If the test statistic (χ2 ) is not located in the critical region, the
researcher fails to reject the null hypothesis.
Rejection Region: Reject H0 if

χ2 > χ2cv (Right-tailed Test).

Tanvir Quadir STAT 2601: Business Statistics I 8 / 25


13.1 Chi-Square Goodness-of-Fit Tests

Step 6: Make a Decision (p-value Approach)


p-value: The p-value is the probability of seeing the observed data (or
more extreme) given the null hypothesis is true.
Calculation of p-value:
P(χ2 > χ20 ) (Right-tailed Test).

Decision Rule:
(i) If p-value < α, reject H0 .

(ii) If p-value ≥ α, do not reject H0 .

Tanvir Quadir STAT 2601: Business Statistics I 9 / 25


13.1 Chi-Square Goodness-of-Fit Tests

Assumptions and Conditions:


Counted Data Condition: The data must be counts for the categories
of a categorical variable.
Independence Assumption: The counts should be independent of each
other. Think about whether this is reasonable.
Randomization Condition: The counted individuals should be a random
sample of the population. Guard against auto-correlated samples.
Sample Size Assumption: We must have enough data for the methods
to work.
Expected Cell Frequency Condition: Expected cell frequency (ei ) in
each cell or category should be at least 5. If the expected frequencies
(ei ) are less than 5, adjacent cells need to be meaningfully collapsed
until benchmark (ei ≥ 5) is achieved and df should be adjusted
accordingly.

Tanvir Quadir STAT 2601: Business Statistics I 10 / 25


13.1 Chi-Square Goodness-of-Fit Tests
Example 1: Case I (No Preference or Equal Proportion)
Problem: Are technical support calls equal across all days of the week?
(i.e., do calls follow a uniform or equally likely distribution?) The
following is the sample data of technical support call for 10 days per
day of week.

Day Observed (fi )


Monday 290
Tuesday 250
Wednesday 238
Thursday 257
Friday 265
Saturday 230
Sunday X 192
fi = 1722

Tanvir Quadir STAT 2601: Business Statistics I 11 / 25


13.1 Chi-Square Goodness-of-Fit Tests
Example 1: Case I (No Preference or Equal Proportion)
(i) Step 1: Hypotheses
1
H0 : p1 = p2 = · · · = pk =
7
1
(b) HA : At least one pi is not equal to .
7
Step 2: Decision Zone and Critical Value

(χ2α,k−1 = χ2.05,6 = 12.5916)

Tanvir Quadir STAT 2601: Business Statistics I 12 / 25


13.1 Chi-Square Goodness-of-Fit Tests

Steps 3 and 4: Observed and Expected Frequencies


Day Observed (fi ) Expected (ei = npi )
1
Monday 290 246 (= 1722 × )
7
Tuesday 250 246
Wednesday 238 246
Thursday 257 246
Friday 265 246
Saturday 230 246
Sunday 192 246
X X
fi = 1722 ei = 1722

Tanvir Quadir STAT 2601: Business Statistics I 13 / 25


13.1 Chi-Square Goodness-of-Fit Tests

Assumptions and Conditions:


Counted Data Condition: We have counts of technical support calls for
days of the week.
Independence Assumption: We have taken random sample, so the
randomization should make them far enough apart to alleviate concerns
about dependence.
Randomization Condition: We have a random sample of 1722 days.
Sample Size Assumption: Sample size 1722 is large enough.
Expected Cell Frequency Condition: Expected cell frequency (ei ) in
each cell or category is much larger than 5.

Tanvir Quadir STAT 2601: Business Statistics I 14 / 25


13.1 Chi-Square Goodness-of-Fit Tests

Steps 5 and 6: Test Statistic and Make a Decision (CV Approach)

Tanvir Quadir STAT 2601: Business Statistics I 15 / 25


13.1 Chi-Square Goodness-of-Fit Tests
Step 6: Make a Decision (p-value Approach))
Approximate p-value: p-value < 0.005. Of note, the largest χ2 value
at 6 degrees of freedom available at the chi-square table is 18.548.

Decision: Since p-value < 0.005 < α = .05, we may reject the null
hypothesis based on sample evidence and conclude that the
distribution of technical support call is NOT uniform across the days
of the week.
Tanvir Quadir STAT 2601: Business Statistics I 16 / 25
13.1 Chi-Square Goodness-of-Fit Tests

Example 2: Case II (Specified Preference or Proportion)


Problem: 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%.

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?
Tanvir Quadir STAT 2601: Business Statistics I 17 / 25
13.1 Chi-Square Goodness-of-Fit Tests
Example 2: Case II (Specified Preference or Proportion)
(i) Step 1: Hypotheses
H0 : p1 = 0.45, p2 = 0.40, p3 = 0.15
(b) HA : At least one pi is not equal to its specified value.
Here, p1 , p2 , p3 represent population proportions (or market
preferences) of company A, B, and Other respectively.
Step 2: Decision Zone and Critical Value

(χ2α,k−1 = χ2.05,2 = 5.99147)

Tanvir Quadir STAT 2601: Business Statistics I 18 / 25


13.1 Chi-Square Goodness-of-Fit Tests

Steps 3 - 5: Observed, Expected Frequencies, and Test Statistic

Tanvir Quadir STAT 2601: Business Statistics I 19 / 25


13.1 Chi-Square Goodness-of-Fit Tests

Assumptions and Conditions:


Counted Data Condition: We have counts of customer fabric softener
preferences for company A, B, and Other.
Independence Assumption: We have taken random sample, so the
randomization should make them far enough apart to alleviate concerns
about dependence.
Randomization Condition: We have a random sample of 200 customers.
Sample Size Assumption: Sample size 200 is large enough.
Expected Cell Frequency Condition: Expected cell frequency (ei ) in
each cell or category is much larger than 5.

Tanvir Quadir STAT 2601: Business Statistics I 20 / 25


13.1 Chi-Square Goodness-of-Fit Tests

Step 6: Make a Decision (CV Approach)


(i) Decision:

Reject H0 since χ2 = 8.18 > χ2cv = 5.99147.


(ii) Decision (Business Context)

There is sufficient evidence to infer that the proportions have changed


since the advertising campaigns were implemented.

Tanvir Quadir STAT 2601: Business Statistics I 21 / 25


13.1 Chi-Square Goodness-of-Fit Tests
Step 6: Make a Decision (p-value Approach))
Approximate p-value:.01 < p-value < 0.025. Of note, the test
statistic 8.18 at df = 2 is not directly available in the Chi-square
table but it lies between 7.378 and 9.210.

Decision: Since .01 < p-value < 0.025 < α = .05, we may reject the
null hypothesis based on sample evidence and conclude that the
market preferences have changed since the advertising campaigns
were implemented.
Tanvir Quadir STAT 2601: Business Statistics I 22 / 25
Examining the Residuals

When we reject a null hypothesis, we can examine the residuals in


each cell to discover which values are extraordinary (i.e., sample and
model data are relatively discrepant) or contribute most to the value
of aggregate chi-square.

Because we might compare residuals for cells with very different


counts, we should examine standardized residuals:
(fi − ei )

ei

Note that standardized residuals from goodness-of-fit tests are


actually z-scores (which we already know how to interpret and
analyze).

Tanvir Quadir STAT 2601: Business Statistics I 23 / 25


Examining the Residuals

Standardized residuals for the technical support data are as follows:


(fi − ei )
Day Standardized Residual ( √ )
ei
290 − 246
Monday 2.81 ( = √ )
246
Tuesday 0.26
Wednesday -0.51
Thursday 0.70
Friday 1.21
Saturday -1.02
Sunday -3.44

Monday and Sunday values are remarkable. The largest value,


Sunday, at −3.44, is impressive when viewed as a z-score.

Tanvir Quadir STAT 2601: Business Statistics I 24 / 25


THANK YOU!

Tanvir Quadir STAT 2601: Business Statistics I 25 / 25

You might also like