Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

emmeans:emmip_ggplot error "Error in emms$LCL : $ operator not defined for this S4 class"

I’m trying the emmip_ggplot with this example

n.emms <- emmeans(neuralgia.glm, ~ Treatment)

emmip_ggplot(n.emms, style = "factor")
Error in emms$LCL : $ operator not defined for this S4 class

emmip(neuralgia.glm, ~Treatment) gives a traditional plot, without error or warning.

enter image description here

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

Thanks for stopping by.

>Solution :

?emmip_ggplot says the first argument to emmip_ggplot should be

A ‘data.frame’ created by calling ‘emmip’ with ‘plotit =
FALSE’. Certain variables and attributes are expected to
exist in this data frame; see the section detailing the
rendering functions.

Thus

m1 <- glm(vs~hp+disp+drat, family = binomial, mtcars)
em1 <- emmeans(m1, ~ disp * hp, at = list(hp = 50:300))
em2 <- emmip(em1, disp ~ hp, plotit = FALSE)
emmip_ggplot(em2)

This works (i.e. produces a plot) but I’m not sure it makes sense, as I threw the example together in a hurry.

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading