[R-sig-ME] Mixed-effects conditional logistic regression in lme4 v. 1.0-4 and above

Ben Bolker bbolker at gmail.com
Fri May 2 03:39:16 CEST 2014


Javan Bauder <javanvonherp at ...> writes:

> 

 [snip]
 
> The analysis I am running is a mixed-effects conditional logistic
> regression. My colleagues and I are using these models to conduct
> habitat selection analyses with wildlife telemetry data where each
> telemetry point is paired with a measure of availability unique to
> that point. We then difference the value of our independent variable
> at the telemetry point (used) with the measure of availability for
> that variable and fit a no-intercept logistic regression model to
> those differences and use individual animal as a random slope effect.
> We have used the following model structure:

lmer(1 ~ −1+diff100+…(-1+diff100+…|Individual), 
   data=data, family=‘binomial’)

Do you *really* have a 1 on the left-hand side of the formula?
It's hard for me to even understand what this mean/what kind of
sensible results this would produce ...

> Whenever we have used this specification in the newer versions of lme4
> (v 1.0-4 and above) we receive an error. For example, when using lmer
> and lme4 v 1.0-4, I receive the following:
> 

[snip lmer example -- no real reason to even try that at this point]

> When we try using glmer we receive the following error:
>

mod1 <- glmer(status~-1+Density+(-1+Density|Name),
   data=input,family='binomial',weights=Weight)

> Error in function (fr, X, reTrms, family, nAGQ = 1L, verbose = 0L,
> control = glmerControl(),  :
>   Response is constant - cannot fit the model


I guess I don't understand your example sufficiently well.
This error should only be triggered when there is only a single
unique value of the response variable, and I can't figure out
why that should happen in your case.  Can you provide a reproducible
example?  The following trivial example works, but I guess it doesn't
look like your data ...

set.seed(101)
input <- expand.grid(Density=1:20,Name=factor(1:20))
input$status <- rbinom(nrow(input),size=1,prob=0.5)

library(lme4)
mod1 <- glmer(status~-1+Density+(-1+Density|Name),
   data=input,family='binomial')

                     
> Do you know of any ways to run this type of model structure in the new
> versions of lme4 (or any other R package)? We would really appreciate
> any insights you could provide.

  Can you point me to a reference for this type of model?
If I can convince myself that it ever makes sense to allow a model
with a constant response value, we could allow an option to glmerControl
to override/ignore the test for unique values

  Also note that conditional logits are _not_ quite the same thing
as a regular logit model -- see

https://stat.ethz.ch/pipermail/r-sig-mixed-models/2011q2/016030.html
http://data.princeton.edu/wws509/notes/c6s3.html

  There is probably a way to set this up with the machinery of
lme4, but I haven't thought it through -- add it to the ridiculously
long list of things I think are possible but haven't had the time
to work out.

  Ben Bolker



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