[R-sig-ME] Multinomial models

Douglas Bates bates at stat.wisc.edu
Fri Feb 8 18:59:26 CET 2008

On Feb 7, 2008 8:16 PM, David Duffy <David.Duffy at qimr.edu.au> wrote:
> On Thu, 7 Feb 2008, Douglas Bates wrote:
> > I should have been more explicit.  One can use any of the families
> > defined in the stats package for R, including the quasi family.
> >
> > They could be extended but that would need a definition of inverse
> > link, the derivative of the inverse link and the variance function for
> > any new families that are to be incorporated.
> >
> Austin Frank asked
> >> Unsurprisingly, I'm wondering whether the above change will enable me to
> >> model a multinomial dependent variable using glmer.  Is this now
> >> possible?

> I can imagine a proportional odds/multiple threshold mixed model in lmer,
> but don't see how Gaussian distributed random effects could be included
> in a multinomial model without going to some type of a multivariate model.

Thanks, David.  That is pretty much what I was thinking but I didn't
know how to articulate it or whether it is just my lack of experience
with the models that leaves me unable to imagine how they could be fit
into the framework.

> To AF: May I ask how you currently deal with such data, LCA/LSA etc with
> latent categorical or continuous variables?

> To DB: Will lmer eventually allow multivariate models and arbitrary
> distributions for the random effects (eg mixtures of normals, other
> parametric distributions)?  Are they already in there somewhere ;)

I can imagine incorporating multivariate models at some point but not
non-Gaussian distributions of the random effects.  A multivariate
Gaussian distribution of the random effects is welded into lmer at a
very low level.

The thing that allows lmer to fit difficult models, such as those with
crossed or partially crossed random effects, to very large data sets
is a common representation of the model and a set of C functions that
manipulate that representation.  The common representation is the
"mer" class.  The critical calculation performed on these structures
when fitting a model is the evaluation of the conditional modes of the
random effects.  The performance of lmer, glmer and nlmer hinges on
being able to evaluate the conditional modes rapidly.

There is a simplification used in lmer because you don't really need
the conditional modes - you only need some of the properties of the
conditional modes.  That is why the evaluation of the deviance is
performed in the C function mer_update_RX.

However for glmer and nlmer models you need to evaluate the
conditional modes explicitly, which is done in the C function
mer_update_u.  If you compare the structure of that code to the
pseudo-code in Appendix A3.1 of Bates and Watts (Wiley, 1988),
"Nonlinear Regression Analysis and Its Applications" you will see that
I am up to my old tricks - apparently I haven't learned much over the
past 25 years :-).  Scratch the surface of that code and you will find
an iterative, penalized nonlinear least squares optimization with
re-weighting in the "generalized" cases.

The representation of the distribution of the random effects, which is
encoded in the ST slot, a list of matrices, and the Gp slot, an
integer vector of "group pointers", and the penalized least squares
criterion satisfied by the conditional modes are derived from the
multivariate normal distribution of the random effects.  If you want
to change that you would pretty much need to start from scratch
redesigning and rewriting the software and that won't be done by me

I view the mer class and the C functions whose names start with mer_
as the underlying engine that allows fitting of a variety of models
involving random effects by evaluating the deviance, or the Laplace
approximation to it, given the data and values of the parameters.  You
can wrap that engine in code that allows a multivariate response but
you can't easily modify the distribution of the random effects.

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