SlideShare ist ein Scribd-Unternehmen logo
1 von 32
Chi-square
Applications of Chi-Square
• Goodness of fit (適合度檢驗)
• Independence (獨立性檢驗)
• Homogenecity (同質性檢驗)
Chi-Square Test on Numerical Data
• The researcher may believe there’s a relationship between X and Y,
but doesn’t want to use regression.
• There are outliers or anomalies that prevent us from assuming that
the data came from a normal population.
• The researcher has numerical data for one variable but not the other.
Chi-Square Goodness of Fit Test
• The test is applied when you have one categorical variable from a
single population.
• It is used to determine whether sample data are consistent with a
hypothesized distribution.
• For example, suppose a company printed baseball cards. It claimed
that 30% of its cards were rookies; 60%, veterans; and 10%, All-Stars.
We could gather a random sample of baseball cards and use a chi-
square goodness of fit test to see whether our sample distribution
differed significantly from the distribution claimed by the company.
Chi-Square Test for Independence
• The test is applied when you have two categorical variables from a
single population.
• It is used to determine whether there is a significant association
between the two variables.
• For example, in an election survey, voters might be classified by
gender (male or female) and voting preference (Democrat,
Republican, or Independent). We could use a chi-square test for
independence to determine whether gender is related to voting
preference.
Chi-Square Test of Homogeneity
• The test is applied to a single categorical variable from two different
populations.
• To determine whether frequency counts are distributed identically
across different populations.
• In a survey of TV viewing preferences, we might ask respondents to
identify their favorite program. We might ask the same question of
two different populations, such as males and females. We could use a
chi-square test for homogeneity to determine whether male viewing
preferences differed significantly from female viewing preferences.
Chi-Square Test for Goodness-of-Fit
• The goodness-of-fit (GOF) test helps you decide
whether your sample resembles a particular kind
of population.
• The chi-square test will be used because it is
versatile and easy to understand.
Purpose of the Test
Chi-Square Test for Goodness-of-Fit
• A multinomial distribution is defined by any k
probabilities p1, p2, …, pk that sum to unity.
• For example, consider the following “official”
proportions of M&M colors.
Multinomial GOF Test
calc
Chi-Square Test for Goodness-of-Fit
• The hypotheses are
H0: p1 = .30, p2 = .20, p3 = .10, p4 = .10, p5 = .10, p6 = .20
H1: At least one of the pj differs from the
hypothesized value
• No parameters are estimated (m = 0) and there are c = 6
classes, so the degrees of freedom are
n = c – m – 1 = 6 – 0 - 1
Multinomial GOF Test
Chi-Square Test for Goodness-of-Fit
• The hypotheses are:
H0: The population follows a _____ distribution
H1: The population does not follow a ______
distribution
• The blank may contain the name of any theoretical
distribution (e.g., uniform, Poisson, normal).
Hypotheses for GOF
Chi-Square Test for Goodness-of-Fit
• Assuming n observations, the observations are
grouped into c classes and then the chi-square test
statistic is found using:
Test Statistic and Degrees of Freedom for GOF
where fj = the observed frequency of
observations in class j
ej = the expected frequency in class j if
H0 were true
calc
Chi-Square Test for Goodness-of-Fit
• If the proposed distribution gives a good fit to the
sample, the test statistic will be near zero.
• The test statistic follows the chi-square distribution
with degrees of freedom
n = c – m – 1
where c is the no. of classes used in the test m is
the no. of parameters estimated
Test Statistic and Degrees of Freedom for GOF
Chi-Square Test for Goodness-of-Fit
Test Statistic and Degrees of Freedom for GOF
110  ccmcv
211  ccmcv
312  ccmcv
• For example, for n = 6 and a = .05, c2
.05 = 12.59.
Chi-Square Test for Goodness-of-Fit
Chi-Square Test for Goodness-of-Fit
• Instead of “fishing” for a good-fitting model,
visualize a priori the characteristics of the
underlying data-generating process.
Data-Generating Situations
• Mixtures occur when more than one data-generating process is superimposed
on top of one another.
Mixtures: A Problem
Chi-Square Test for Goodness-of-Fit
• A simple “eyeball” inspection of the histogram or
dot plot may suffice to rule out a hypothesized
population.
Eyeball Tests
• Goodness-of-fit tests may lack power in small samples. As a guideline, a chi-
square goodness-of-fit test should be avoided if n < 25.
Small Expected Frequencies
Normal Chi-Square
Goodness-of-Fit Test
• Two parameters, m and s, fully describe the normal
distribution.
• Unless m and s are know a priori, they must be
estimated from a sample by using x and s.
• Using these statistics, the chi-square goodness-of-fit
test can be used.
Normal Data Generating Situations
Normal Chi-Square
Goodness-of-Fit Test
• Transform the sample observations x1, x2, …, xn into
standardized values.
• Count the sample observations fj within intervals of
the form and compare them with the
known frequencies ej based on the normal
distribution.
Method 1: Standardizing the Data
x + ks
Normal Chi-Square
Goodness-of-Fit Test
Method 1: Standardizing the Data
Advantage is a standardized
scale.
Disadvantage is that data are
no longer in the original units.
Figure 15.14
• The chi-square test is unreliable if the expected
frequencies are too small.
• Rules of thumb:
• Cochran’s Rule requires that ejk > 5 for all cells.
• Up to 20% of the cells may have ejk < 5
Small Expected Frequencies
• Most agree that a chi-square test is infeasible if ejk < 1
in any cell.
• If this happens, try combining adjacent rows to enlarge
the expected frequencies.
Chi-Square Test for Independence
• A contingency table is a cross-tabulation of n paired
observations into categories.
• Each cell shows the count of observations that fall into
the
category
defined by its
row (r) and
column (c)
heading.
Contingency Tables
A
B
Chi-Square Test for Independence
• For example:
Contingency Tables
Table 15.1
Chi-Square Test for Independence
• In a test of independence for an r x c contingency table,
the hypotheses are
H0: Variable A is independent of variable B
H1: Variable A is not independent of variable B
• Use the chi-square test for independence to test these
hypotheses.
• This non-parametric test is based on frequencies.
• The n data pairs are classified into c columns and r rows
and then the observed frequency fjk is compared with
the expected frequency ejk.
Chi-Square Test
Chi-Square Test for Independence
• In a test of independence for an r x c contingency table, the
hypotheses are
H0: Variable A is independent of variable B
H1: Variable A is not independent of variable B
H0: There is no relationship between the variables.
H1: There is a relationship between the variables.
• If two categorical variables are related, it means the chance that
an individual falls into a particular category for one variable
depends upon the particular category they fall into for the other
variable.
Chi-Square Test
Chi-Square Test for Independence
• The critical value comes from the chi-square
probability distribution with n degrees of freedom.
n = degrees of freedom = (r – 1)(c – 1)
where r = number of rows in the table
c = number of columns in the table
• Appendix E contains critical values for right-tail areas of
the chi-square distribution.
• The mean of a chi-square distribution is n with variance
2n.
Chi-Square Distribution
Chi-Square Test for Independence
• Assuming that H0 is true, the expected frequency of
row j and column k is:
ejk = RjCk/n
where Rj = total for row j (j = 1, 2, …, r)
Ck = total for column k (k = 1, 2, …, c)
n = sample size
Expected Frequencies
Chi-Square Test for Independence
• Step 1: State the Hypotheses
H0: Variable A is independent of variable B
H1: Variable A is not independent of variable B
• Step 2: Specify the Decision Rule
Calculate n = (r – 1)(c – 1)
For a given a, look up the right-tail critical value (c2
R)
from Appendix E or by using Excel.
Reject H0 if c2
R > test statistic.
Steps in Testing the Hypotheses
Chi-Square Test for Independence
• For example, for n = 6 and a = .05, c2
.05 = 12.59.
Steps in Testing the Hypotheses
Chi-Square Test for Independence
• Here is the rejection region.
Steps in Testing the Hypotheses
Figure 15.3
Chi-Square Test for Independence
• Step 3: Calculate the Expected Frequencies
ejk = RjCk/n
• For example,
Steps in Testing the Hypotheses
Chi-Square Test for Independence
• The chi-square test is unreliable if the expected
frequencies are too small.
• Rules of thumb:
• Cochran’s Rule requires that ejk > 5 for all cells.
• Up to 20% of the cells may have ejk < 5
Small Expected Frequencies
• Most agree that a chi-square test is infeasible if ejk < 1
in any cell.
• If this happens, try combining adjacent rows or
columns to enlarge the expected frequencies.
Chi-Square Test for Independence
• Chi-square tests for independence can also be used to
analyze quantitative variables by coding them into
categories.
Cross-Tabulating Raw Data
For example, the
variables Infant
Deaths per 1,000
and Doctors per
100,000 can
each be coded
into various
categories:

