[R] indicator or deviation contrasts in log-linear modelling
Charles C. Berry
cberry at tajo.ucsd.edu
Thu Feb 19 03:30:31 CET 2009
On Wed, 18 Feb 2009, 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,
Depends on what you mean by 'uses'.
The Iterative Proportional Fitting algorithm as presented in Haberman
(1972) is used for fitting the model. At most iter iterations are
performed, convergence is taken to occur when the maximum deviation
between observed and fitted margins is less than eps. All internal
computations are done in double precision; there is no limit on the number
of factors (the dimension of the table) in the model.
There are no explicit contrasts in IPF. The $param component returned when
'param=TRUE' is used is derived from the estimated cell frequencies. You
can transform these to other basis vectors. If there are no structural
lm( as.vector( loglin(...,fit=TRUE)$fit ) ~ < your favored contrasts > )
will give you estimates under your favored scheme.
Then too there is the surrogate Poisson approach, which will do this too.
> 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).
Yep, glm(). See McCullagh P. and Nelder, J. A. (1989) Generalized Linear
Models. London: Chapman and Hall. for details on surrogate Poisson
> 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!
I can think of three:
1) IPF doesn't need the parameters to do its work and do tests based on
loglinear models. The canonical reference is Bishop, Fienberg, and
Holland's Discrete Multivariate Analysis, 1975.
2) In many applications, direct inspection of the cell frequencies or
their estimates is quite natural.
3) Often there are higher order effects (a four way table with 3 way
interactions, say) , so the lower order parameter values are not easily
> Thanks for your help!
> View this message in context: http://www.nabble.com/indicator-or-deviation-contrasts-in-log-linear-modelling-tp22090104p22090104.html
> Sent from the R help mailing list archive at Nabble.com.
> R-help at r-project.org mailing list
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
Charles C. Berry (858) 534-2098
Dept of Family/Preventive Medicine
E mailto:cberry at tajo.ucsd.edu UC San Diego
http://famprevmed.ucsd.edu/faculty/cberry/ La Jolla, San Diego 92093-0901
More information about the R-help