• IB
  • IB Docs (2) Team
    Logout
  • Maths
  • Biology
  • Chemistry
  • Physics
  • Combined Science
  • English Language
  • Geography
  • Other Subjects
GCSE Maths
Edexcel Topic QuestionsRevision NotesPast PapersPast Papers Questions
AQA Topic QuestionsRevision NotesPast Papers
OCR Topic QuestionsRevision NotesPast Papers
GCSE Biology
Edexcel Topic QuestionsRevision NotesPast Papers
AQA Topic QuestionsRevision NotesPast Papers
OCR Gateway Topic QuestionsRevision NotesPast Papers
GCSE Chemistry
Edexcel Topic QuestionsRevision NotesPast Papers
AQA Topic QuestionsRevision NotesPast Papers
OCR Gateway Topic QuestionsRevision NotesPast Papers
GCSE Physics
Edexcel Topic QuestionsRevision NotesPast Papers
AQA Topic QuestionsRevision NotesPast Papers
OCR Gateway Topic QuestionsRevision NotesPast Papers
GCSE Combined Science
Edexcel Combined: Biology Topic QuestionsRevision NotesPast Papers
Edexcel Combined: Chemistry Topic QuestionsRevision NotesPast Papers
Edexcel Combined: Physics Revision NotesPast Papers
AQA Combined: Biology Topic QuestionsRevision NotesPast Papers
AQA Combined: Chemistry Topic QuestionsRevision NotesPast Papers
AQA Combined: Physics Topic QuestionsRevision NotesPast Papers
OCR Gateway Combined: Biology Topic QuestionsRevision Notes
OCR Gateway Combined: Chemistry Revision Notes
OCR Gateway Combined: Physics Revision Notes
GCSE English Language
AQA Revision NotesPractice PapersPast Papers
Edexcel Past Papers
OCR Past Papers
GCSE Geography
AQA Topic QuestionsRevision Notes
Edexcel Topic Questions
GCSE Other Subjects
AQA English LiteratureBusinessComputer ScienceEconomicsFurther MathsGeographyHistoryPsychologySociologyStatistics
Edexcel English LiteratureBusinessComputer ScienceGeographyHistoryPsychologyStatistics
OCR English LiteratureBusinessComputer ScienceEconomicsPsychology
OCR Gateway GeographyHistory
  • Maths
  • Biology
  • Chemistry
  • Physics
  • Double Science
  • Economics
  • English Language
  • Geography
  • Other Subjects
IGCSE Maths
Edexcel Topic QuestionsRevision NotesPast PapersBronze-Silver-Gold Questions
CIE (Extended) Topic QuestionsRevision NotesPast Papers
CIE (Core) Topic QuestionsPast Papers
IGCSE Biology
Edexcel Topic QuestionsRevision NotesPast Papers
CIE 2020-2022 Topic QuestionsRevision NotesPast Papers
CIE 2023-2025 Topic QuestionsRevision NotesPast Papers
IGCSE Chemistry
Edexcel Topic QuestionsRevision NotesPast Papers
CIE 2020-2022 Topic QuestionsRevision NotesPast Papers
CIE 2023-2025 Topic QuestionsRevision NotesPast Papers
IGCSE Physics
Edexcel Topic QuestionsRevision NotesPast Papers
CIE 2020-2022 Topic QuestionsRevision NotesPast Papers
CIE 2023-2025 Topic QuestionsRevision NotesPast Papers
IGCSE Double Science
Edexcel Double: Biology Topic QuestionsRevision NotesPast Papers
Edexcel Double: Chemistry Topic QuestionsRevision NotesPast Papers
Edexcel Double: Physics Topic QuestionsRevision NotesPast Papers
IGCSE Economics
CIE Topic QuestionsRevision NotesPast Papers
IGCSE English Language
CIE Revision NotesPractice PapersPast Papers
Edexcel Past Papers
IGCSE Geography
CIE Revision NotesTopic QuestionsPast Papers
Edexcel Topic QuestionsRevision NotesPast Papers
IGCSE Other Subjects
CIE Additional MathsEnglish LiteratureBusinessComputer ScienceHistorySociology
Edexcel English LiteratureBusinessComputer ScienceHistoryFurther Maths
  • Maths
  • Biology
  • Chemistry
  • Physics
  • English Language
  • Other Subjects
