JWiley / brmsmargins

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

Error: column(s) not found: [L_1[1,1], L_1[2,1], L_1[1,2], L_1[2,2]] #10

Open joshua-zh opened 10 months ago

joshua-zh commented 10 months ago

When I reran the example to get the AMEs and marginal coefficients on the page, I encountered an error like this:

Error: column(s) not found: [L_1[1,1], L_1[2,1], L_1[1,2], L_1[2,2]]

attached base packages: [1] stats graphics grDevices utils datasets methods base

other attached packages: [1] data.table_1.14.9 brmsmargins_0.2.0 brms_2.20.6 Rcpp_1.0.11

JWiley commented 10 months ago

You either need to save all parameters in your brms model. See: https://paul-buerkner.github.io/brms/reference/save_pars.html

Or use the cmdstanr backend. I forget which off hand and am away from my computer atm.

On Sun, Nov 19, 2023 at 03:40 jzh @.***> wrote:

When I reran the example to get the AMEs and marginal coefficients on the page , https://joshuawiley.com/brmsmargins/articles/mixed-effects-marginaleffects.html I encountered an error like this:

Error: column(s) not found: [L_1[1,1], L_1[2,1], L_1[1,2], L_1[2,2]]

attached base packages: [1] stats graphics grDevices utils datasets methods base

other attached packages: [1] data.table_1.14.9 brmsmargins_0.2.0 brms_2.20.6 Rcpp_1.0.11

— Reply to this email directly, view it on GitHub https://github.com/JWiley/brmsmargins/issues/10, or unsubscribe https://github.com/notifications/unsubscribe-auth/AACOZHG34QIUN4YTMOVMG5LYFDQJPAVCNFSM6AAAAAA7RCTMZWVHI2DSMVQWIX3LMV43ASLTON2WKOZSGAYDANBZGI2DIOA . You are receiving this because you are subscribed to this thread.Message ID: @.***>

joshua-zh commented 10 months ago

Thank you for your response. I am afraid the error is still present. When I set effect = “fixedonly” or “includeRE”, everything was ok; however, when setting effect = “integrateoutRE”, this error popped up.

JWiley commented 10 months ago

Can you please give me a reproducible example?

On Sun, 19 Nov 2023 at 22:40, jzh @.***> wrote:

Thank you for your response. I am afraid the error is still present. When I set effect = “fixedonly” or “includeRE”, everything was ok; however, when setting effect = “integrateoutRE”, this error popped up.

— Reply to this email directly, view it on GitHub https://github.com/JWiley/brmsmargins/issues/10#issuecomment-1817828765, or unsubscribe https://github.com/notifications/unsubscribe-auth/AACOZHAXU24FGR5V7MLF34DYFHV4VAVCNFSM6AAAAAA7RCTMZWVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQMJXHAZDQNZWGU . You are receiving this because you commented.Message ID: @.***>

joshua-zh commented 10 months ago

I just copied the codes for the logistic regression on this page and executed them in Rstudio.

attached base packages: [1] stats graphics grDevices utils datasets methods base

other attached packages: [1] data.table_1.14.9 brmsmargins_0.2.0 brms_2.20.6 Rcpp_1.0.11

JWiley commented 10 months ago

Just tested again. It works for me when adding:

save_pars = save_pars(all=TRUE)

to the brm() model paired with the cmdstanr backends as in the vignette.

I believe the change is that brms defaults no longer includes some of the needed parameters so need to explicitly ask for those to be saved.

On Mon, Nov 20, 2023 at 12:49 jzh @.***> wrote:

I just copied the codes for the logistic regression on this page https://joshuawiley.com/brmsmargins/articles/mixed-effects-marginaleffects.html and executed them in Rstudio.

attached base packages: [1] stats graphics grDevices utils datasets methods base

other attached packages: [1] data.table_1.14.9 brmsmargins_0.2.0 brms_2.20.6 Rcpp_1.0.11

— Reply to this email directly, view it on GitHub https://github.com/JWiley/brmsmargins/issues/10#issuecomment-1818086915, or unsubscribe https://github.com/notifications/unsubscribe-auth/AACOZHHW5JXC42HMGDRYAKTYFKZJBAVCNFSM6AAAAAA7RCTMZWVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQMJYGA4DMOJRGU . You are receiving this because you commented.Message ID: @.***>

joshua-zh commented 10 months ago

Thank you for your patience and understanding. This setup works. Previously, I only set save_pars = save_pars() 😅. BTW, the rstan backends also work fine.

JWiley commented 10 months ago

Oh good to know about rstan backend. That one crashes a lot for whatever reason on my computer so I have trouble testing it.

I'll try to get the vignettes and examples all updated.

On Mon, 20 Nov 2023 at 18:59, jzh @.***> wrote:

Thank you for your patience and understanding. This setup works. Previously, I only set save_pars = save_pars() 😅. BTW, the rstan backends also work fine.

— Reply to this email directly, view it on GitHub https://github.com/JWiley/brmsmargins/issues/10#issuecomment-1818407918, or unsubscribe https://github.com/notifications/unsubscribe-auth/AACOZHF7O7MA6E7SYVMLOI3YFMEUXAVCNFSM6AAAAAA7RCTMZWVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQMJYGQYDOOJRHA . You are receiving this because you commented.Message ID: @.***>