[R] indicator or deviation contrasts in log-linear modelling
Michael Friendly
friendly at yorku.ca
Thu Feb 19 14:30:53 CET 2009
Maja,
The need to interpret parameters in log-linear models (and therefore,
the need to understand how the model is parameterized) often vanishes
if you visualize the fitted model or the residuals in a mosaic display.
e.g., ucb1 asserts Admit is jointly independent of Gender and Dept ---
fits very badly, but the residuals show the *nature* of the association
not accounted for.
ucb2 - Admit and Gender conditionally independent, given Dept --- fits
badly overall, but only in one department.
> library(vcd)
> ucb1 <- loglm(~Admit + Gender*Dept, data=UCBAdmissions)
> ucb1
Call:
loglm(formula = ~Admit + Gender * Dept, data = UCBAdmissions)
Statistics:
X^2 df P(> X^2)
Likelihood Ratio 877 11 0
Pearson 798 11 0
> plot(ucb1)
> ucb2 <- loglm(~Admit*Dept + Gender*Dept, data=UCBAdmissions)
> ucb2
Call:
loglm(formula = ~Admit * Dept + Gender * Dept, data = UCBAdmissions)
Statistics:
X^2 df P(> X^2)
Likelihood Ratio 22 6 0.0014
Pearson 20 6 0.0028
> plot(ucb2)
maiya wrote:
> I am fairly new to log-linear modelling, so as opposed to trying to fit
> modells, I am still trying to figure out how it actually works - hence I am
> looking at the interpretation of parameters. Now it seems most people skip
> this part and go directly to measuring model fit, so I am finding very few
> references to actual parameters, and am of course clear on the fact that
> their choice is irelevant for the actual model fit.
>
> But here is my question: loglin uses deviation contrasts, so the
> coefficients in each term add up to zero.
> Another option are indicator contrasts, where a reference category is chosen
> in each term and set to zero, while the others are relative to it. My
> question is if there is a log-linear command equivalent to loglin that uses
> this secong "dummy coding" style of constraints (I know e.g. spss genlog
> does this).
>
> I hope this is not to basic a question!
>
> And if anyone is up for answeing the wider question of why log-linear
> parameters are not something to be looked at - which might just be my
> impression of the literature - feel free to comment!
>
> Thanks for your help!
>
> Maja
--
Michael Friendly Email: friendly AT yorku DOT ca
Professor, Psychology Dept.
York University Voice: 416 736-5115 x66249 Fax: 416 736-5814
4700 Keele Street http://www.math.yorku.ca/SCS/friendly.html
Toronto, ONT M3J 1P3 CANADA
More information about the R-help
mailing list