Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

customize facet direction in plot.parameters_model #279

Closed
madebyafox opened this issue Mar 27, 2023 · 3 comments
Closed

customize facet direction in plot.parameters_model #279

madebyafox opened this issue Mar 27, 2023 · 3 comments

Comments

@madebyafox
Copy link

Would be LOVELY if users could customize the facet direction (i.e. rows vs columns) in the see plot() functions that render coefficients for multiple equations. (eg. multinomial regressions)

see sample of default in sjPlot (facet column-wise) vs plot(model_parameters) (facet row-wise)
perhaps also worth considering adding option of keeping scale the same across the plots (thus rendering plots with difference sizes)? As seen in this example, vertical visual comparison across parameters here is dangerous due to differences in scale across the row-wise facets

REPREX

library(mclogit)
#> Loading required package: Matrix
library(easystats)
#> Warning: package 'easystats' was built under R version 4.2.3
#> # Attaching packages: easystats 0.6.0.8
#> ✔ bayestestR  0.13.0.10   ✔ correlation 0.8.3.3  
#> ✔ datawizard  0.7.0.5     ✔ effectsize  0.8.3.6  
#> ✔ insight     0.19.1.2    ✔ modelbased  0.8.6.3  
#> ✔ performance 0.10.2.7    ✔ parameters  0.20.2.14
#> ✔ report      0.5.7.1     ✔ see         0.7.5.1
library(sjPlot)

#CREATE MIXED MULTINOMIAL LOGISTIC REGRESSION MODEL
pict  <- base::readRDS(url("https://slcladal.github.io/data/pict.rda", "rb"))
m1.mn <- mblogit(formula = Response ~ Gender + Group,
              random = ~ 1 | Item,
              data = pict)
#> 
#> Iteration 1 - deviance = 1667.891 - criterion = 0.8014916
#> Iteration 2 - deviance = 1576.67 - criterion = 0.08187338
#> Iteration 3 - deviance = 1550.621 - criterion = 0.03072031
#> Iteration 4 - deviance = 1541.316 - criterion = 0.009764653
#> Iteration 5 - deviance = 1537.509 - criterion = 0.002514804
#> Iteration 6 - deviance = 1536.103 - criterion = 0.000306996
#> Iteration 7 - deviance = 1535.722 - criterion = 4.709478e-05
#> Iteration 8 - deviance = 1535.593 - criterion = 7.320379e-06
#> Iteration 9 - deviance = 1535.547 - criterion = 1.195585e-06
#> Iteration 10 - deviance = 1535.529 - criterion = 1.993986e-07
#> Iteration 11 - deviance = 1535.522 - criterion = 3.342435e-08
#> Iteration 12 - deviance = 1535.519 - criterion = 5.601294e-09
#> converged

#SEE 
## stacked 3 rows 
mp <- model_parameters(m1.mn, exponentiate = T)
plot(mp, stack=F)

#SJPLOT
## across 3 columns
plot_model(m1.mn)

Created on 2023-03-27 with reprex v2.0.2

@strengejacke
Copy link
Member

You need the n_column argzument: plot(mp, stack=FALSE, n_column = 3)

@strengejacke
Copy link
Member

Does this solve your issue?

@strengejacke
Copy link
Member

If the above solution doesn't work for you, please re-open this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants