When researchers collect survey data, they often end up with answers sorted into categories rather than neat numbers. Did a respondent use the digital library or not? Are they male or female? Do they prefer print or e-books? These are categorical variables, and ordinary tools like averages and correlation coefficients simply do not work on them. To find out whether two such variables are connected, researchers turn to a pair of closely linked tools: the contingency table and the chi-square test. Together, they let you answer a deceptively simple question with statistical confidence: are these two things related, or is the pattern I am seeing just chance?

Table of Contents

What is a contingency table?

A contingency table is a grid that organises data according to two categorical variables at the same time. It is also called a cross-tabulation, crosstab, or two-way table. The categories of one variable run along the rows, while the categories of the other run along the columns, and each cell shows the count of cases that fall into that particular combination.

Suppose a library researcher surveys 200 students and records two things about each one: their gender, and whether they use the institution’s digital library. Gender has two categories (male, female) and usage has two categories (yes, no). The result is a 2×2 table with four cells, where each cell holds the number of students matching that pairing. A study at Nepal Open University did exactly this and found a significant link between gender and digital resource access, but no strong association with education level or region.

The table also carries marginal totals: the sum of each row, the sum of each column, and the grand total of the whole sample. These margins are not decoration. As you will see, they are the raw ingredients for working out what the data should look like if the two variables had no relationship at all.

Why not just use correlation?

Correlation measures how two continuous, numeric variables move together. Categorical data has no such continuum; “male” and “female” cannot be ranked on a scale, and neither can “uses library” versus “does not.” Because the categories do not form an ordered numeric line, a correlation coefficient cannot capture the pattern in this kind of data. This is precisely the gap the chi-square test fills. It is a nonparametric test, meaning it does not assume the data follows a normal distribution, which makes it usable in a wide range of research situations.

The chi-square test explained

The chi-square test of independence checks whether two categorical variables are associated or whether they vary independently of each other. The null hypothesis states that the two variables are independent, and the alternative hypothesis states that they are related. The test works by comparing what you actually observed against what you would expect to see if the variables truly had nothing to do with each other.

This gives us two sets of numbers for every cell. The observed frequency (O) is the actual count you recorded in your survey. The expected frequency (E) is the count you would predict under the assumption of independence. When the two variables are unrelated, the observed and expected values stay close together. When they are related, the gaps between them widen.

Calculating expected frequencies

Expected frequencies are built directly from the marginal totals of the contingency table. For any single cell, the formula is straightforward:

Expected frequency = (Row total × Column total) ÷ Grand total

Imagine our 200 students break down so that 80 use the digital library overall and 120 are female. The expected count for the “female and uses library” cell would be (120 × 80) ÷ 200 = 48. You repeat this for every cell. These expected counts are computed separately for each level of one variable at each level of the other, always pulling from the row and column totals rather than the individual observed counts. This is the step that encodes the idea of independence into actual numbers.

The chi-square formula

Once you have both the observed and expected frequencies, the test statistic is calculated with Karl Pearson’s chi-square formula:

χ² = Σ (O − E)² ÷ E

You take the difference between observed and expected for each cell, square it so negatives do not cancel positives, divide by the expected value to scale it, and then add up the results across all cells. This sum measures how far the observed frequencies deviate from what independence would predict. A small total means the data closely matches the independence assumption. A large total means the observed pattern is pulling away from it, hinting at a real relationship.

Assumptions you cannot ignore

The chi-square test is forgiving, but it is not assumption-free. The data must come from random sampling, the variables must be genuinely categorical, and each observation must fall into exactly one cell. There is also a sample-size condition. The chi-square distribution is only a good approximation when the data is in the form of actual counts, not percentages, and each expected frequency is reasonably large, generally at least 5. If too many cells have tiny expected counts, the test becomes unreliable, and for very small samples in a 2×2 table, researchers often switch to Fisher’s exact test instead.

Interpreting the results

A chi-square value on its own tells you nothing. To make sense of it, you need two more pieces: the degrees of freedom and a significance level. These let you compare your calculated statistic against a benchmark and decide whether the relationship you see is statistically meaningful.

Finding the degrees of freedom

Degrees of freedom describe how many cell values are free to vary once the marginal totals are fixed. For a contingency table, the formula is:

df = (number of rows − 1) × (number of columns − 1)

