Closed osupplisson closed 1 year ago
Thanks for the suggestion. I think it’s interesting, but I am wondering if it’s worth it. My sense is that one of the main advantages of bayesian computation is that a lot of these quantities are really trivial to compute. It would add code complexity to marginaleffects
, and I’m not sure it would bring a ton of benefits relative to something like:
library(brms)
library(marginaleffects)
library(dplyr)
fit1 <- brm(count ~ zAge, data = epilepsy, family = poisson())
avg_slopes(fit1 , variables = "zAge") |>
posterior_draws() |>
summarize(estimate = mean(draw), low = mean(draw < 0), high = mean(draw > 0), .by = term)
Thank you very much for your answer.
I wasn't aware of the posterior_draws
function, which indeed makes it super easy to compute whatever I need, as you showed.
Hi,
I am currently estimating a bunch of average marginal effects and their (pairwise) between-group differences (diff-in-diff) using the
avg_slopes
function of the package and abrms
object. It's amazing how easy it is, thank you !For reporting completeness, I wanted to provide, along with the posterior average and ETI95%, the exceedance probability with respect to 0 (i.e., Pr(Marginal effect> 0 | Y) and Pr(Diff-in-Marginal effect> 0 | Y)).
The equivalence argument allows this kind of test for frequentist model but it causes an error for bayesian model (I guess you are aware of this because of issue https://github.com/vincentarelbundock/marginaleffects/issues/629):
Generating the following error:
Is there a workaround in the avg_slopes function for using this argument with bayesian models ?
Currently, I only see as fallback solution 'manual computation' of everything, which I would rather avoid... I am still discovering the package: I might miss something relevant.