JWiley / brmsmargins

Average marginal estimates for Bayesian models fit with the brms package
https://joshuawiley.com/brmsmargins
Other
20 stars 2 forks source link

Multivariable model "object 'post' not found", p.s. thank you so much for your amazing work #2

Closed jwrozelle closed 2 years ago

jwrozelle commented 2 years ago

First of all, this package is great - huge thanks to you and to Paul Buerkner for making bayesian modeling so much more accessible for those among us that are slow on learning STAN / JAGS.

edit: correction to a previous version of this issue.

I stumbled on your package trying to estimate average marginal effects for a brms model, and was getting Error in brmsmargins(model.fit$model) : object 'post' not found. Couldn't figure out why when I was reviewing the function code. I have two random intercepts in the model, if that makes a difference, and five fixed effects.

jwrozelle commented 2 years ago

Never mind, should have started with the vignettes. Thanks!

JWiley commented 2 years ago

@jwilliamrozelle If you have other issues or suggestions for improvements, feel free to open an issue. I'm working on this actively and currently don't have much connection with anyone using it outside myself so feedback is useful :)

jwrozelle commented 2 years ago

@JWiley, thanks again! happy to give feedback if I find anything! As a very low priority suggestion - it might be worth noting in the function help documentation that either at or add arguments are required (if my understanding is correct). Alternatively, could return a helpful error message if required arguments are empty.

I'd just come from using margins::margins for a frequentist model, and had wrongly assumed that if nothing was specified, margins for all would be produced when the documentation said these were optional. Now that I understand it, though, I do like your implementation a bit better.

Again, thanks for this package, as well as those beautiful vignettes with the formulas.

JWiley commented 2 years ago

@jwilliamrozelle Your understanding is correct at least for now. I am not too sure currently how I might automatically figure it all out to do something like margins::margins. Also, especially if dealing with random effects models, despite my attempts at coding what I could in C++, it is painfully slow --- much 'cheaper' to only calculate the marginal effects needed, if someone did not want all possible. I like the idea of an option though to "calculate everything" or something like that.

Helpful error messages are good idea. Adding to my list!