Weitere ähnliche Inhalte

Was ist angesagt? (20)

Scales of measurement
Scales of measurementScales of measurement
Scales of measurement
 
PEARSON'CORRELATION
PEARSON'CORRELATION PEARSON'CORRELATION
PEARSON'CORRELATION
 
Analysis of Variance (ANOVA)
Analysis of Variance (ANOVA)Analysis of Variance (ANOVA)
Analysis of Variance (ANOVA)
 
Bivariate data
Bivariate dataBivariate data
Bivariate data
 
NON-PARAMETRIC TESTS by Prajakta Sawant
NON-PARAMETRIC TESTS by Prajakta SawantNON-PARAMETRIC TESTS by Prajakta Sawant
NON-PARAMETRIC TESTS by Prajakta Sawant
 
Poisson distribution
Poisson distributionPoisson distribution
Poisson distribution
 
Mean, Median, and Mode - Introductory Statistics
Mean, Median, and Mode - Introductory StatisticsMean, Median, and Mode - Introductory Statistics
Mean, Median, and Mode - Introductory Statistics
 
Partial correlation
Partial correlationPartial correlation
Partial correlation
 
Mann Whitney U test
Mann Whitney U testMann Whitney U test
Mann Whitney U test
 
Non-Parametric Tests
Non-Parametric TestsNon-Parametric Tests
Non-Parametric Tests
 
