Skip to content

using glmer with user-defined link function

3 messages · Douglas Bates, Ben Bolker

#
I tried to deal with this at one point to put in a negative
binomial model.  I, too, was hopeful that just
adding the name of my link function to the list
of allowed names would be all that was
needed. Unfortunately, the variance functions are
hard coded within the glmer code, so it will not be completely
trivial to do this ...

   Ben
vito muggeo wrote:
#
You can use a "quasi" family with separate specification of the link
and the variance function but there are only a limited number of
variance functions available.

The reason that the inverse link and the variance functions are
hard-coded in glmer is because the number of evaluations of these
functions is potentially much, much greater than the number of
evaluations involved in fitting a generalized linear model (glm).  As
always, it doesn't matter that much when you have a small to moderate
sample size but it does matter when you have large sample sizes and
for models like IRT (item response theory) models the sample size can
be large indeed (tens of millions is not uncommon since each answer by
each candidate constitutes a distinct response).  It is difficult to
design code that is both efficient on large data sets and is flexible
in terms of the model specification.  In this case I chose to go with
the ability to handle large data sets.

If you have a custom variance function of inverse link function that
you would like to use, you are welcome to contribute the code for
them.  See the C functions lme4_varFunc, lme4_muEta and lme4_devResid
in lme4/src/lmer.c for the currently available code.
On Tue, Oct 21, 2008 at 1:57 PM, Ben Bolker <bolker at ufl.edu> wrote:
#
The rationale certainly makes sense.

  Eventually I would like to add a negative binomial link
function, but that will (a) require some time and (b) require
me to write an additional loop around glmer that searches
for the MLE of the overdispersion parameter.  (I did look briefly
at the code, but I don't remember offhand whether it would
be hard to have a link function with an additional parameter.
Looking now at lme4_varFunc, it looks hard -- the function
takes only var (computed variance), mu (mean value), n (number
of samples), vTyp (variance model) -- no slot for a "theta"
or "k" parameter.)

  thanks
    Ben Bolker
Douglas Bates wrote: