loglinear contingency table analysis karl l. wuensch dept of psychology east carolina university
TRANSCRIPT
![Page 1: Loglinear Contingency Table Analysis Karl L. Wuensch Dept of Psychology East Carolina University](https://reader035.vdocuments.us/reader035/viewer/2022062421/56649cf45503460f949c24f5/html5/thumbnails/1.jpg)
Loglinear Contingency Table Analysis
Karl L. Wuensch
Dept of Psychology
East Carolina University
![Page 2: Loglinear Contingency Table Analysis Karl L. Wuensch Dept of Psychology East Carolina University](https://reader035.vdocuments.us/reader035/viewer/2022062421/56649cf45503460f949c24f5/html5/thumbnails/2.jpg)
The Data
![Page 3: Loglinear Contingency Table Analysis Karl L. Wuensch Dept of Psychology East Carolina University](https://reader035.vdocuments.us/reader035/viewer/2022062421/56649cf45503460f949c24f5/html5/thumbnails/3.jpg)
Weight Cases by Freq
![Page 4: Loglinear Contingency Table Analysis Karl L. Wuensch Dept of Psychology East Carolina University](https://reader035.vdocuments.us/reader035/viewer/2022062421/56649cf45503460f949c24f5/html5/thumbnails/4.jpg)
Crosstabs
![Page 5: Loglinear Contingency Table Analysis Karl L. Wuensch Dept of Psychology East Carolina University](https://reader035.vdocuments.us/reader035/viewer/2022062421/56649cf45503460f949c24f5/html5/thumbnails/5.jpg)
Cell Statistics
![Page 6: Loglinear Contingency Table Analysis Karl L. Wuensch Dept of Psychology East Carolina University](https://reader035.vdocuments.us/reader035/viewer/2022062421/56649cf45503460f949c24f5/html5/thumbnails/6.jpg)
LR Chi-Square
![Page 7: Loglinear Contingency Table Analysis Karl L. Wuensch Dept of Psychology East Carolina University](https://reader035.vdocuments.us/reader035/viewer/2022062421/56649cf45503460f949c24f5/html5/thumbnails/7.jpg)
Model Selection Loglinear
HILOGLINEAR happy(1 2) marital(1 3)
/CRITERIA ITERATION(20) DELTA(0)
/PRINT=FREQ ASSOCIATION ESTIM
/DESIGN.
• No cells with count = 0, so no need to add .5 to each cell.
• Saturated model = happy, marital, Happy x Marital
![Page 8: Loglinear Contingency Table Analysis Karl L. Wuensch Dept of Psychology East Carolina University](https://reader035.vdocuments.us/reader035/viewer/2022062421/56649cf45503460f949c24f5/html5/thumbnails/8.jpg)
In Each Cell, O=E, Residual = 0
![Page 9: Loglinear Contingency Table Analysis Karl L. Wuensch Dept of Psychology East Carolina University](https://reader035.vdocuments.us/reader035/viewer/2022062421/56649cf45503460f949c24f5/html5/thumbnails/9.jpg)
The Model Fits the Data Perfectly, Chi-Square = 0
• The smaller the Chi-Square, the better the fit between model and data.
![Page 10: Loglinear Contingency Table Analysis Karl L. Wuensch Dept of Psychology East Carolina University](https://reader035.vdocuments.us/reader035/viewer/2022062421/56649cf45503460f949c24f5/html5/thumbnails/10.jpg)
Both One- and Two-Way Effects Are Significant
• The LR Chi-Square for Happy x Marital has the same value we got with Crosstabs
![Page 11: Loglinear Contingency Table Analysis Karl L. Wuensch Dept of Psychology East Carolina University](https://reader035.vdocuments.us/reader035/viewer/2022062421/56649cf45503460f949c24f5/html5/thumbnails/11.jpg)
The Model: Parameter Mu
• LN(cell freq)ij = + i + j + ij
• We are predicting natural logs of the cell counts.
is the natural log of the geometric mean of the expected cell frequencies.
• For our data,
and LN(154.3429) = 5.0392
3429.154)82)(47)(67)(301)(221(7876
![Page 12: Loglinear Contingency Table Analysis Karl L. Wuensch Dept of Psychology East Carolina University](https://reader035.vdocuments.us/reader035/viewer/2022062421/56649cf45503460f949c24f5/html5/thumbnails/12.jpg)
The Model: Lambda Parameters
• LN(cell freq)ij = + i + j + ij
i is the parameter associated with being at level i of the row variable.
• There will be (r-1) such parameters for r rows,
• And (c-1) lambda parameters, j, for c columns,
• And (r-1)(c-1) lambda parameters, for the interaction, ij.
![Page 13: Loglinear Contingency Table Analysis Karl L. Wuensch Dept of Psychology East Carolina University](https://reader035.vdocuments.us/reader035/viewer/2022062421/56649cf45503460f949c24f5/html5/thumbnails/13.jpg)
Lambda Parameter Estimates
![Page 14: Loglinear Contingency Table Analysis Karl L. Wuensch Dept of Psychology East Carolina University](https://reader035.vdocuments.us/reader035/viewer/2022062421/56649cf45503460f949c24f5/html5/thumbnails/14.jpg)
Main Effect of Marital Status
• For Marital = 1 (married), = +.397
• for Marital = 2 (single), = ‑.415
• For each effect, the lambda coefficients must sum to zero, so
• For Marital = 3 (split), = 0 ‑ (.397 ‑ .415) = .018.
![Page 15: Loglinear Contingency Table Analysis Karl L. Wuensch Dept of Psychology East Carolina University](https://reader035.vdocuments.us/reader035/viewer/2022062421/56649cf45503460f949c24f5/html5/thumbnails/15.jpg)
Main Effect of Happy
• For Happy = 1 (yes), = +.885
• Accordingly, for Happy =2 (no), is ‑.885.
![Page 16: Loglinear Contingency Table Analysis Karl L. Wuensch Dept of Psychology East Carolina University](https://reader035.vdocuments.us/reader035/viewer/2022062421/56649cf45503460f949c24f5/html5/thumbnails/16.jpg)
Happy x Marital
• For cell 1,1 (Happy, Married), = +.346
• So for [Unhappy, Married], = -.346
• For cell 1,2 (Happy, Single), = -.111
• So for [Unhappy, Single], = +.111
• For cell 1,3 (Happy, Split), = 0 ‑ (.346 ‑ .111) = ‑.235
• And for [Unhappy, Split], = 0 ‑ (‑.235) = +.235.
![Page 17: Loglinear Contingency Table Analysis Karl L. Wuensch Dept of Psychology East Carolina University](https://reader035.vdocuments.us/reader035/viewer/2022062421/56649cf45503460f949c24f5/html5/thumbnails/17.jpg)
Interpreting the Interaction Parameters
• For (Happy, Married), = +.346There are more scores in that cell
than would be expected from the marginal counts.
• For (Happy, Split), = 0 ‑.235
There are fewer scores in that cell than would be expected from the marginal counts.
![Page 18: Loglinear Contingency Table Analysis Karl L. Wuensch Dept of Psychology East Carolina University](https://reader035.vdocuments.us/reader035/viewer/2022062421/56649cf45503460f949c24f5/html5/thumbnails/18.jpg)
Predicting Cell Counts
• Married, Happye(5.0392 + .397 +.885 +.346) = 786 (within
rounding error of the actual frequency, 787)
• Split, Unhappy
e(5.0392 + .018 -.885 +.235) =82, the actual frequency.
![Page 19: Loglinear Contingency Table Analysis Karl L. Wuensch Dept of Psychology East Carolina University](https://reader035.vdocuments.us/reader035/viewer/2022062421/56649cf45503460f949c24f5/html5/thumbnails/19.jpg)
Testing the Parameters
• The null is that lambda is zero.
• Divide by standard error to get a z score.
• Every one of our effects has at least one significant parameter.
• We really should not drop any of the effects from the model, but, for pedagogical purposes, ………
![Page 20: Loglinear Contingency Table Analysis Karl L. Wuensch Dept of Psychology East Carolina University](https://reader035.vdocuments.us/reader035/viewer/2022062421/56649cf45503460f949c24f5/html5/thumbnails/20.jpg)
Drop Happy x Marital From the Model
HILOGLINEAR happy(1 2) marital(1 3)
/CRITERIA ITERATION(20) DELTA(0)
/PRINT=FREQ RESID ASSOCIATION ESTIM
/DESIGN happy marital.
• Notice that the design statement does not include the interaction term.
![Page 21: Loglinear Contingency Table Analysis Karl L. Wuensch Dept of Psychology East Carolina University](https://reader035.vdocuments.us/reader035/viewer/2022062421/56649cf45503460f949c24f5/html5/thumbnails/21.jpg)
Uh-Oh, Big Residuals
• A main effects only model does a poor job of predicting the cell counts.
![Page 22: Loglinear Contingency Table Analysis Karl L. Wuensch Dept of Psychology East Carolina University](https://reader035.vdocuments.us/reader035/viewer/2022062421/56649cf45503460f949c24f5/html5/thumbnails/22.jpg)
Big Chi-Square = Poor Fit
• Notice that the amount by which the Chi-Square increased = the value of Chi-Square we got earlier for the interaction term.
![Page 23: Loglinear Contingency Table Analysis Karl L. Wuensch Dept of Psychology East Carolina University](https://reader035.vdocuments.us/reader035/viewer/2022062421/56649cf45503460f949c24f5/html5/thumbnails/23.jpg)
Pairwise Comparisons
• Break down the 3 x 2 table into three 2 x 2 tables.
• Married folks report being happy significantly more often than do single persons or divorced persons.
• The difference between single and divorced persons falls short of statistical significance.
![Page 24: Loglinear Contingency Table Analysis Karl L. Wuensch Dept of Psychology East Carolina University](https://reader035.vdocuments.us/reader035/viewer/2022062421/56649cf45503460f949c24f5/html5/thumbnails/24.jpg)
SPSS Loglinear
LOGLINEAR Happy(1,2) Marital(1,3) /
CRITERIA=Delta(0) /
PRINT=DEFAULT ESTIM /
DESIGN=Happy Marital Happy by Marital.
• Replicates the analysis we just did using Hiloglinear.
• More later on the differences between Loglinear and Hiloglinear.
![Page 25: Loglinear Contingency Table Analysis Karl L. Wuensch Dept of Psychology East Carolina University](https://reader035.vdocuments.us/reader035/viewer/2022062421/56649cf45503460f949c24f5/html5/thumbnails/25.jpg)
SAS Catmodoptions pageno=min nodate formdlim='-';data happy;input Happy Marital count;cards;1 1 7871 2 2211 3 3012 1 672 2 472 3 82proc catmod;weight count;model Happy*Marital = _response_;Loglin Happy|Marital;run;
![Page 26: Loglinear Contingency Table Analysis Karl L. Wuensch Dept of Psychology East Carolina University](https://reader035.vdocuments.us/reader035/viewer/2022062421/56649cf45503460f949c24f5/html5/thumbnails/26.jpg)
PASW GENLOG
GENLOG happy marital
/MODEL=POISSON
/PRINT=FREQ DESIGN ESTIM CORR COV
/PLOT=NONE
/CRITERIA=CIN(95) ITERATE(20) CONVERGE(0.001) DELTA(0)
/DESIGN.
![Page 27: Loglinear Contingency Table Analysis Karl L. Wuensch Dept of Psychology East Carolina University](https://reader035.vdocuments.us/reader035/viewer/2022062421/56649cf45503460f949c24f5/html5/thumbnails/27.jpg)
GENLOG Coding
• Uses dummy coding, not effects coding.– Dummy = One level versus reference level– Effects = One level versus versus grand mean
• I don’t like it.
![Page 28: Loglinear Contingency Table Analysis Karl L. Wuensch Dept of Psychology East Carolina University](https://reader035.vdocuments.us/reader035/viewer/2022062421/56649cf45503460f949c24f5/html5/thumbnails/28.jpg)
Catmod Output
• Parameter estimates same as those with Hilog and loglinear.
• For the tests of these paramaters, SAS’ Chi-Square = the square of the z from PASW.
• I don’t know how the entries in the ML ANOVA table were computed.