For our 2×2 library table, that is (2 − 1) × (2 − 1) = 1. A larger table, say 4 rows by 2 columns, would give (4 − 1) × (2 − 1) = 3 degrees of freedom. The bigger the table, the more degrees of freedom, and the higher the chi-square value needs to be before it counts as significant.

Comparing against the critical value

With the degrees of freedom and a chosen significance level (commonly α = 0.05), you look up the critical value in a chi-square distribution table. If your calculated chi-square value is greater than the critical value, you reject the null hypothesis and conclude the variables are related. If it is smaller, you do not have enough evidence to claim an association.

A worked example makes this concrete. In one analysis of movie type versus snack purchases, the calculated statistic was 65.03 with 3 degrees of freedom. The critical value at α = 0.05 was 7.815, and because 65.03 was far larger, the researchers rejected independence and concluded the two variables were associated.

Reading the p-value

Most statistical software, such as SPSS, reports a p-value alongside the chi-square statistic, which is often more convenient than comparing critical values by hand. The p-value indicates how probable it is that the relationship observed in the data is merely the result of sampling error. If the p-value falls below your significance level (for example, below 0.05), the association is considered statistically significant.

What the test does and does not tell you

This is where many researchers stumble. A significant chi-square result tells you that an association exists, but it says nothing about how strong that association is or in which direction it runs. The test is frequently over-interpreted, with researchers reading more into the result than the analysis can support. To gauge the strength of a relationship, you need additional measures of association such as Cramér’s V or the phi coefficient. The chi-square test is also a tool for the sample in front of you; because it works on coarser categorical data than parametric tests, it reports whether groups differ but does not on its own let you generalise to the wider population.

For students in library and information science, this toolkit is everywhere in real research. Studies on print versus digital resource use, on knowledge-management education across LIS schools, and on user behaviour by demographic group all lean on contingency tables and chi-square tests to turn raw survey counts into defensible conclusions.

What do you think? If a chi-square test on your own survey data showed a significant association between two variables, what would your very next analytical step be to make sure you were not over-interpreting the result? And how might a low expected frequency in just one or two cells change the way you report your findings?

How useful was this post?

Click on a star to rate it!

Average rating 0 / 5. Vote count: 0

No votes so far! Be the first to rate this post.

We are sorry that this post was not useful for you!

Let us improve this post!

Tell us how we can improve this post?

References
  1. https://libguides.library.kent.edu/spss/chisquare
  2. https://www.sciencepublishinggroup.com/article/10.11648/j.ijsdr.20251101.14
  3. https://www.simplypsychology.org/chi-square.html
  4. https://stats.libretexts.org/Courses/Kennesaw_State_University/Statistical_Applications_in_Psychological_Sciences_with_Multimedia/15:_Chi-square/15.02:_Chi-Square_Test_of_Independence
  5. https://arxiv.org/pdf/2008.03662
  6. https://arxiv.org/pdf/2411.01928
  7. https://arxiv.org/pdf/2505.06318
  8. https://www.vedantu.com/jee-main/maths-chi-square-formula
  9. https://www.graphpad.com/quickcalcs/contingency1/
  10. https://www.jmp.com/en/statistics-knowledge-portal/chi-square-test/chi-square-test-of-independence
  11. https://methods.sagepub.com/reference/encyclopedia-of-survey-research-methods/n64.xml
  12. https://www.researchgate.net/publication/391234856_Chi_Square_Test_Analysis_in_Use_of_Digital_Library_on_the_Basis_Gender_Education_Levels_and_Regional_Differences
  13. https://methods.sagepub.com/reference/encyc-of-research-design/n48.xml

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *

Research Methodology

1 Research- Meaning, Concept, Need

  1. Definition of Research
  2. Need for and Purpose of Research
  3. Conceptual Framework of Research and Terminology
  4. Basic and Applied Research
  5. Scientific Method
  6. Research Design
  7. Value of Studying Research Methodology for Library and Information Professionals

2 Historical Research

  1. Historical Research
  2. Definitions
  3. What is Not Historical Research?
  4. What Constitutes Historical Research?
  5. Advantages
  6. Limitations
  7. Purposes
  8. Scope of Application
  9. Types
  10. Importance in LIS
  11. Process of Conducting Research
  12. Internet
  13. Scientific Research
  14. Problems