Analysis of variance
Analysis of varianceAnalysis of variance
Analysis of variance
 
Experimental Research Design
Experimental Research DesignExperimental Research Design
Experimental Research Design
 
Pearson's correlation
Pearson's  correlationPearson's  correlation
Pearson's correlation
 
Two Way ANOVA.pptx
Two Way ANOVA.pptxTwo Way ANOVA.pptx
Two Way ANOVA.pptx
 
Data Analysis Using Spss T Test
Data Analysis Using Spss   T TestData Analysis Using Spss   T Test
Data Analysis Using Spss T Test
 
Les5e ppt 11
Les5e ppt 11Les5e ppt 11
Les5e ppt 11
 
Binary Logistic Regression
Binary Logistic RegressionBinary Logistic Regression
Binary Logistic Regression
 
Chi square
Chi squareChi square
Chi square
 
Sign Test
Sign TestSign Test
Sign Test
 
Hypothesis Testing
Hypothesis TestingHypothesis Testing
Hypothesis Testing
 

Andere mochten auch (8)

Statistical computing 00
Statistical computing 00Statistical computing 00
Statistical computing 00
 
資料檢索
資料檢索資料檢索
資料檢索
 
Kirk' Experimental Design, Chapter 5
Kirk' Experimental Design, Chapter 5Kirk' Experimental Design, Chapter 5
Kirk' Experimental Design, Chapter 5
 
語言議題
語言議題語言議題
語言議題
 
repeated-measure-ANOVA
repeated-measure-ANOVArepeated-measure-ANOVA
repeated-measure-ANOVA
 
Kirk' Experimental Design, Chapter 2
Kirk' Experimental Design, Chapter 2Kirk' Experimental Design, Chapter 2
Kirk' Experimental Design, Chapter 2
 
Kirk' Experimental Design, Chapter 4
Kirk' Experimental Design, Chapter 4Kirk' Experimental Design, Chapter 4
Kirk' Experimental Design, Chapter 4
 
Kirk' Experimental Design, Chapter 3
Kirk' Experimental Design, Chapter 3Kirk' Experimental Design, Chapter 3
Kirk' Experimental Design, Chapter 3
 

Ähnlich wie Chi-Square Goodness-of-Fit & Independence Tests

Ähnlich wie Chi-Square Goodness-of-Fit & Independence Tests (20)

The Chi-Square Statistic: Tests for Goodness of Fit and Independence
The Chi-Square Statistic: Tests for Goodness of Fit and IndependenceThe Chi-Square Statistic: Tests for Goodness of Fit and Independence
The Chi-Square Statistic: Tests for Goodness of Fit and Independence
 
chi_square test.pptx
chi_square test.pptxchi_square test.pptx
chi_square test.pptx
 
Hypothesis Testing
Hypothesis TestingHypothesis Testing
Hypothesis Testing
 
Chi squared test
Chi squared testChi squared test
Chi squared test
 
Data analysis
Data analysisData analysis
Data analysis
 
Chi square test final
Chi square test finalChi square test final
Chi square test final
 
Goodness of fit (ppt)
Goodness of fit (ppt)Goodness of fit (ppt)
Goodness of fit (ppt)
 
Categorical Data and Statistical Analysis
Categorical Data and Statistical AnalysisCategorical Data and Statistical Analysis
Categorical Data and Statistical Analysis
 
Chi-square test.pptx
Chi-square test.pptxChi-square test.pptx
Chi-square test.pptx
 
Chi square mahmoud
Chi square mahmoudChi square mahmoud
Chi square mahmoud
 
UNIT 5.pptx
UNIT 5.pptxUNIT 5.pptx
UNIT 5.pptx
 
STATISTIC ESTIMATION
STATISTIC ESTIMATIONSTATISTIC ESTIMATION
STATISTIC ESTIMATION
 
