easystats/see

show_intercept = FALSE doesn't work for brms ordinal models

rbcavanaugh opened this issue · 5 comments

Perhaps this is intentional, but I have would like to only show the non-intercepts for an cumulative probit model from brms. show_intercept doesn't seem to work here though. As usual - thanks for a fantastic suite of packages.

library(brms)
library(easystats)
iris$Petal.Length_fct = round(iris$Petal.Length)

model <- brm(Petal.Length_fct ~ a_Petal.Width * Species,
             family = cumulative("probit"),
             data = iris,
             chains = 1,
             cores = 1,
             backend = "cmdstan")

result <- p_direction(model)
plot(result, priors = TRUE, show_intercept = FALSE)

image

 sessioninfo::session_info()
─ Session info ───────────────────────────────────────────────────────────────────────────────────────
 setting  value
 version  R version 4.3.0 (2023-04-21)
 os       macOS Monterey 12.6.6
 system   aarch64, darwin20
 ui       RStudio
 language (EN)
 collate  en_US.UTF-8
 ctype    en_US.UTF-8
 tz       America/New_York
 date     2023-07-03
 rstudio  2023.06.0+421 Mountain Hydrangea (desktop)
 pandoc   3.1.1 @ /Applications/RStudio.app/Contents/Resources/app/quarto/bin/tools/ (via rmarkdown)

