jacob-long / panelr

Regression models and utilities for repeated measures and panel data
Other
99 stars 21 forks source link

`sjPlot` and `wblm` objects #59

Open smoser11 opened 1 year ago

smoser11 commented 1 year ago

I'm very sorry if I'm being dense, but I use to be able to use sjPlot to visualize fit models from wbm() back in 2019. But I cannot any more, instead getting the error:

Error in `purrr::map2()`:
ℹ In index: 1.
ℹ With name: mm.
Caused by error in `.mixed_model_parameters_generic()`:
! formal argument "ci_method" matched by multiple actual arguments
Backtrace:
  1. sjPlot::tab_model(mm, mm.Bexp, mm11.Bexp)
  2. purrr::map2(...)
  3. purrr:::map2_("list", .x, .y, .f, ..., .progress = .progress)
  7. sjPlot (local) .f(.x[[i]], .y[[i]], ...)
  8. sjPlot:::tidy_model(...)
 10. parameters:::model_parameters.wbm(...)

Here is a MWE:

library(devtools) 
devtools::install_github("strengejacke/sjlabelled")
devtools::install_github("strengejacke/sjmisc")
devtools::install_github("strengejacke/sjstats")
devtools::install_github("strengejacke/ggeffects")
devtools::install_github("strengejacke/sjPlot")

library(panelr)
data("WageData")
wages <- panel_data(WageData, id = id, wave = t)
mm.Bexp <- wbm(lwage ~ exp +  wks + union + ms + occ | ed + blk + fem | blk*exp + (1 | id), data = wages) 

library(sjPlot)  # install.packages("sjPlot")
tab_model(mm.Bexp)
plot_model(mm.Bexp) 

But see the HTML file generated from Rmarkdown in 2019 (specifically section 3.2.4) in which sjPlot accepts a wbm object and plots it correctly. I tried using older versions of bothpanelr and sjPlot, but I cannot plot the within and between estimates from a fit wbm object. What am I missing?

Sorry and thanks.

image