2
$\begingroup$

I'm attempting to calculate adjusted means for a binomial outcome variable using a generalized linear mixed-effects regression analysis. I've got two interacting fixed factors and one random effect.

I've never had trouble doing this with lmer or clmm in R, but I get the sense that I'm making a mistake; I'm getting some strange values from lsmeans() (lsmeans package) with a GLMER model.

The question is: What is lsmeans returning in the lsmean column when you do this with a GLMER model?

It cannot be a percentage of individuals at level 1 (like what the result of averaging all of the observations would be without random effects) because values greater than 1 are returned.

here's a reproducible example

require(lme4) 
require(lsmeans)

model <- glmer(dv ~ fixed1 * fixed2 + (1|random),  
  data = df, family = binomial)
summary(model)
lsmeans(model, 'fixed1', by = 'fixed2')

and the result looks like this:

eg_type = full:
 train_cond    lsmean        SE df asymp.LCL asymp.UCL
 classify   1.4511796 0.1232138 NA 1.2096850  1.692674
 switch     0.8621281 0.1195494 NA 0.6278155  1.096441
eg_type = partial:
 train_cond    lsmean        SE df asymp.LCL asymp.UCL
 classify   1.2388261 0.1195960 NA 1.0044222  1.473230
 switch     1.0456869 0.1180998 NA 0.8142155  1.277158
Results are given on the logit scale. 
Confidence level used: 0.95 

As you can see, there's no way the values in the lsmean column can be the adjusted means for proportions of a binary outcome variable, also df return as NA. I'm assuming this is an error with my understanding of this function + GLMER so any stats advice is greatly appreciated.

$\endgroup$
4
  • $\begingroup$ do you think bootstrapping would be a good way to calculate the adjusted proportions? e.g., stats.stackexchange.com/questions/135255/… $\endgroup$
    – ghonke
    Jan 23, 2016 at 0:33
  • 1
    $\begingroup$ This is pretty well documented in the help pages and vignette. It uses the linear-predictor scale by default (e.g., logit). You can get the estimated proportions via lsmeans(..., type = "response"). On another matter, please learn how to format your code in your question so it is readable. For displayed output, that entails using the {} widget in the compose window. $\endgroup$
    – Russ Lenth
    Jan 23, 2016 at 2:50
  • $\begingroup$ PS the df are displayed as NA when asymptotic methods are used ($z$s instead of $t$s). $\endgroup$
    – Russ Lenth
    Jan 23, 2016 at 2:53
  • $\begingroup$ Now that the output is readable, I can also point out the annotation that has been there all along: "Results are given on the logit scale." $\endgroup$
    – Russ Lenth
    Jan 24, 2016 at 1:44

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.