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

plot_coefficients() brmsfit error #13

Open
GLad-Arioch opened this issue Oct 31, 2023 · 3 comments
Open

plot_coefficients() brmsfit error #13

GLad-Arioch opened this issue Oct 31, 2023 · 3 comments

Comments

@GLad-Arioch
Copy link

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

@m-clark
Copy link
Owner

m-clark commented Oct 31, 2023

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.

@GGLuca
Copy link

GGLuca commented Jan 22, 2024

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

@m-clark
Copy link
Owner

m-clark commented Jan 22, 2024

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

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

3 participants