AS Maths
Edexcel Pure MathsMechanicsStatistics
AQA Pure MathsMechanicsStatistics
OCR Pure MathsMechanicsStatistics
CIE Pure 1Pure 2MechanicsProbability & Statistics 1
Edexcel IAS Pure 1Pure 2MechanicsStatistics
AS Biology
AQA Topic QuestionsRevision NotesPast Papers
OCR Topic QuestionsRevision NotesPast Papers
CIE 2019-2021 Topic QuestionsRevision NotesPast Papers
CIE 2022-2024 Topic QuestionsRevision NotesPast Papers
Edexcel IAL Revision Notes
AS Chemistry
Edexcel Revision Notes
AQA Topic QuestionsRevision NotesPast Papers
OCR Revision Notes
CIE 2019-2021 Topic QuestionsRevision NotesPast Papers
CIE 2022-2024 Topic QuestionsRevision NotesPast Papers
Edexcel IAL Revision Notes
AS Physics
Edexcel Revision Notes
AQA Topic QuestionsRevision NotesPast Papers
OCR Revision NotesPast Papers
CIE 2019-2021 Topic QuestionsRevision NotesPast Papers
CIE 2022-2024 Topic QuestionsRevision NotesPast Papers
Edexcel IAL Revision Notes
AS English Language
AQA Past Papers
Edexcel Past Papers
OCR Past Papers
AS Other Subjects
AQA BusinessComputer ScienceEconomicsEnglish LiteratureFurther MathsGeographyHistoryPsychologySociology
Edexcel BusinessEconomicsEnglish LiteratureFurther MathsGeographyHistoryPsychology
OCR BusinessComputer ScienceEconomicsEnglish LiteratureFurther Maths AGeographyHistoryPsychologySociology
CIE Further Maths
  • Maths
  • Biology
  • Chemistry
  • Physics
  • English Language
  • Economics
  • Further Maths
  • Psychology
  • Other Subjects
A Level Maths
Edexcel Pure MathsMechanicsStatistics
AQA Pure MathsMechanicsStatistics
OCR Pure MathsMechanicsStatistics
CIE Pure 1Pure 3MechanicsProbability & Statistics 1Probability & Statistics 2
Edexcel IAL Pure 1Pure 2Pure 3Pure 4Mechanics 1Mechanics 2Statistics 1Statistics 2Decision 1
A Level Biology
Edexcel Topic QuestionsPast Papers
Edexcel A (SNAB) Revision Notes
AQA Topic QuestionsRevision NotesPast Papers
OCR Topic QuestionsRevision NotesPast PapersGold Questions
CIE 2019-2021 Topic QuestionsRevision NotesPast Papers
CIE 2022-2024 Topic QuestionsRevision NotesPast Papers
Edexcel IAL Topic QuestionsRevision NotesPast Papers
A Level Chemistry
Edexcel Topic QuestionsRevision NotesPast Papers
AQA Topic QuestionsRevision NotesPast Papers
OCR Topic QuestionsRevision NotesPast PapersGold Questions
CIE 2019-2021 Topic QuestionsRevision NotesPast Papers
CIE 2022-2024 Topic QuestionsRevision NotesPast Papers
Edexcel IAL Topic QuestionsRevision NotesPast Papers
A Level Physics
Edexcel Topic QuestionsRevision NotesPast Papers
AQA Topic QuestionsRevision NotesPast Papers
OCR Topic QuestionsRevision NotesPast Papers
CIE 2019-2021 Topic QuestionsRevision NotesPast Papers
CIE 2022-2024 Topic QuestionsRevision NotesPast Papers
Edexcel IAL Topic QuestionsRevision NotesPast Papers
A Level English Language
AQA Past Papers
CIE Past Papers
Edexcel Past Papers
OCR Past Papers
Edexcel IAL Past Papers
A Level Economics
Edexcel Topic QuestionsRevision NotesPast Papers
AQA Topic QuestionsPast Papers
OCR Past Papers
CIE Past Papers
A Level Further Maths
Edexcel Topic QuestionsRevision NotesPast Papers
AQA Past Papers
OCR Past Papers
CIE Past Papers
Edexcel IAL Past Papers
A Level Psychology
AQA Topic QuestionsRevision NotesPast Papers
CIE Past Papers
Edexcel Past Papers
OCR Past Papers
Edexcel IAL Past Papers
A Level Other Subjects
AQA BusinessComputer ScienceEconomicsEnglish LiteratureGeographyHistorySociology
CIE BusinessComputer ScienceEconomicsEnglish LiteratureGeographySociology
Edexcel BusinessEconomics AEnglish LiteratureGeographyHistory
OCR BusinessComputer ScienceEconomicsEnglish LiteratureGeographyHistorySociology
Edexcel IAL English LiteratureGeography
CIE IAL History
  • Biology
  • Chemistry
  • Physics
  • Other Subjects
