Skip to content

Survey data: the Rao–Scott chi-square

Clusters and weights make a survey carry less information than its row count suggests. Rao–Scott corrects the chi-square test for the design you actually used.

Advanced ~11 min9 steps

What runs in CodeSplash

You will be able to

  • Explain why clustered rows break Pearson's chi-square
  • Apply the first-order correction using the design effect
  • Give a survey's weights, clusters and strata to the test

Read first

01

When rows aren't independent

Read

Pearson's X2X^2 treats every row as an independent draw. Surveys rarely work that way. A fieldworker visits a neighborhood and asks several people there, and neighbors tend to answer alike.

Those neighborhoods are primary sampling unitsPrimary sampling unitThe first unit drawn in a multistage sample (a school, a household, a village); rows in the same PSU tend to be alike.. Each extra person in a cluster adds less information than a fresh draw would.

The design effectDesign effectHow much the sampling design inflates a variance compared with a simple random sample of the same size. measures the loss: how much the design inflates a variance compared with a simple random sample of the same size. Ignore it, and your standard errors come out too small and your p-values too low.

02

Predict the change

Predict

Predict first

A survey asks 360 people in 24 clusters about region and exercise. Ignoring the clusters gives X2X^2 = 18.08 on 6 df, p = .006. The mean design effect is 2.44.

What happens to the p-value once the design is respected?

It stays about the sameIt gets much largerIt gets much smaller
Reveal

It gets much larger: p = .284. An association that looked clear is compatible with none at all.

03

Feel the inflation

Explore

This explorable uses a t test on students in classrooms, but the mechanism is the same. Raise the intraclass correlation and watch the test that ignores clusters reject far more often than 5%, with no real effect present. Then compare adding people per cluster with adding clusters.

BExplorable · When observations come in clusters

What happens to a t test when students come in classrooms and you ignore it?

There is no true effect. How often does the naive t test reject?

0.50
How sure?
6
20
0.10
Simulating…

Commit your prediction above to see the result

Make your prediction first; the figure appears when you commit.

Make your prediction to see the result.

04

The correction

Read

The Rao–ScottRao–Scott correctionAdjusts χ² for a complex sample (weights, clusters, strata) by dividing by the design effect, so p-values are not too small. first-order correction divides the statistic by the mean design effect:

XRS12=X2dˉX^2_{\mathrm{RS1}} = \frac{X^2}{\bar d}

Here that's 18.08/2.44≈7.4118.08 / 2.44 \approx 7.41 on the same degrees of freedom. A rough reading: these respondents carry the information of about 360/2.44≈148360 / 2.44 \approx 148 independent people.

The second-order version also allows for how much the design effects vary across the table. It refers an FF statistic to fractional degrees of freedom: F(3.49, 80.4) = 1.24, p = .302. It's the default here, and the form most software reports.

05

Weights change the table too

Read

Weights do more than remove information: they change the estimated table itself. So the corrected p-value isn't always the larger one.

SurveyIgnoring the designRao–Scott
Weights onlyp = .441p = .549
Weights, clusters and stratap = .602p = .342

In the second survey, the weighted shares differ from the raw ones, and the mean design effect is only 1.10, so there's little inflation to correct. Neither p-value is the conservative one by rule. Use the one that matches how the data were collected.

06

Know your design

Reflect

The correction is only as good as the design you describe. With fewer than about 20 clusters, the design degrees of freedom are small and the test becomes unreliable.

Think of the last survey you analyzed. Do you have its weights, its cluster identifiers and its strata? If you have only the weights, what would you ask the people who ran it?

07

Check your understanding

Checkpoint

Check yourself

A Pearson statistic of 20 has a mean design effect of 2.5. What is the first-order Rao–Scott statistic?

Show the answer

Answer: 8

20 / 2.5 = 8, on the same degrees of freedom as the original test.

Check yourself

A clustered survey has 1,000 respondents and a design effect of 2.5. About how many independent respondents is it worth?

Show the answer

Answer: 400

1,000 / 2.5 = 400. Reporting the sample as 1,000 without that context overstates its precision.

Check yourself

Your data have 30 villages, with 20 households sampled in each, and no weights. What must you give the test?

Show the answer

Answer: b

The problem is dependence, and a large row count doesn't remove it. Equal weights change nothing. The cluster identifier is what lets the test see the dependence.

Check yourself

A study has 2,000 people, in only 8 clusters. What should worry you about a Rao–Scott test here?

Show the answer

Answer: a

Information about the design comes from the number of clusters, not the number of people. Eight clusters leave few design degrees of freedom.

08

Do it in CodeSplash

In the app

The test works on one row per respondent. Beside Rows and Columns, add Sampling weights, Clusters (PSUs) and Design strata, whichever your survey has. Any of them switches the card to Rao–Scott, which also reports the mean design effect. Rao–Scott correction chooses Second order or First order.

Python
from scipy import stats

# SciPy and statsmodels have no Rao-Scott test. Given a mean design effect from
# survey software, this is the first-order correction by hand.
x2, deff, df = 18.08, 2.44, 6
print(x2 / deff, stats.chi2.sf(x2 / deff, df))
R
library(survey)  # install.packages("survey")

df <- read.csv("survey_design.csv")
design <- svydesign(ids = ~cluster, data = df)

svychisq(~region + exercise, design, statistic = "F")      # second order
svychisq(~region + exercise, design, statistic = "Chisq")  # first order

The first-order output in R prints the uncorrected X2X^2 beside the corrected p-value.

09

Recap

Recap
  • Clustered rows carry less information than their count suggests, and Pearson's test doesn't know that.
  • Rao–Scott divides by the design effect; the second-order FF form is the usual default.
  • Give the test the real design. Weights alone don't deal with clusters, and few clusters limit any correction.

Concepts in this lesson