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

Nice get_draws(shape = "DxP") column names break when response is multivariate #1332

Open
andymilne opened this issue Jan 15, 2025 · 0 comments

Comments

@andymilne
Copy link

(See #1318.) For ordinal models in brms, posterior_predict (called by type = "prediction" in marginaleffects) averages over the levels of the response variable, but posterior_epredict (called by type = "response" in marginaleffects) does not. In the latter, we get a probability for each response level, which are called Group in marginaleffects. In the below code, marginaleffects generates nice column names for the former but not the latter. For the latter, I suggest concatenating the Group number to the remaining factor levels to make nice column names.

data <- mtcars

mdl <- 
  brm(
    carb ~ cyl,
    data = data,
    family = cumulative("probit")
  )
mdl

avg_predictions(
    mdl,
    by = "cyl",
    type = "prediction"
  ) |> 
  print() |>
  get_draws("DxP") |>
  head()

avg_predictions(
  mdl,
  by = "cyl",
  type = "response"
) |> 
  print() |>
  get_draws("DxP") |>
  head()
@andymilne andymilne changed the title Nice get_draws(shape = DxP) column names break when response is multivariate Nice get_draws(shape = "DxP") column names break when response is multivariate Jan 15, 2025
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

1 participant