[R-sig-ME] Replicating type III anova tests for glmer/GLMM

Emmanuel Curis emmanuel.curis at parisdescartes.fr
Wed Feb 24 10:54:07 CET 2016

Dear Pr Fox,

Thanks for taking time for this discussion. I think I made a few
shortcuts that are wrong, and I still have some not understood issues
about the kind of tests even in the simplest case of linear models...

First, I think I mixed contrast and quadratic forms expectations in my
answer, I apologize for that; what I had in mind when answering
Francesco was in fact the expectation of the quadratic form, and I too
quickly deduced that there was an equivalent linear combination of the
parameters as its « square root », but this was obviously wrong since
the L matrix in a Lt W L quadratic form does not have to be a column
matrix. Am I wrong thinking that typically in such tests, the L matrix
is precisely a multi-column matrix (hence also several degrees of
freedom associated), and that several contrasts are tested

I precise that I call « contrast » a linear combination of the model
parameters with the constraint that the coefficients of this
combination sum to 0 ─ this is the definition in French (« contraste »),
but I may use it wrongly in English?

Second, I may have wrongly understood the definitions of the various
tests, and especially how they generalize from linear model to

I thought type I was by taking the squared distance of the successive
orthogonal projections on the subspaces generated by the various
terms, in the order given in the model; type II, by ensuring that
the term tested was the last amongst terms of same order, after
terms of lower order but before terms of higher order; type III, by
projecting on the subspace after removal of the basis vectors for the
term tested ─ hence its strong dependency on the coding scheme, and
the « drop1 » trick to get them.

Is this definition correct? Does it generalize to other kind models,
or is another definition required? Is it unambiguous? The SAS doc
itself suggests that various procedures call "type II" different kind
of things

However, I cannot see clearly which hypothesis is indeed tested in
each case, especially in terms of cell means or marginal means (and,
when I really need it, I start from them and select the contrasts I
need).  Is there any package/software that allows to print the
hypotheses testeds in terms of means starting from the model formula?
Or is there any good reference that makes the link between the two?
For instance, a demonstration that the comparison of marginal means
« always » leads to a type XXX sum of square?

Best regards,

On Tue, Feb 23, 2016 at 05:17:29PM +0000, Fox, John wrote:
« Dear Emmanuel,
« First, the relevant linear hypothesis is for several coefficients simultaneously -- for example, all 3 coefficients for the contrasts representing a 4-level factor -- not for a single contrast. Although it's true that any linear combination of parameters that are 0 is 0, the converse isn't true. Second, for a GLMM, we really should be talking about type-III tests not type-III sums of squares.
« Type-III tests are dependent on coding in the full-rank parametrization of linear (and similar) models used in R, to make the tests correspond to reasonable hypotheses. The invariance of type-II tests with respect to coding is attractive, but shouldn't distract from the fundamental issues, which are the hypotheses that are tested and the power of the tests. 
« Best,
«  John

                                Emmanuel CURIS
                                emmanuel.curis at parisdescartes.fr

Page WWW: http://emmanuel.curis.online.fr/index.html

More information about the R-sig-mixed-models mailing list