1
$\begingroup$

I have developed Bayesian binary logit model using brms package in R. Now I would like to see the marginal effects (ME) of each independent variable. I used marginal_effect function in my model and it only gave me the plot for each variable, not the value. So it would be highly appreciated, if anyone can help me on how to identify the ME values in brms package?

Also, is there any easy way to calculate the ME values by hand? Thanks in advance!

$\endgroup$

1 Answer 1

1
$\begingroup$

You can always store the plot object to look at the values:

library(brms)
fit = brm(Species ~ .,data=data,family=bernoulli())
ME = marginal_effects(fit)
head(ME$Sepal.Width)
  Sepal.Width   Species Sepal.Length Petal.Length Petal.Width cond__ effect1__
1    2.000000 0.3333333     5.843333        3.758    1.199333      1  2.000000
2    2.024242 0.3333333     5.843333        3.758    1.199333      1  2.024242
3    2.048485 0.3333333     5.843333        3.758    1.199333      1  2.048485
4    2.072727 0.3333333     5.843333        3.758    1.199333      1  2.072727
5    2.096970 0.3333333     5.843333        3.758    1.199333      1  2.096970
6    2.121212 0.3333333     5.843333        3.758    1.199333      1  2.121212
  estimate__       se__   lower__   upper__
1  0.8894301 0.07610012 0.6200033 0.9767882
2  0.8821960 0.07912007 0.6125043 0.9742621
3  0.8745298 0.08127473 0.6041322 0.9712861
4  0.8662676 0.08422600 0.5951038 0.9679212
5  0.8577253 0.08695147 0.5859902 0.9644242
6  0.8488887 0.08933311 0.5774418 0.9605006
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.