Log-Linear Models for Contingency Tables
Log-linear models describe the cell counts of a multiway contingency table with a Poisson model on the log scale, where interaction terms represent associations among the categorical variables.
로그선형 모형은 다원 분할표의 칸 빈도를 로그 척도의 포아송 모형으로 설명하며, 상호작용 항으로 범주형 변수 사이의 연관을 나타내는 방법입니다.
I have a three-way table of counts; which pairs of variables are associated once the third is taken into account?
세 범주형 변수로 만든 빈도표가 있는데, 셋째 변수를 고려해도 어떤 두 변수가 연관되어 있는지 알고 싶어요.
A log-linear model fits the expected count of each cell as a product of main effects and interaction terms, and its deviance G² measures how far the fitted counts are from the observed ones. Dropping one interaction at a time and comparing deviances tests that association, including conditional independence of two variables given the others.
When to use Log-Linear Models for Contingency Tables
- You have a table cross-classifying three or more categorical variables and no single response variable.
- You want to test conditional independence or homogeneous association in a multiway table.
- You want to find the simplest hierarchical model that reproduces the observed counts.
When to use something else
- One variable is clearly the outcome; use logistic or multinomial regression.
- The table has only two variables; a chi-square test of independence answers the question.
Assumptions and requirements
- Counts are independent Poisson or multinomial observations.
- Most expected cell counts are 5 or more for the chi-square approximation.
- Models are hierarchical: every lower-order term of an included interaction is also included.
What the analysis reports
- Likelihood-ratio G² and Pearson X² goodness of fit with degrees of freedom
- Likelihood-ratio test for each highest-order term in the model
- Conditional independence test for each pair of variables given the rest
- Fitted counts and adjusted residuals by cell
- Optional backward elimination path
How to report it
A hierarchical log-linear model [model terms] fit the data well, G²([df], N = [value]) = [value], p = [value]. Removing the [A]×[B] association worsened fit, ΔG²([df]) = [value], p = [value].
Related methods
- Chi-Square Test of Independence
- Poisson Regression
- Cochran-Mantel-Haenszel Test
Run Log-Linear Models for Contingency Tables on Quorant
- Data you need
- a table (CSV or Excel) with predictor (feature) columns and a weight column
- Price
- 400 credits for one analysis up to 10,000 rows (complexity level 3); larger or wider data costs more. Optional methodologist review: 1800 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.