3 Survey Research

  1. Data Collection
  2. Sampling
  3. How to Conduct a Survey
  4. Problems
  5. Instruments of Survey Research

4 Experimental Research

  1. Experimentation
  2. Hypothesis
  3. Research Procedure
  4. Validity
  5. Design of the Experiment
  6. Limitations of Experimental Method

5 Fundamental, Applied and Action Research

  1. Scientific Method
  2. S. R. Ranganathan’s Spiral of Scientific Method
  3. Basic Research
  4. Applied Research
  5. Action Research
  6. Descriptive Research
  7. Comparative Research
  8. Exploratory Research
  9. Diagnostic Research
  10. Social Research

6 Measurement of Variables

  1. Types of Variables
  2. Measurement of Qualitative Data
  3. Census versus Sample Survey
  4. Sampling Procedure
  5. Types of Sampling

7 Data Presentation

  1. Preparation of a Table
  2. Tabular Presentation
  3. Graphical Presentation
  4. Bar Diagrams
  5. Pie Chart

8 Statistical Techniques

  1. Measures of Central Tendency
  2. Arithmetic Mean
  3. Median
  4. Mode
  5. Measures of Dispersion
  6. Variance and Standard Deviation
  7. Coefficient of Variation
  8. Correlation
  9. Pearson’s Product Moment Correlation
  10. Regression Analysis
  11. Linear Regression
  12. Non-linear Regression
  13. Time Series Analysis

9 Statistical Packages

  1. Statistical Packages
  2. Microsoft Excel
  3. SPSS
  4. Other Software for Statistical Analysis

10 Observation Method

  1. Meaning and Definition
  2. Purpose
  3. Characteristics
  4. Planning and Process of Observation
  5. Recording of Data
  6. Types
  7. Advantages and Disadvantages
  8. Application in Libraries and Information Centers

11 Questionnaire Method

  1. Questionnaire Method: Definition
  2. Questionnaire Construction
  3. Types of Questionnaires
  4. Types of Questions
  5. Use of Scales
  6. Precautions in Questionnaire Construction
  7. Pretesting of Questionnaire
  8. Distribution of Questionnaire
  9. Response Rate
  10. Advantages and Limitations of Questionnaire Method

12 Interview Method

  1. Introduction
  2. Interviewing
  3. Types of Interviews
  4. Structured Interview
  5. Unstructured Interview
  6. Focussed Interview
  7. Non-directive Interview
  8. Clinical Interview
  9. Telephonic Interview
  10. Computer Assisted Telephone Interviewing (CATI) System
  11. Interview Process
  12. Advantages and Limitations of Interview Method

13 Experimental Method

  1. Research Problem Appropriate for an Experiment
  2. Parts of an Experiment
  3. Steps in Planning an Experimental Research
  4. Laboratory Experiment and Field Experiment
  5. Experimental Research Design
  6. Advantages, Disadvantages, and Limitations of Experimental Method

14 Case Study

  1. Case Study: Definition, Characteristics, and Importance
  2. Uses, Advantages, Disadvantages, and Limitations of Case Study
  3. Research Problem Appropriate for a Case Study
  4. Research Design in Case Study
  5. Steps in Case Study Method
  6. Case Study vs Case Work and Other Methods

15 Research Design

  1. What is Research Design?
  2. Need and Purpose
  3. Functions of Research Design
  4. Types of Research Design
  5. Based on Nature of Investigation
  6. Based on Data Collection Methods
  7. Based on Number of Contacts Made with the Subjects
  8. Based on Reference Period
  9. Summary

16 Research Plan

  1. Definition
  2. Need and Purpose
  3. Functions
  4. Types
  5. Structure
  6. Funding
  7. Monitoring
  8. Ethics

17 Statistical Inference

  1. Concept of Statistical Inference
  2. Statistical Estimation
  3. Concept of Hypothesis Testing
  4. Critical Regions and Types of Errors
  5. Testing of Hypothesis for a Single Sample
  6. Test for Difference between Two Samples
  7. Contingency Table

18 Presentation of Results

  1. Research Reports and their Types
  2. Importance and Significance of Research Reports
  3. Preparation of a Research Proposal
  4. Research Reports: Plan Outline, Format and Contents
  5. Preparation and Organisation of Research Notes
  6. Drafting of Research Reports
  7. Language and Grammar
  8. Physical Production