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

linpred_draws fails with brms model #327

Open
maxfarrell opened this issue Aug 7, 2024 · 2 comments
Open

linpred_draws fails with brms model #327

maxfarrell opened this issue Aug 7, 2024 · 2 comments

Comments

@maxfarrell
Copy link

I am trying to use the function linpred_draws() on a brms model object:

   draws <- linpred_draws(
                  model,
                  newdata=model$data,
                  value = ".linpred",
                  ndraws = 4000,
                  seed = NULL,
                  re_formula = NULL,
                  category = ".category",
                  dpar = NULL) 
 

This was working in the past but now for simple models with no hierarhical effect I'm getting the following error:

Error in get_all_effects.brmsterms(x) : is.atomic(rsv_vars) is not TRUE

And for models with hierarchical effects I get the following error:

Errir in get_model_matrix(re$form[[i]], data: is.atomic(cols2remove) is not TRUE

I am using tidybayes version 3.0.6 and brms version 2.16.3

@maxfarrell
Copy link
Author

Aftrer a little bit of researching and investigating my system, this function last worked in May 2024, but my system seems to have updated to R 4.4.1 (2024-06-14). This version seems to have a significant user-variable change (from https://cran.r-project.org/doc/manuals/r-release/NEWS.pdf):

CHANGES IN R 4.4.0
SIGNIFICANT USER-VISIBLE CHANGES:
• is.atomic(NULL) now returns FALSE, as NULL is not an atomic vector.
Strict back-compatibility would replace is.atomic(foo) by (is.null(foo) ||
is.atomic(foo)) but should happen only sparingly.

@mjskay
Copy link
Owner

mjskay commented Sep 15, 2024

I can't reproduce the bug on the latest versions of brms and tidybayes. From the output it looks like the error is coming from functions in brms, so it is likely a problem there. Since you are a few versions behind the latest version of brms and I can't reproduce the bug, it's very possible it's been fixed already.

If you update to the latest versions of both and the bug is still there, can you provide a reprex?

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

2 participants