I need to create a plot from a glmer model, and I tried to use EMMIP function for this:

model<-glmer(Accuracy ~ day, dataframe, family = 'binomial')
emmip(model, ~ day, xlab = "day", ylab = "Accuracy", main = "XXX")

Although it produces a seemingly accurate plot, it has a strange y-axis labelling. It is strange because I want it to be mean percentage of accuracy, but it shows definitely something else. It is interesting that when I use emmip() with an ANOVA model I don't have this problem. Does anybody know if there is anything I could do to have accurate information on y-axis?

  • $\begingroup$ can you tell us what kind of plot this is supposed to be, and what package the emmip() function comes from? $\endgroup$ – Ben Bolker Aug 25 '18 at 23:36

You probably need type="response"; the default is to make predictions on the linear predictor scale, which for a binomial model is the logit or log-odds scale.

From ?emmeans:emmip:

type: As in ‘predict.emmGrid’, this determines whether we want to inverse-transform the predictions (‘type = "response"’) or not (any other choice). The default is ‘"link"’, unless the ‘"predict.type"’ option is in force; see ‘emm_options’.

By the way, if we're being picky, this will be a proportion response (0-1), not a percentage (0-100); I don't know offhand if there's a way to multiply the prediction by 100.

  • $\begingroup$ Ben Bolker, thank you very much - the problem is solved!! $\endgroup$ – Tasha Aug 26 '18 at 9:25

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.