[R-sig-ME] Logistic and nonlinear mixed models: Accounting for guessing probability

Douglas Bates bates at stat.wisc.edu
Thu Sep 30 22:42:39 CEST 2010


On Thu, Sep 30, 2010 at 3:29 PM, Douglas Bates <bates at stat.wisc.edu> 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).

Actually the whole design of the glm families should be reconsidered
but we'll save that for another time.

> On Mon, Sep 27, 2010 at 11:25 AM, Manuel Morales
> <Manuel.A.Morales at williams.edu> wrote:
>> I found this link doing a search for your error message on Google:
>> https://stat.ethz.ch/pipermail/r-sig-mixed-models/2007q4/000408.html
>>
>> Following the recipe:
>> grModel <- function(x,y,a,b,c,d) .33 + .67*(exp(log(x)*a+y*b+log(x)*y*c
>> + d))/
>>  (1+exp( log(x)*a + y*b +log(x)*y*c + d))
>>
>> grModg <- deriv(body(grModel), namevec = c("a","b","c","d"),
>> function.arg=grModel)
>>
>> mod3 <- nlmer(Correct~grModg(Concentrat,Test,a,b,c,d)~(Test|Code),
>>              start = c(a = 0.115, b=-0.1, c=0.65, d=-3),
>>              data = rawdata)
>> Which appears to work.
>>
>> My messages haven't been posted to R, so you may want to post again with
>> this solution if it works for you.
>>
>> Best,
>>
>> Manuel
>>
>> On Mon, 2010-09-27 at 15:54 +0200, Robert Miller wrote:
>>> Hello everyone,
>>>
>>> Recently i tried to predict the discrimination probability of a chemosignal
>>> by its concentration and an experimental manipulation factor (term:
>>> concentration*x + test*b + concentration*test*c + d) with nested factor
>>> "manipulation" within "participants". For statistical analysis i needed to
>>> incorporate a fixed guessing probability into my model (similiar to a 3-PL
>>> IRT model) resulting in the following equation:
>>>
>>> P(correct) = 0.33 + 0.67*(exp(term)/(1 + exp(term)))
>>>
>>> As i found no way to do so via the glmer()-function of the lme4-package, i
>>> tried to use nlmer() but unfortunately even the simplest analysis with just
>>> the concentration factor and intercept resulted in cryptic error messages.
>>>
>>> Syntax:
>>> library(lme4)
>>> rawdata <- read.csv2("http://dl.dropbox.com/u/7147679/AND_data.csv")
>>>
>>> mod1 <- glmer(Correct ~ log(Concentrat) * Test + (Test|Code), family =
>>> binomial, data=rawdata) #works fine but is inappropriate
>>> mod2 <- nlmer(Correct ~ .33 + .67*(exp(log(Concentrat)*a+d))
>>> /(1+exp(log(Concentrat)*a+d)) ~ (Test|Code), start = c(a = 0.1, d = -3),
>>> data = rawdata) #doesnt work
>>> mod3 <- nlmer(Correct ~ .33 + .67*(exp(log(Concentrat)*a + Test*b +
>>> log(Concentrat)*Test*c + d))/(1+exp( log(Concentrat)*a + Test*b +
>>> log(Concentrat)*Test*c + d)) ~ (Test|Code), start = c(a = 0.115,b = -0.05,
>>> c= 0.065, d= -3), data = rawdata) #doesnt work either
>>>
>>> Even without specifying random effects nls() doesnt work, but brute force
>>> ML-parameter estimation on the aggregated data produces reasonable results.
>>>
>>> Right now I'm quite desperate and would appreciate any help.
>>> Thank you
>>> Robert Miller
>>>
>>> _______________________________________________
>>> R-sig-mixed-models at r-project.org mailing list
>>> https://stat.ethz.ch/mailman/listinfo/r-sig-mixed-models
>>
>> --
>> http://mutualism.williams.edu
>>
>> _______________________________________________
>> R-sig-mixed-models at r-project.org mailing list
>> https://stat.ethz.ch/mailman/listinfo/r-sig-mixed-models
>>
>




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