─ Packages ───────────────────────────────────────────────────────────────────────────────────────────
 package           * version date (UTC) lib source
 abind               1.4-5   2016-07-21 [1] CRAN (R 4.3.0)
 arrayhelpers        1.1-0   2020-02-04 [1] CRAN (R 4.3.0)
 askpass             1.1     2019-01-13 [1] CRAN (R 4.3.0)
 backports           1.4.1   2021-12-13 [1] CRAN (R 4.3.0)
 base64enc           0.1-3   2015-07-28 [1] CRAN (R 4.3.0)
 bayesplot           1.10.0  2022-11-16 [1] CRAN (R 4.3.0)
 bayestestR        * 0.13.1  2023-04-07 [1] CRAN (R 4.3.0)
 bridgesampling      1.1-2   2021-04-16 [1] CRAN (R 4.3.0)
 brms              * 2.19.0  2023-03-14 [1] CRAN (R 4.3.0)
 Brobdingnag         1.2-9   2022-10-19 [1] CRAN (R 4.3.0)
 callr               3.7.3   2022-11-02 [1] CRAN (R 4.3.0)
 checkmate           2.2.0   2023-04-27 [1] CRAN (R 4.3.0)
 cli                 3.6.1   2023-03-23 [1] CRAN (R 4.3.0)
 cmdstanr            0.5.3   2023-06-16 [1] local
 coda                0.19-4  2020-09-30 [1] CRAN (R 4.3.0)
 codetools           0.2-19  2023-02-01 [1] CRAN (R 4.3.0)
 colorspace          2.1-0   2023-01-23 [1] CRAN (R 4.3.0)
 colourpicker        1.2.0   2022-10-28 [1] CRAN (R 4.3.0)
 correlation       * 0.8.4   2023-04-06 [1] CRAN (R 4.3.0)
 crayon              1.5.2   2022-09-29 [1] CRAN (R 4.3.0)
 crosstalk           1.2.0   2021-11-04 [1] CRAN (R 4.3.0)
 crul                1.4.0   2023-05-17 [1] CRAN (R 4.3.0)
 curl                5.0.1   2023-06-07 [1] CRAN (R 4.3.0)
 data.table          1.14.8  2023-02-17 [1] CRAN (R 4.3.0)
 datawizard        * 0.8.0   2023-06-16 [1] CRAN (R 4.3.0)
 digest              0.6.31  2022-12-11 [1] CRAN (R 4.3.0)
 distributional      0.3.2   2023-03-22 [1] CRAN (R 4.3.0)
 dplyr             * 1.1.2   2023-04-20 [1] CRAN (R 4.3.0)
 DT                  0.28    2023-05-18 [1] CRAN (R 4.3.0)
 dygraphs            1.1.1.6 2018-07-11 [1] CRAN (R 4.3.0)
 easystats         * 0.6.0   2022-11-29 [1] CRAN (R 4.3.0)
 effectsize        * 0.8.3   2023-01-28 [1] CRAN (R 4.3.0)
 ellipsis            0.3.2   2021-04-29 [1] CRAN (R 4.3.0)
 evaluate            0.21    2023-05-05 [1] CRAN (R 4.3.0)
 fansi               1.0.4   2023-01-22 [1] CRAN (R 4.3.0)
 farver              2.1.1   2022-07-06 [1] CRAN (R 4.3.0)
 fastmap             1.1.1   2023-02-24 [1] CRAN (R 4.3.0)
 flextable         * 0.9.1   2023-04-02 [1] CRAN (R 4.3.0)
 fontBitstreamVera   0.1.1   2017-02-01 [1] CRAN (R 4.3.0)
 fontLiberation      0.1.0   2016-10-15 [1] CRAN (R 4.3.0)
 fontquiver          0.2.1   2017-02-01 [1] CRAN (R 4.3.0)
 forcats           * 1.0.0   2023-01-29 [1] CRAN (R 4.3.0)
 gdtools             0.3.3   2023-03-27 [1] CRAN (R 4.3.0)
 generics            0.1.3   2022-07-05 [1] CRAN (R 4.3.0)
 gfonts              0.2.0   2023-01-08 [1] CRAN (R 4.3.0)
 ggdist              3.3.0   2023-05-13 [1] CRAN (R 4.3.0)
 ggplot2           * 3.4.2   2023-04-03 [1] CRAN (R 4.3.0)
 ggridges            0.5.4   2022-09-26 [1] CRAN (R 4.3.0)
 glue                1.6.2   2022-02-24 [1] CRAN (R 4.3.0)
 gridExtra           2.3     2017-09-09 [1] CRAN (R 4.3.0)
 gtable              0.3.3   2023-03-21 [1] CRAN (R 4.3.0)
 gtools              3.9.4   2022-11-27 [1] CRAN (R 4.3.0)
 here              * 1.0.1   2020-12-13 [1] CRAN (R 4.3.0)
 hms                 1.1.3   2023-03-21 [1] CRAN (R 4.3.0)
 htmltools           0.5.5   2023-03-23 [1] CRAN (R 4.3.0)
 htmlwidgets         1.6.2   2023-03-17 [1] CRAN (R 4.3.0)
 httpcode            0.3.0   2020-04-10 [1] CRAN (R 4.3.0)
 httpuv              1.6.11  2023-05-11 [1] CRAN (R 4.3.0)
 igraph              1.4.3   2023-05-22 [1] CRAN (R 4.3.0)
 inline              0.3.19  2021-05-31 [1] CRAN (R 4.3.0)
 insight           * 0.19.3  2023-06-29 [1] CRAN (R 4.3.0)
 jsonlite            1.8.5   2023-06-05 [1] CRAN (R 4.3.0)
 knitr               1.43    2023-05-25 [1] CRAN (R 4.3.0)
 labeling            0.4.2   2020-10-20 [1] CRAN (R 4.3.0)
 later               1.3.1   2023-05-02 [1] CRAN (R 4.3.0)
 lattice             0.21-8  2023-04-05 [1] CRAN (R 4.3.0)
 lifecycle           1.0.3   2022-10-07 [1] CRAN (R 4.3.0)
 loo                 2.6.0   2023-03-31 [1] CRAN (R 4.3.0)
 lubridate         * 1.9.2   2023-02-10 [1] CRAN (R 4.3.0)
 magrittr            2.0.3   2022-03-30 [1] CRAN (R 4.3.0)
 markdown            1.7     2023-05-16 [1] CRAN (R 4.3.0)
 Matrix              1.5-4   2023-04-04 [1] CRAN (R 4.3.0)
 matrixStats         1.0.0   2023-06-02 [1] CRAN (R 4.3.0)
 mime                0.12    2021-09-28 [1] CRAN (R 4.3.0)
 miniUI              0.1.1.1 2018-05-18 [1] CRAN (R 4.3.0)
 modelbased        * 0.8.6   2023-01-13 [1] CRAN (R 4.3.0)
 munsell             0.5.0   2018-06-12 [1] CRAN (R 4.3.0)
 mvtnorm             1.2-2   2023-06-08 [1] CRAN (R 4.3.0)
 nlme                3.1-162 2023-01-31 [1] CRAN (R 4.3.0)
 officer           * 0.6.2   2023-03-28 [1] CRAN (R 4.3.0)
 openssl             2.0.6   2023-03-09 [1] CRAN (R 4.3.0)
 parameters        * 0.21.1  2023-05-26 [1] CRAN (R 4.3.0)
 patchwork         * 1.1.2   2022-08-19 [1] CRAN (R 4.3.0)
 performance       * 0.10.4  2023-06-02 [1] CRAN (R 4.3.0)
 pillar              1.9.0   2023-03-22 [1] CRAN (R 4.3.0)
 pkgbuild            1.4.1   2023-06-14 [1] CRAN (R 4.3.0)
 pkgconfig           2.0.3   2019-09-22 [1] CRAN (R 4.3.0)
 plyr                1.8.8   2022-11-11 [1] CRAN (R 4.3.0)
 posterior           1.4.1   2023-03-14 [1] CRAN (R 4.3.0)
 prettyunits         1.1.1   2020-01-24 [1] CRAN (R 4.3.0)
 processx            3.8.1   2023-04-18 [1] CRAN (R 4.3.0)
 promises            1.2.0.1 2021-02-11 [1] CRAN (R 4.3.0)
 ps                  1.7.5   2023-04-18 [1] CRAN (R 4.3.0)
 purrr             * 1.0.1   2023-01-10 [1] CRAN (R 4.3.0)
 R6                  2.5.1   2021-08-19 [1] CRAN (R 4.3.0)
 ragg                1.2.5   2023-01-12 [1] CRAN (R 4.3.0)
 Rcpp              * 1.0.10  2023-01-22 [1] CRAN (R 4.3.0)
 RcppParallel        5.1.7   2023-02-27 [1] CRAN (R 4.3.0)
 readr             * 2.1.4   2023-02-10 [1] CRAN (R 4.3.0)
 report            * 0.5.7   2023-03-22 [1] CRAN (R 4.3.0)
 reshape2            1.4.4   2020-04-09 [1] CRAN (R 4.3.0)
 rlang               1.1.1   2023-04-28 [1] CRAN (R 4.3.0)
 rmarkdown           2.22    2023-06-01 [1] CRAN (R 4.3.0)
 rprojroot           2.0.3   2022-04-02 [1] CRAN (R 4.3.0)
 rstan               2.21.8  2023-01-17 [1] CRAN (R 4.3.0)
 rstantools          2.3.1   2023-03-30 [1] CRAN (R 4.3.0)
 rstudioapi          0.14    2022-08-22 [1] CRAN (R 4.3.0)
 scales              1.2.1   2022-08-20 [1] CRAN (R 4.3.0)
 see               * 0.8.0   2023-06-05 [1] CRAN (R 4.3.0)
 sessioninfo         1.2.2   2021-12-06 [1] CRAN (R 4.3.0)
 shiny               1.7.4   2022-12-15 [1] CRAN (R 4.3.0)
 shinyjs             2.1.0   2021-12-23 [1] CRAN (R 4.3.0)
 shinystan           2.6.0   2022-03-03 [1] CRAN (R 4.3.0)
 shinythemes         1.2.0   2021-01-25 [1] CRAN (R 4.3.0)
 StanHeaders         2.26.26 2023-05-30 [1] CRAN (R 4.3.0)
 stringi             1.7.12  2023-01-11 [1] CRAN (R 4.3.0)
 stringr           * 1.5.0   2022-12-02 [1] CRAN (R 4.3.0)
 svUnit              1.0.6   2021-04-19 [1] CRAN (R 4.3.0)
 systemfonts         1.0.4   2022-02-11 [1] CRAN (R 4.3.0)
 tensorA             0.36.2  2020-11-19 [1] CRAN (R 4.3.0)
 textshaping         0.3.6   2021-10-13 [1] CRAN (R 4.3.0)
 threejs             0.3.3   2020-01-21 [1] CRAN (R 4.3.0)
 tibble            * 3.2.1   2023-03-20 [1] CRAN (R 4.3.0)
 tidybayes           3.0.4   2023-03-14 [1] CRAN (R 4.3.0)
 tidyr             * 1.3.0   2023-01-24 [1] CRAN (R 4.3.0)
 tidyselect          1.2.0   2022-10-10 [1] CRAN (R 4.3.0)
 tidyverse         * 2.0.0   2023-02-22 [1] CRAN (R 4.3.0)
 timechange          0.2.0   2023-01-11 [1] CRAN (R 4.3.0)
 tzdb                0.4.0   2023-05-12 [1] CRAN (R 4.3.0)
 utf8                1.2.3   2023-01-31 [1] CRAN (R 4.3.0)
 uuid                1.1-0   2022-04-19 [1] CRAN (R 4.3.0)
 vctrs               0.6.2   2023-04-19 [1] CRAN (R 4.3.0)
 withr               2.5.0   2022-03-03 [1] CRAN (R 4.3.0)
 xfun                0.39    2023-04-20 [1] CRAN (R 4.3.0)
 xml2                1.3.4   2023-04-27 [1] CRAN (R 4.3.0)
 xtable              1.8-4   2019-04-21 [1] CRAN (R 4.3.0)
 xts                 0.13.1  2023-04-16 [1] CRAN (R 4.3.0)
 zip                 2.3.0   2023-04-17 [1] CRAN (R 4.3.0)
 zoo                 1.8-12  2023-04-13 [1] CRAN (R 4.3.0)

 [1] /Library/Frameworks/R.framework/Versions/4.3-arm64/Resources/library

──────────────────────────────────────────────────────────────────────────────────────────────────────

Adding that - if priors is set to TRUE, then filtering using the Parameters argument of p_direction doesn't work as a solution (which is my actual use case...)

model <- brm(Petal.Length_fct ~ Petal.Width * Species,
             family = cumulative("probit"),
             data = iris,
             chains = 1,
             cores = 1,
             prior = prior(normal(0, 2), class = "b"),
             backend = "cmdstan")

result <- p_direction(model, parameters = "Species")
plot(result, priors = TRUE, show_intercept = FALSE)

image

thanks! this is just a bug in the detection of intercept parameter names. will fix

The second example is an issue with the prior layer not correctly inheriting the parameters argument from parameters(). That is also fixed in #298.

These are fixed on the main branch now @rbcavanaugh

Thank you so much!!