O Level Biology
CIE Topic QuestionsPast Papers
O Level Chemistry
CIE Topic QuestionsPast Papers
O Level Physics
CIE Topic QuestionsPast Papers
O Level Other Subjects
CIE Additional MathsMaths D
  • Maths
  • Biology
  • Chemistry
  • Physics
Pre U Maths
CIE Topic QuestionsPast Papers
Pre U Biology
CIE Topic QuestionsPast Papers
Pre U Chemistry
CIE Topic QuestionsPast Papers
Pre U Physics
CIE Topic QuestionsPast Papers
  • Maths
  • Biology
  • Chemistry
  • Physics
  • Economics
IB Maths
Maths: AA HL Topic QuestionsRevision NotesPractice Papers
Maths: AI HL Topic QuestionsRevision NotesPractice Papers
Maths: AA SL Topic QuestionsRevision NotesPractice Papers
Maths: AI SL Topic QuestionsRevision NotesPractice Papers
IB Biology
Biology: SL Topic QuestionsRevision NotesPractice Papers
Biology: HL Topic QuestionsRevision NotesPractice Papers
IB Chemistry
Chemistry: SL Topic QuestionsRevision NotesPractice Papers
Chemistry: HL Topic QuestionsRevision NotesPractice Papers
IB Physics
Physics: SL Topic QuestionsRevision NotesPractice Papers
Physics: HL Topic QuestionsRevision NotesPractice Papers
IB Economics
Economics: SL Revision Notes

DP IB Maths: AI SL

Revision Notes

Home / IB / Maths: AI SL / DP / Revision Notes / 4. Statistics & Probability / 4.7 Hypothesis Testing / 4.7.2 Chi-squared Test for Independence


4.7.2 Chi-squared Test for Independence


Chi-Squared Test for Independence

What is a chi-squared test for independence?

  • A chi-squared (chi squared) test for independence is a hypothesis test used to test whether two variables are independent of each other
    • This is sometimes called a chi squared two-way test
  • This is an example of a goodness of fit test
    • We are testing whether the data fits the model that the variables are independent
  • The chi-squared (chi squared) distribution is used for this test
  • You will use a contingency table
    • This is a two-way table that shows the observed frequencies for the different combinations of the two variables
      • For example: if the two variables are hair colour and eye colour then the contingency table will show the frequencies of the different combinations

What is the degree of freedom?

  • The degree of freedom refers to the minimum number of expected values you need to know in order to be able to calculate them all
  • The degree of freedom is denoted nu
  • For a test for independence with an m × n contingency table
    • nu equals left parenthesis m minus 1 right parenthesis cross times left parenthesis n minus 1 right parenthesis 
    • For example: If there are 5 rows and 3 columns then you only need to know 2 of the values in 4 of the rows as the rest can be calculated using the totals

