1
$\begingroup$

In a mixed effect model where the intercept is random effect and the slope is fixed effect (see the code below), I understand the output of summary(glmer(...)). But I do not understand coef(glmer(...)); it will output the intercept for each sample. In the example, how are those 100 intercepts estimated?

n <- 100
x <- runif(n,2,6)
a <- -3 
b <- 1.5
s <- 1
N <- 8
id <- 1:n
r  <- rnorm(length(x),0,s) # random factor
p <- function(x,a,b) exp(a+b*x)/(1+exp(a+b*x))
y <- rbinom(length(x), N, prob = p(x,a+r,b))

library(lme4)
model <- glmer(cbind(y,N-y)~x+(1|id),family=binomial)
summary(model)
coef(model) # output here is what I do not understand

# are they estimates for r?
rr <- coef(model)$id[,1]-summary(model)$coefficients[1,1]
plot(r,rr)

The likelihood of the model, I think, is:

\begin{align} L_{i} &= \int_{-\infty}^{\infty}f(y_i|N,a,b,r_{i})g(r_{i}|s)dr_{i} \\[5pt] L &= \prod_{i=1}^{n} L_{i} \end{align}

where f is binomial pmf and g is normal pdf. So r should be integrated out. The number of the parameters of this model is 3 (a, b, and s). Although it seems there are 100 intercepts estimated, they are not really considered the parameters of the model, I think. AIC(model) is -2*logLik(model)+3*2. I would like to know what method will give those 100 intercepts.

$\endgroup$
2
$\begingroup$

You included id as a random coefficient in your model and are allowing each intercept to vary by id.

For example, if id represents a person, then repeated observations were taken for this person. You expect the slope (x) to be the same for each person but you wish to allow the intercept to vary (because people have different starting points perhaps). The random intercept term is normally distributed with mean equal to the overall intercept and variance equal to the estimated variance.

coef(model) is giving you the estimated intercept for each id. However, in your example, all the random intercepts are about the same and this additional parameter is not needed.

$\endgroup$
  • $\begingroup$ It is difficult to comment here, so I will edit the question. $\endgroup$ – quibble May 23 '14 at 7:25
0
$\begingroup$

The estimation method is described in section 2.2 (from page 62) of Mixed-Effects Models in S and S-PLUS by Pinheiro and Bates (link). The function uses a least-squared method to obtain the values. If another estimation method is used, it can obtain MLEs, e.g. without the 100 intercepts in the example. The 100 intercept values in the example are byproducts of the specific estimation method.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.