visibly icon indicating copy to clipboard operation
visibly copied to clipboard

plot_coefficients() brmsfit error

Open GLad-Arioch opened this issue 2 years ago • 3 comments

Hi Michael,

Using visibly to plot the coefficients of a brms.fit object, I get the following error message: "cannot xtfrm data frames"

I failed also to reproduce the example given in the vignette : plot_coefficients(fit_brms_two)

I get the same "cannot xtfrm data frames" error.

Am I missing a step?

Best regards,

Guillaume

GLad-Arioch avatar Oct 31 '23 09:10 GLad-Arioch

Hi @GLad-Arioch, thanks for reaching out! I think the main thing that's missing is any update to this package within the last few years. I did a quick check and can tell where this is happening, but I'm thinking that a fix to this would probably mean a fix for many other things would be required to get this package functioning after the change. That said, I might be able to do a branch with this specific fix so you could install that version if nothing else. Unfortunately I can't say when I'll be able to do it, but I'll update this when it happens.

m-clark avatar Oct 31 '23 18:10 m-clark

Thanks for this. I was a heavy user of the package :))

GGLuca avatar Jan 22 '24 13:01 GGLuca

I forgot to mention, the easystats package 'see' I think can do this now (and is much more developed). I highly recommend it for a lot of things besides.

library(see)
library(parameters)
plot(parameters(fit_brms_two))

image

If you want a similar visual effect, you can use geom_interval in ggdist. Not the most intuitive approach, but here is an example:

library(ggdist)

# get_variables(fit_brms_two) # to see how the variables are named

fit_brms_two |>
  gather_draws(`b_.*`, regex = TRUE) |> 
  median_qi(.width = c(.66, .75, .8, .9, .95)) |> 
  ggplot(aes(
    x = .value, 
    y = .variable, 
    xmin = .lower, 
    xmax = .upper)
  ) +
  geom_interval() +
  scico::scale_color_scico_d(
    palette = 'bilbao', 
    direction = -1
  )

image

m-clark avatar Jan 22 '24 14:01 m-clark