Ds 2251 -_hypothesis test
Ds 2251 -_hypothesis testDs 2251 -_hypothesis test
Ds 2251 -_hypothesis test
 
chapter18.ppt
chapter18.pptchapter18.ppt
chapter18.ppt
 
chapter18.ppt
chapter18.pptchapter18.ppt
chapter18.ppt
 
chi sqare test.ppt
chi sqare test.pptchi sqare test.ppt
chi sqare test.ppt
 
chapter18.ppt
chapter18.pptchapter18.ppt
chapter18.ppt
 
Statr session 15 and 16
Statr session 15 and 16Statr session 15 and 16
Statr session 15 and 16
 
Topic 7 stat inference
Topic 7 stat inferenceTopic 7 stat inference
Topic 7 stat inference
 
Hypothesis testing1
Hypothesis testing1Hypothesis testing1
Hypothesis testing1
 

Mehr von Kevin Chun-Hsien Hsu

Mehr von Kevin Chun-Hsien Hsu (15)

[1062BPY12001] Data analysis with R / April 26
[1062BPY12001] Data analysis with R / April 26[1062BPY12001] Data analysis with R / April 26
[1062BPY12001] Data analysis with R / April 26
 
[1062BPY12001] Data analysis with R / April 19
[1062BPY12001] Data analysis with R / April 19[1062BPY12001] Data analysis with R / April 19
[1062BPY12001] Data analysis with R / April 19
 
[1062BPY12001] Data analysis with R / week 4
[1062BPY12001] Data analysis with R / week 4[1062BPY12001] Data analysis with R / week 4
[1062BPY12001] Data analysis with R / week 4
 
[1062BPY12001] Data analysis with R / week 3
[1062BPY12001] Data analysis with R / week 3[1062BPY12001] Data analysis with R / week 3
[1062BPY12001] Data analysis with R / week 3
 
[1062BPY12001] Data analysis with R / week 2
[1062BPY12001] Data analysis with R / week 2[1062BPY12001] Data analysis with R / week 2
[1062BPY12001] Data analysis with R / week 2
 
Regression 0410
Regression 0410Regression 0410
Regression 0410
 
Statistical computing 03
Statistical computing 03Statistical computing 03
Statistical computing 03
 
Statistical computing 01
Statistical computing 01Statistical computing 01
Statistical computing 01
 
Multiple regression
Multiple regressionMultiple regression
Multiple regression
 
Model III ANOVA & Simple Main Effects
Model III ANOVA & Simple Main EffectsModel III ANOVA & Simple Main Effects
Model III ANOVA & Simple Main Effects
 
Essentials of EEG/MEG
Essentials of EEG/MEGEssentials of EEG/MEG
Essentials of EEG/MEG
 
APA style
APA styleAPA style
APA style
 
Kirk' Experimental Design, Chapter 1
Kirk' Experimental Design, Chapter 1Kirk' Experimental Design, Chapter 1
Kirk' Experimental Design, Chapter 1
 
R intro 20140716-basic
R intro 20140716-basicR intro 20140716-basic
R intro 20140716-basic
 
R intro 20140716-advance
R intro 20140716-advanceR intro 20140716-advance
R intro 20140716-advance
 

Kürzlich hochgeladen

User Guide: Pulsar™ Weather Station (Columbia Weather Systems)
User Guide: Pulsar™ Weather Station (Columbia Weather Systems)User Guide: Pulsar™ Weather Station (Columbia Weather Systems)
User Guide: Pulsar™ Weather Station (Columbia Weather Systems)Columbia Weather Systems
 
Pests of soyabean_Binomics_IdentificationDr.UPR.pdf
Pests of soyabean_Binomics_IdentificationDr.UPR.pdfPests of soyabean_Binomics_IdentificationDr.UPR.pdf
Pests of soyabean_Binomics_IdentificationDr.UPR.pdfPirithiRaju
 
《Queensland毕业文凭-昆士兰大学毕业证成绩单》
《Queensland毕业文凭-昆士兰大学毕业证成绩单》《Queensland毕业文凭-昆士兰大学毕业证成绩单》
《Queensland毕业文凭-昆士兰大学毕业证成绩单》rnrncn29
 
ECG Graph Monitoring with AD8232 ECG Sensor & Arduino.pptx
ECG Graph Monitoring with AD8232 ECG Sensor & Arduino.pptxECG Graph Monitoring with AD8232 ECG Sensor & Arduino.pptx
ECG Graph Monitoring with AD8232 ECG Sensor & Arduino.pptxmaryFF1
 
