[R-sig-ME] Logistic and nonlinear mixed models: Accounting for guessing probability
Ken Knoblauch
ken.knoblauch at inserm.fr
Fri Oct 1 08:33:32 CEST 2010
Douglas Bates <bates at ...> writes:
>
> On Thu, Sep 30, 2010 at 3:29 PM, Douglas Bates <bates at ...>
wrote:
> > Unfortunately an nlmer model is not appropriate for a binary
response,
> > because it doesn't appropriately weight the residuals.
> >
> > Incorporating a non-zero guessing parameter requires a
generalized
> > nonlinear mixed model if you need to estimate the guessing
parameter.
> > The long term plan is to allow such a model. This is the
reason that
> > Martin and I worked on factoring out the internal code
dealing with
> > different kinds of models for the expected response.
Nonlinear
models
> > affect these in one way and generalized linear models
in another
so
> > you need to chain these effects.
> >
> > For the particular case that Robert is considering, in
which the
> > guessing parameter is fixed at 0.33 I think it may be
possible to use
> > the mafc.logit link from the psyphy package with lme4a, the
> > development version of lme4. I am currently installing the
necessary
> > packages to see if I can make it work. My thanks to Robert
for making
> > the data available so we can test it.
>
> It wasn't as easy as I had hoped it would be. I'm getting
an error
> when evaluating the linkfun (and, presumably, will get
such an error
> for all the other functions in the family). It probably has
to do
> with the environment in which the function is evaluated
in that it
> can't see the value of 'm'.
>
> I'm not sure if I will be able to fix it in a reasonable
amount of
> time (I should be grading assignments from one of
my classes right
> now).
First, let me say thanks for putting some time into this issue,
though I can hear you; it's time that you don't have.
If either you are Martin can suggest some way that I could modify
the mafc functions in psyphy to make m visible, I would be
happy to change them, provided they still work with glm, or I would
just define special ones for mixed effects models, but that wouldn't
be as efficient. For example, I would think that defining functions with
fixed m for 2, 3, and 4 (and possibly 8) would cover about 99% of
the cases in my field, but I can't speak for others. In fact, would the
following work for the case m = 3 in your modified code,
mafc.logit3 <- function ()
{
linkfun <- function(mu) {
mu <- pmax(mu, 1/3 + .Machine$double.eps)
qlogis((3 * mu - 1)/2)
}
linkinv <- function(eta) {
1/3 + (2/3) * .Call("logit_linkinv", eta, PACKAGE = "stats")
}
mu.eta <- function(eta) (2/3) * .Call("logit_mu_eta",
eta, PACKAGE = "stats")
valideta <- function(eta) TRUE
link <- paste("mafc.logit()", sep = "")
structure(list(linkfun = linkfun, linkinv = linkinv, mu.eta = mu.eta,
valideta = valideta, name = link), class = "link-glm")
}
Finally, there is also the ecc2 data set in the psyphy package, if you
need another data set for testing. It is from a 4-alternative experiment
in which an obtserver had to choose between 1 of 4 positions at which a
low contrast letter appeared and then identify it as 1 of 4 possible letters.
It gives the aggrergated proportion correct, not the individual binary
responses, but I could dig them out (I still have all that data), if binary
responses were preferred.
Good luck.
best,
Ken
--
Ken Knoblauch
Inserm U846
Stem-cell and Brain Research Institute
Department of Integrative Neurosciences
18 avenue du Doyen Lépine
69500 Bron
France
tel: +33 (0)4 72 91 34 77
fax: +33 (0)4 72 91 34 61
portable: +33 (0)6 84 10 64 10
http://www.sbri.fr/members/kenneth-knoblauch.html
More information about the R-sig-mixed-models
mailing list