G Test of Independence
The G test of independence is a likelihood-ratio test of association between two categorical variables, computing twice the sum of observed counts times the log of observed over expected counts.
독립성 G 검정은 관측빈도와 관측/기대 비의 로그를 곱해 합한 값의 두 배로 두 범주형 변수의 연관을 보는 우도비 검정이다.
Instead of Pearson's chi-square, can I use a likelihood-ratio test for my contingency table?
교차표에서 Pearson 카이제곱 대신 우도비 검정을 써도 되나요?
The G test compares observed and expected cell counts through the log-likelihood ratio and refers G to a chi-square distribution with (r − 1)(c − 1) degrees of freedom. Its results are usually close to Pearson's chi-square, and Williams' correction improves the approximation in small samples.
When to use G Test of Independence
- Two categorical variables are cross-tabulated.
- Results should be additive across nested tables or consistent with log-linear models.
- Expected counts are adequate in most cells.
When to use something else
- Many expected counts are below five; use Fisher's exact test.
- The variables are paired measurements on the same units; use McNemar's or the Stuart-Maxwell test.
Assumptions and requirements
- Observations are independent.
- Each observation falls into one cell.
- Expected counts are large enough for the chi-square approximation.
What the analysis reports
- G statistic
- Degrees of freedom
- p value
- Williams-corrected G and p
- Contingency table
How to report it
A G-test of independence indicated a significant association between [variable 1] and [variable 2], G([df], N = [n]) = [G], p = [p].
Related methods
Run G Test of Independence on Quorant
- Data you need
- a table (CSV or Excel) with an outcome variable and a grouping variable
- Price
- 150 credits for one analysis up to 10,000 rows (complexity level 1); larger or wider data costs more. Optional methodologist review: 900 credits.
- Checking
- Checked by property tests in every deployment
- Before you pay
- A free pre-analysis diagnosis checks your data and gives an exact quote; nothing is deducted until you approve it.