What are the steps for a chi-squared test for independence?

  • STEP 1: Write the hypotheses
    • H0 : Variable X is independent of variable Y
    • H1 : Variable X is not independent of variable Y
      • Make sure you clearly write what the variables are and don’t just call them X and Y
  • STEP 2: Calculate the degree of freedom for the test
    • For an m × n contingency table
    • Degree of freedom is nu equals left parenthesis m minus 1 right parenthesis cross times left parenthesis n minus 1 right parenthesis
  • STEP 3: Enter your observed frequencies into your GDC using the option for a 2-way test
    • Enter these as a matrix
    • Your GDC will give you a matrix of the expected values (assuming the variables are independent)
    • Your GDC will also give you the χ² statistic and its p-value
    • The χ² statistic is denoted as chi subscript c a l c end subscript superscript 2
  • STEP 4: Decide whether there is evidence to reject the null hypothesis
    • EITHER compare the χ² statistic with the given critical value
      • If χ² statistic > critical value then reject H0
      • If χ² statistic < critical value then accept H0
    • OR compare the p-value with the given significance level
      • If p-value < significance level then reject H0
      • If p-value > significance level then accept H0
  • STEP 5: Write your conclusion
    • If you reject H0
      • There is sufficient evidence to suggest that variable X is not independent of variable Y
      • Therefore this suggests they are associated
    • If you accept H0
      • There is insufficient evidence to suggest that variable X is not independent of variable Y
      • Therefore this suggests they are independent

How do I calculate the chi-squared statistic?

  • You are expected to be able to use your GDC to calculate the χ² statistic by inputting the matrix of the observed frequencies
  • Seeing how it is done by hand might deepen your understanding but you are not expected to use this method
  • STEP 1: For each observed frequency Oi calculate its expected frequency Ei
    • Assuming the variables are independent
      • Ei = P(X = x) × P(Y = y) × Total
      • Which simplifies to 
  • STEP 2: Calculate the χ² statistic using the formula
    • chi subscript c a l c end subscript superscript 2 equals sum stretchy left parenthesis O subscript i minus E subscript i stretchy right parenthesis squared over E subscript i
    • You do not need to learn this formula as your GDC calculates it for you
  • To calculate the p-value you would find the probability of a value being bigger than your χ² statistic using a χ² distribution with ν degrees of freedom

Exam Tip

Note for Internal Assessments (IA)

  • If you use a χ² test in your IA then beware that the outcome may not be accurate if:
    • Any of the expected values are less than 5
    • There is only 1 degree of freedom
      • This means it is a 2 × 2 contingency table
  • Note that none of these cases will occur in the exam

Worked Example

At a school in Paris, it is believed that favourite film genre is related to favourite subject.  500 students were asked to indicate their favourite film genre and favourite subject from a selection and the results are indicated in the table below.

 

Comedy

Action

Romance

Thriller

Maths

51

52

37

55

Sports

59

63

41

33

Geography

35

31

28

15

It is decided to test this hypothesis by using a chi squared test for independence at the 1% significance level. 

The critical value is 16.812.

a)
State the null and alternative hypotheses for this test.

4-7-2-ib-ai-sl-chi-squared-ind-a-we-solution

b)
Write down the number of degrees of freedom for this table.

4-7-2-ib-ai-sl-chi-squared-ind-b-we-solution

c)
Calculate the chi squared test statistic for this data.

4-7-2-ib-ai-sl-chi-squared-ind-c-we-solution

d)
Write down the conclusion to the test. Give a reason for your answer.

