22. G-Square Testο
22.1. Summaryο
The G-square test (likelihood ratio chi-square) is a test of (conditional) independence for discrete variables. It compares the likelihood of a model where two variables are independent given a conditioning set S to a model where they are allowed to depend on each other given S.
22.2. When to useο
Variables are discrete (categorical).
Sample sizes per cell are reasonably large.
You want a standard, likelihood-based CI test for PC, CPC, FCI, RFCI, or other constraint-based algorithms on discrete data.
22.3. Assumptionsο
Variables are discrete with a manageable number of categories.
Expected cell counts in the contingency tables are not too small (as for chi-square-type tests generally).
The multinomial model for counts is a reasonable approximation.
22.4. Test details (conceptual)ο
For each candidate independence X β Y | S, the G-square test:
Constructs contingency tables for X, Y, and S.
Compares the log-likelihood of the full model (X and Y possibly dependent given S) to the restricted model (X and Y independent given S).
Forms the test statistic GΒ² = 2 * (logL_full β logL_restricted).
Uses an approximate chi-square distribution with degrees of freedom equal to the difference in the number of parameters to compute a p-value.
22.5. Parametersο
Parameter (camelCase) |
Description |
|---|---|
|
Significance level (p-value cutoff) for the GΒ² likelihood-ratio test of (conditional) independence. The null hypothesis is that the variables are independent given the conditioning set. P-values below |
|
Minimum allowed count in each cell of the contingency table. If some cells fall below this threshold, the asymptotic chi-square approximation for the GΒ² statistic becomes less reliable. Increasing this value can improve accuracy but may reduce power when sample size is small. Default is 1; minimum is 1; maximum is 1,000,000. |
|
Optimization choice for how to build contingency tables: |
22.6. Strengthsο
Standard likelihood-based test for discrete contingency tables.
Works naturally with multinomial models used in discrete Bayes nets.
Symmetric in X and Y and straightforward to interpret.
22.7. Limitationsο
Can be unreliable when sample sizes per cell are small.
Complexity can grow quickly with the number of categories and conditioning variables.
Not suitable for continuous variables without discretization.
22.8. Referencesο
Agresti, A. (2002). Categorical Data Analysis (2nd ed.). Wiley.