strengejacke / sjPlot

sjPlot - Data Visualization for Statistics in Social Science
https://strengejacke.github.io/sjPlot
608 stars 92 forks source link

plotting Conditional Model (simplex parameters) #702

Open Pietro-DAmelio opened 4 years ago

Pietro-DAmelio commented 4 years ago

Dear Sir/Madame,

I am using "plot_model" for a brms model with ordinal(monotonic) factor. The latest version of SJPlot 2.8.5 "plot_model" automatically include a facet called Conditional Model (simplex parameters) with the variance of the levels of the monotonic variable. There is no documentation on how to remove the facet "Conditional Model (simplex parameters)" from the plot (I have tried the "rm.terms" argument without success). How can it be done? It would be good to add it to the Sjplot package documentation where the words "simplex", "ordinal" and "monotonic" are not mentioned.

Thanks for your fantastic package! Cheers

Pietro-DAmelio commented 4 years ago

The second panel can be removed using the argument "rm.terms = " and specifying each single level of your factor. Pay attention to the names of the levels that are automatically renamed by the software (at least if you are using brms).

It would be useful to have an argument to avoid to plot the Conditional Model (simplex parameters) entirely.

strengejacke commented 4 years ago

Do you have a small reproducible example? I may take a closer look...

Pietro-DAmelio commented 4 years ago

Sorry for the delay and thank you for following up...

here it is:

library(sjPlot)
library(brms)

a<- rnorm(50, 5, 1)
b<- rnorm(50, 5, 1)
c<- c(rep(1,10), rep(2, 10), rep(3,10), rep(4,10), rep(5,10))

d<-data.frame(a,b,c)

mod=brms::brm(a~b+ mo(c),
              iter = 1000,
              cores = 4,
              data = d)

plot_model(mod,ci.style="whisker")

The only way I found to remove the second panel from the plot is to remove each level (which get a odd name)

plot_model(mod,ci.style="whisker",rm.terms = c("simo_moc1.1.",
             "simo_moc1.2.",
             "simo_moc1.3.",
             "simo_moc1.4.",
             "simo_moc1.5."))