# [R-sig-ME] cloglog link in lmer

Sasha Goodman sashag at stanford.edu
Sun May 31 00:23:51 CEST 2009

```We have been using lme4 with a logit link and crossed random effects.
It works very nicely. However, because our outcome is very rare, we
are trying the cloglog link with lmer. The model simply does not run,
however. The errors is  "mu[i] must be in the range (0,1)". A google
search reveals no one else has ever posted this particular problem.

I'm sending the following details in case it helps the developers.
Advice is also welcomed.

Descriptives for the two variables:
Y: [0,1], ∈ R, E=0.007238727, SE=0.08477285, the binary response
X : [0.4318617,0.998886], ∈ R, E=0.9886799, SE=0.03572924, continuous
in the range  [0.4318617,0.998886]

## Crossed with cloglog fails
h = lmer(Y ~ X + (1 | i) + (1 | j) + (1|t), D2 ,family =
binomial(link="cloglog"),control = list(msVerbose = 1))
0:     5328.8713: 0.100868 0.0552843 0.00896829 -35.7191  31.0045
Error in mer_finalize(ans) :
mu[i] must be in the range (0,1): mu = 0, i = 253517704

## Crossed with logit works
h = lmer(Y ~ X + (1 | i) + (1 | j) + (1|t), D2 ,family =
binomial(link="logit"),control = list(msVerbose = 1))
summary(h)
Generalized linear mixed model fit by the Laplace approximation
Formula: Y ~ X + (1 | i) + (1 | j) + (1 | t)
Data: D2
AIC  BIC logLik deviance
1797 1843 -893.5     1787
Random effects:
Groups Name        Variance Std.Dev.
j      (Intercept)  17.9346  4.2349
i      (Intercept) 126.9971 11.2693
t      (Intercept)   2.6644  1.6323
Number of obs: 66310, groups: j, 253; i, 76; t, 2

Fixed effects:
Estimate Std. Error z value Pr(>|z|)
(Intercept)   -81.38      19.29  -4.219 2.46e-05 ***
X                  60.91      19.26   3.162  0.00157 **
---
Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1

## Simple GLM with the same data runs perfectly
h = glm(Y ~ X , D2 ,family = binomial(link="cloglog"))

glm(formula = Y ~ X, family = binomial(link = "cloglog"),
data = D2)

Deviance Residuals:
Min       1Q   Median       3Q      Max
-0.1316  -0.1271  -0.1270  -0.1212   3.9149

Coefficients:
Estimate Std. Error z value Pr(>|z|)
(Intercept)  -35.719      6.833  -5.228 1.72e-07 ***
X               31.004      6.869   4.514 6.37e-06 ***
---
Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1

(Dispersion parameter for binomial family taken to be 1)

Null deviance: 5687.7  on 66309  degrees of freedom
Residual deviance: 5643.9  on 66308  degrees of freedom
AIC: 5647.9

Number of Fisher Scoring iterations: 10

--
Sasha Goodman
Doctoral Student, Organizational Behavior
Office: 1 (650) 492-4892
Skype: goodmansasha
sashag at stanford.edu

```