4-7-2-ib-ai-sl-chi-squared-ind-d-we-solution



  • 1. Number & Algebra
    • 1.1 Number Toolkit
      • 1.1.1 Standard Form
        • 1.1.2 Exponents & Logarithms
          • 1.1.3 Approximation & Estimation
            • 1.1.4 GDC: Solving Equations
            • 1.2 Sequences & Series
              • 1.2.1 Language of Sequences & Series
                • 1.2.2 Arithmetic Sequences & Series
                  • 1.2.3 Geometric Sequences & Series
                    • 1.2.4 Applications of Sequences & Series
                    • 1.3 Financial Applications
                      • 1.3.1 Compound Interest & Depreciation
                        • 1.3.2 Amortisation & Annuities
                      • 2. Functions
                        • 2.1 Linear Functions & Graphs
                          • 2.1.1 Equations of a Straight Line
                          • 2.2 Further Functions & Graphs
                            • 2.2.1 Functions
                              • 2.2.2 Graphing Functions
                                • 2.2.3 Properties of Graphs
                                • 2.3 Modelling with Functions
                                  • 2.3.1 Linear & Piecewise Models
                                    • 2.3.2 Quadratic & Cubic Models
                                      • 2.3.3 Exponential Models
                                        • 2.3.4 Direct & Inverse Variation
                                          • 2.3.5 Sinusoidal Models
                                            • 2.3.6 Strategy for Modelling Functions
                                          • 3. Geometry & Trigonometry
                                            • 3.1 Geometry Toolkit
                                              • 3.1.1 Coordinate Geometry
                                                • 3.1.2 Arcs & Sectors
                                                • 3.2 Geometry of 3D Shapes
                                                  • 3.2.1 3D Coordinate Geometry
                                                    • 3.2.2 Volume & Surface Area
                                                    • 3.3 Trigonometry
                                                      • 3.3.1 Pythagoras & Right-Angled Triganometry
                                                        • 3.3.2 Non Right-Angled Trigonometry
                                                          • 3.3.3 Applications of Trigonometry & Pythagoras
                                                          • 3.4 Voronoi Diagrams
                                                            • 3.4.1 Voronoi Diagrams
                                                              • 3.4.2 Toxic Waste Dump Problem
                                                            • 4. Statistics & Probability
                                                              • 4.1 Statistics Toolkit
                                                                • 4.1.1 Sampling & Data Collection
                                                                  • 4.1.2 Statistical Measures
                                                                    • 4.1.3 Frequency Tables
                                                                      • 4.1.4 Linear Transformations of Data
                                                                        • 4.1.5 Outliers
                                                                          • 4.1.6 Univariate Data
                                                                            • 4.1.7 Interpreting Data
                                                                            • 4.2 Correlation & Regression
                                                                              • 4.2.1 Bivariate data
                                                                                • 4.2.2 Correlation Coefficients
                                                                                  • 4.2.3 Linear Regression
                                                                                  • 4.3 Probability
                                                                                    • 4.3.1 Probability & Types of Events
                                                                                      • 4.3.2 Conditional Probability
                                                                                        • 4.3.3 Sample Space Diagrams
                                                                                        • 4.4 Probability Distributions
                                                                                          • 4.4.1 Discrete Probability Distributions
                                                                                            • 4.4.2 Expected Values
                                                                                            • 4.5 Binomial Distribution
                                                                                              • 4.5.1 The Binomial Distribution
                                                                                                • 4.5.2 Calculating Binomial Probabilities
                                                                                                • 4.6 Normal Distribution
                                                                                                  • 4.6.1 The Normal Distribution
                                                                                                    • 4.6.2 Calculations with Normal Distribution
                                                                                                    • 4.7 Hypothesis Testing
                                                                                                      • 4.7.1 Hypothesis Testing
                                                                                                        • 4.7.2 Chi-squared Test for Independence
                                                                                                          • 4.7.3 Goodness of Fit Test
                                                                                                            • 4.7.4 The t-test
                                                                                                          • 5. Calculus
                                                                                                            • 5.1 Differentiation
                                                                                                              • 5.1.1 Introduction to Differentiation
                                                                                                                • 5.1.2 Applications of Differentiation
                                                                                                                  • 5.1.3 Modelling with Differentiation
                                                                                                                  • 5.2 Integration
                                                                                                                    • 5.2.1 Trapezoid Rule: Numerical Integration
                                                                                                                      • 5.2.2 Introduction to Integration
                                                                                                                        • 5.2.3 Applications of Integration
                                                                                                                      Daniel Finlay

                                                                                                                      Author: Daniel

                                                                                                                      Dan graduated from the University of Oxford with a First class degree in mathematics. As well as teaching maths for over 8 years, Dan has marked a range of exams for Edexcel, tutored students and taught A Level Accounting. Dan has a keen interest in statistics and probability and their real-life applications.


                                                                                                                      Save My Exams Logo
                                                                                                                      Resources
                                                                                                                      Home Join Support

                                                                                                                      Members
                                                                                                                      Members Home Account Logout

                                                                                                                      Company
                                                                                                                      About Us Contact Us Jobs Terms Privacy Facebook Twitter

                                                                                                                      Quick Links
                                                                                                                      GCSE Revision Notes IGCSE Revision Notes A Level Revision Notes Biology Chemistry Physics Maths 2022 Advance Information

                                                                                                                       
                                                                                                                      © IB Documents (2) Team & u/aimlesskr
                                                                                                                      IBO was not involved in the production of, and does not endorse, the resources created by Save My Exams.