Dubai Calls Girl Lisa O525547819 Lexi Call Girls In Dubai
Dubai Calls Girl Lisa O525547819 Lexi Call Girls In DubaiDubai Calls Girl Lisa O525547819 Lexi Call Girls In Dubai
Dubai Calls Girl Lisa O525547819 Lexi Call Girls In Dubaikojalkojal131
 
Four Spheres of the Earth Presentation.ppt
Four Spheres of the Earth Presentation.pptFour Spheres of the Earth Presentation.ppt
Four Spheres of the Earth Presentation.pptJoemSTuliba
 
Pests of castor_Binomics_Identification_Dr.UPR.pdf
Pests of castor_Binomics_Identification_Dr.UPR.pdfPests of castor_Binomics_Identification_Dr.UPR.pdf
Pests of castor_Binomics_Identification_Dr.UPR.pdfPirithiRaju
 
Pests of jatropha_Bionomics_identification_Dr.UPR.pdf
Pests of jatropha_Bionomics_identification_Dr.UPR.pdfPests of jatropha_Bionomics_identification_Dr.UPR.pdf
Pests of jatropha_Bionomics_identification_Dr.UPR.pdfPirithiRaju
 
bonjourmadame.tumblr.com bhaskar's girls
bonjourmadame.tumblr.com bhaskar's girlsbonjourmadame.tumblr.com bhaskar's girls
bonjourmadame.tumblr.com bhaskar's girlshansessene
 
User Guide: Magellan MX™ Weather Station
User Guide: Magellan MX™ Weather StationUser Guide: Magellan MX™ Weather Station
User Guide: Magellan MX™ Weather StationColumbia Weather Systems
 
Ai in communication electronicss[1].pptx
Ai in communication electronicss[1].pptxAi in communication electronicss[1].pptx
Ai in communication electronicss[1].pptxsubscribeus100
 
GENERAL PHYSICS 2 REFRACTION OF LIGHT SENIOR HIGH SCHOOL GENPHYS2.pptx
GENERAL PHYSICS 2 REFRACTION OF LIGHT SENIOR HIGH SCHOOL GENPHYS2.pptxGENERAL PHYSICS 2 REFRACTION OF LIGHT SENIOR HIGH SCHOOL GENPHYS2.pptx
GENERAL PHYSICS 2 REFRACTION OF LIGHT SENIOR HIGH SCHOOL GENPHYS2.pptxRitchAndruAgustin
 
Thermodynamics ,types of system,formulae ,gibbs free energy .pptx
Thermodynamics ,types of system,formulae ,gibbs free energy .pptxThermodynamics ,types of system,formulae ,gibbs free energy .pptx
Thermodynamics ,types of system,formulae ,gibbs free energy .pptxuniversity
 
The dark energy paradox leads to a new structure of spacetime.pptx
The dark energy paradox leads to a new structure of spacetime.pptxThe dark energy paradox leads to a new structure of spacetime.pptx
The dark energy paradox leads to a new structure of spacetime.pptxEran Akiva Sinbar
 
Observational constraints on mergers creating magnetism in massive stars
Observational constraints on mergers creating magnetism in massive starsObservational constraints on mergers creating magnetism in massive stars
Observational constraints on mergers creating magnetism in massive starsSérgio Sacani
 
Biological classification of plants with detail
Biological classification of plants with detailBiological classification of plants with detail
Biological classification of plants with detailhaiderbaloch3
 
STOPPED FLOW METHOD & APPLICATION MURUGAVENI B.pptx
STOPPED FLOW METHOD & APPLICATION MURUGAVENI B.pptxSTOPPED FLOW METHOD & APPLICATION MURUGAVENI B.pptx
STOPPED FLOW METHOD & APPLICATION MURUGAVENI B.pptxMurugaveni B
 
User Guide: Capricorn FLX™ Weather Station
User Guide: Capricorn FLX™ Weather StationUser Guide: Capricorn FLX™ Weather Station
User Guide: Capricorn FLX™ Weather StationColumbia Weather Systems
 
Introduction of Human Body & Structure of cell.pptx
Introduction of Human Body & Structure of cell.pptxIntroduction of Human Body & Structure of cell.pptx
Introduction of Human Body & Structure of cell.pptxMedical College
 
CHROMATOGRAPHY PALLAVI RAWAT.pptx
CHROMATOGRAPHY  PALLAVI RAWAT.pptxCHROMATOGRAPHY  PALLAVI RAWAT.pptx
CHROMATOGRAPHY PALLAVI RAWAT.pptxpallavirawat456
 

Kürzlich hochgeladen (20)

User Guide: Pulsar™ Weather Station (Columbia Weather Systems)
User Guide: Pulsar™ Weather Station (Columbia Weather Systems)User Guide: Pulsar™ Weather Station (Columbia Weather Systems)
User Guide: Pulsar™ Weather Station (Columbia Weather Systems)
 
Pests of soyabean_Binomics_IdentificationDr.UPR.pdf
Pests of soyabean_Binomics_IdentificationDr.UPR.pdfPests of soyabean_Binomics_IdentificationDr.UPR.pdf
Pests of soyabean_Binomics_IdentificationDr.UPR.pdf
 
《Queensland毕业文凭-昆士兰大学毕业证成绩单》
《Queensland毕业文凭-昆士兰大学毕业证成绩单》《Queensland毕业文凭-昆士兰大学毕业证成绩单》
《Queensland毕业文凭-昆士兰大学毕业证成绩单》
 
ECG Graph Monitoring with AD8232 ECG Sensor & Arduino.pptx
ECG Graph Monitoring with AD8232 ECG Sensor & Arduino.pptxECG Graph Monitoring with AD8232 ECG Sensor & Arduino.pptx
ECG Graph Monitoring with AD8232 ECG Sensor & Arduino.pptx
 
Dubai Calls Girl Lisa O525547819 Lexi Call Girls In Dubai
Dubai Calls Girl Lisa O525547819 Lexi Call Girls In DubaiDubai Calls Girl Lisa O525547819 Lexi Call Girls In Dubai
Dubai Calls Girl Lisa O525547819 Lexi Call Girls In Dubai
 
Four Spheres of the Earth Presentation.ppt
Four Spheres of the Earth Presentation.pptFour Spheres of the Earth Presentation.ppt
Four Spheres of the Earth Presentation.ppt
 
Pests of castor_Binomics_Identification_Dr.UPR.pdf
Pests of castor_Binomics_Identification_Dr.UPR.pdfPests of castor_Binomics_Identification_Dr.UPR.pdf
Pests of castor_Binomics_Identification_Dr.UPR.pdf
 
Pests of jatropha_Bionomics_identification_Dr.UPR.pdf
Pests of jatropha_Bionomics_identification_Dr.UPR.pdfPests of jatropha_Bionomics_identification_Dr.UPR.pdf
Pests of jatropha_Bionomics_identification_Dr.UPR.pdf
 
bonjourmadame.tumblr.com bhaskar's girls
bonjourmadame.tumblr.com bhaskar's girlsbonjourmadame.tumblr.com bhaskar's girls
bonjourmadame.tumblr.com bhaskar's girls
 
User Guide: Magellan MX™ Weather Station
User Guide: Magellan MX™ Weather StationUser Guide: Magellan MX™ Weather Station
User Guide: Magellan MX™ Weather Station
 
Ai in communication electronicss[1].pptx
Ai in communication electronicss[1].pptxAi in communication electronicss[1].pptx
Ai in communication electronicss[1].pptx
 
GENERAL PHYSICS 2 REFRACTION OF LIGHT SENIOR HIGH SCHOOL GENPHYS2.pptx
GENERAL PHYSICS 2 REFRACTION OF LIGHT SENIOR HIGH SCHOOL GENPHYS2.pptxGENERAL PHYSICS 2 REFRACTION OF LIGHT SENIOR HIGH SCHOOL GENPHYS2.pptx
GENERAL PHYSICS 2 REFRACTION OF LIGHT SENIOR HIGH SCHOOL GENPHYS2.pptx
 
Thermodynamics ,types of system,formulae ,gibbs free energy .pptx
Thermodynamics ,types of system,formulae ,gibbs free energy .pptxThermodynamics ,types of system,formulae ,gibbs free energy .pptx
Thermodynamics ,types of system,formulae ,gibbs free energy .pptx
 
The dark energy paradox leads to a new structure of spacetime.pptx
The dark energy paradox leads to a new structure of spacetime.pptxThe dark energy paradox leads to a new structure of spacetime.pptx
The dark energy paradox leads to a new structure of spacetime.pptx
 
Observational constraints on mergers creating magnetism in massive stars
Observational constraints on mergers creating magnetism in massive starsObservational constraints on mergers creating magnetism in massive stars
Observational constraints on mergers creating magnetism in massive stars
 
Biological classification of plants with detail
Biological classification of plants with detailBiological classification of plants with detail
Biological classification of plants with detail
 
STOPPED FLOW METHOD & APPLICATION MURUGAVENI B.pptx
STOPPED FLOW METHOD & APPLICATION MURUGAVENI B.pptxSTOPPED FLOW METHOD & APPLICATION MURUGAVENI B.pptx
STOPPED FLOW METHOD & APPLICATION MURUGAVENI B.pptx
 
User Guide: Capricorn FLX™ Weather Station
User Guide: Capricorn FLX™ Weather StationUser Guide: Capricorn FLX™ Weather Station
User Guide: Capricorn FLX™ Weather Station
 
Introduction of Human Body & Structure of cell.pptx
Introduction of Human Body & Structure of cell.pptxIntroduction of Human Body & Structure of cell.pptx
Introduction of Human Body & Structure of cell.pptx
 
CHROMATOGRAPHY PALLAVI RAWAT.pptx
CHROMATOGRAPHY  PALLAVI RAWAT.pptxCHROMATOGRAPHY  PALLAVI RAWAT.pptx
CHROMATOGRAPHY PALLAVI RAWAT.pptx
 

Chi-Square Goodness-of-Fit & Independence Tests

  • 2. Applications of Chi-Square • Goodness of fit (適合度檢驗) • Independence (獨立性檢驗) • Homogenecity (同質性檢驗)
  • 3. Chi-Square Test on Numerical Data • The researcher may believe there’s a relationship between X and Y, but doesn’t want to use regression. • There are outliers or anomalies that prevent us from assuming that the data came from a normal population. • The researcher has numerical data for one variable but not the other.
  • 4. Chi-Square Goodness of Fit Test • The test is applied when you have one categorical variable from a single population. • It is used to determine whether sample data are consistent with a hypothesized distribution. • For example, suppose a company printed baseball cards. It claimed that 30% of its cards were rookies; 60%, veterans; and 10%, All-Stars. We could gather a random sample of baseball cards and use a chi- square goodness of fit test to see whether our sample distribution differed significantly from the distribution claimed by the company.
  • 5. Chi-Square Test for Independence • The test is applied when you have two categorical variables from a single population. • It is used to determine whether there is a significant association between the two variables. • For example, in an election survey, voters might be classified by gender (male or female) and voting preference (Democrat, Republican, or Independent). We could use a chi-square test for independence to determine whether gender is related to voting preference.
  • 6. Chi-Square Test of Homogeneity • The test is applied to a single categorical variable from two different populations. • To determine whether frequency counts are distributed identically across different populations. • In a survey of TV viewing preferences, we might ask respondents to identify their favorite program. We might ask the same question of two different populations, such as males and females. We could use a chi-square test for homogeneity to determine whether male viewing preferences differed significantly from female viewing preferences.
  • 7. Chi-Square Test for Goodness-of-Fit • The goodness-of-fit (GOF) test helps you decide whether your sample resembles a particular kind of population. • The chi-square test will be used because it is versatile and easy to understand. Purpose of the Test
  • 8. Chi-Square Test for Goodness-of-Fit • A multinomial distribution is defined by any k probabilities p1, p2, …, pk that sum to unity. • For example, consider the following “official” proportions of M&M colors. Multinomial GOF Test calc
  • 9. Chi-Square Test for Goodness-of-Fit • The hypotheses are H0: p1 = .30, p2 = .20, p3 = .10, p4 = .10, p5 = .10, p6 = .20 H1: At least one of the pj differs from the hypothesized value • No parameters are estimated (m = 0) and there are c = 6 classes, so the degrees of freedom are n = c – m – 1 = 6 – 0 - 1 Multinomial GOF Test
  • 10. Chi-Square Test for Goodness-of-Fit • The hypotheses are: H0: The population follows a _____ distribution H1: The population does not follow a ______ distribution • The blank may contain the name of any theoretical distribution (e.g., uniform, Poisson, normal). Hypotheses for GOF
  • 11. Chi-Square Test for Goodness-of-Fit • Assuming n observations, the observations are grouped into c classes and then the chi-square test statistic is found using: Test Statistic and Degrees of Freedom for GOF where fj = the observed frequency of observations in class j ej = the expected frequency in class j if H0 were true calc
  • 12. Chi-Square Test for Goodness-of-Fit • If the proposed distribution gives a good fit to the sample, the test statistic will be near zero. • The test statistic follows the chi-square distribution with degrees of freedom n = c – m – 1 where c is the no. of classes used in the test m is the no. of parameters estimated Test Statistic and Degrees of Freedom for GOF
  • 13. Chi-Square Test for Goodness-of-Fit Test Statistic and Degrees of Freedom for GOF 110  ccmcv 211  ccmcv 312  ccmcv
  • 14. • For example, for n = 6 and a = .05, c2 .05 = 12.59. Chi-Square Test for Goodness-of-Fit
  • 15. Chi-Square Test for Goodness-of-Fit • Instead of “fishing” for a good-fitting model, visualize a priori the characteristics of the underlying data-generating process. Data-Generating Situations • Mixtures occur when more than one data-generating process is superimposed on top of one another. Mixtures: A Problem
  • 16. Chi-Square Test for Goodness-of-Fit • A simple “eyeball” inspection of the histogram or dot plot may suffice to rule out a hypothesized population. Eyeball Tests • Goodness-of-fit tests may lack power in small samples. As a guideline, a chi- square goodness-of-fit test should be avoided if n < 25. Small Expected Frequencies
  • 17. Normal Chi-Square Goodness-of-Fit Test • Two parameters, m and s, fully describe the normal distribution. • Unless m and s are know a priori, they must be estimated from a sample by using x and s. • Using these statistics, the chi-square goodness-of-fit test can be used. Normal Data Generating Situations
  • 18. Normal Chi-Square Goodness-of-Fit Test • Transform the sample observations x1, x2, …, xn into standardized values. • Count the sample observations fj within intervals of the form and compare them with the known frequencies ej based on the normal distribution. Method 1: Standardizing the Data x + ks
  • 19. Normal Chi-Square Goodness-of-Fit Test Method 1: Standardizing the Data Advantage is a standardized scale. Disadvantage is that data are no longer in the original units. Figure 15.14
  • 20. • The chi-square test is unreliable if the expected frequencies are too small. • Rules of thumb: • Cochran’s Rule requires that ejk > 5 for all cells. • Up to 20% of the cells may have ejk < 5 Small Expected Frequencies • Most agree that a chi-square test is infeasible if ejk < 1 in any cell. • If this happens, try combining adjacent rows to enlarge the expected frequencies.
  • 21. Chi-Square Test for Independence • A contingency table is a cross-tabulation of n paired observations into categories. • Each cell shows the count of observations that fall into the category defined by its row (r) and column (c) heading. Contingency Tables A B
  • 22. Chi-Square Test for Independence • For example: Contingency Tables Table 15.1
  • 23. Chi-Square Test for Independence • In a test of independence for an r x c contingency table, the hypotheses are H0: Variable A is independent of variable B H1: Variable A is not independent of variable B • Use the chi-square test for independence to test these hypotheses. • This non-parametric test is based on frequencies. • The n data pairs are classified into c columns and r rows and then the observed frequency fjk is compared with the expected frequency ejk. Chi-Square Test
  • 24. Chi-Square Test for Independence • In a test of independence for an r x c contingency table, the hypotheses are H0: Variable A is independent of variable B H1: Variable A is not independent of variable B H0: There is no relationship between the variables. H1: There is a relationship between the variables. • If two categorical variables are related, it means the chance that an individual falls into a particular category for one variable depends upon the particular category they fall into for the other variable. Chi-Square Test
  • 25. Chi-Square Test for Independence • The critical value comes from the chi-square probability distribution with n degrees of freedom. n = degrees of freedom = (r – 1)(c – 1) where r = number of rows in the table c = number of columns in the table • Appendix E contains critical values for right-tail areas of the chi-square distribution. • The mean of a chi-square distribution is n with variance 2n. Chi-Square Distribution
  • 26. Chi-Square Test for Independence • Assuming that H0 is true, the expected frequency of row j and column k is: ejk = RjCk/n where Rj = total for row j (j = 1, 2, …, r) Ck = total for column k (k = 1, 2, …, c) n = sample size Expected Frequencies
  • 27. Chi-Square Test for Independence • Step 1: State the Hypotheses H0: Variable A is independent of variable B H1: Variable A is not independent of variable B • Step 2: Specify the Decision Rule Calculate n = (r – 1)(c – 1) For a given a, look up the right-tail critical value (c2 R) from Appendix E or by using Excel. Reject H0 if c2 R > test statistic. Steps in Testing the Hypotheses
  • 28. Chi-Square Test for Independence • For example, for n = 6 and a = .05, c2 .05 = 12.59. Steps in Testing the Hypotheses
  • 29. Chi-Square Test for Independence • Here is the rejection region. Steps in Testing the Hypotheses Figure 15.3
  • 30. Chi-Square Test for Independence • Step 3: Calculate the Expected Frequencies ejk = RjCk/n • For example, Steps in Testing the Hypotheses
  • 31. Chi-Square Test for Independence • The chi-square test is unreliable if the expected frequencies are too small. • Rules of thumb: • Cochran’s Rule requires that ejk > 5 for all cells. • Up to 20% of the cells may have ejk < 5 Small Expected Frequencies • Most agree that a chi-square test is infeasible if ejk < 1 in any cell. • If this happens, try combining adjacent rows or columns to enlarge the expected frequencies.
  • 32. Chi-Square Test for Independence • Chi-square tests for independence can also be used to analyze quantitative variables by coding them into categories. Cross-Tabulating Raw Data For example, the variables Infant Deaths per 1,000 and Doctors per 100,000 can each be coded into various categories: