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

Incompatible with brms when random effects are specified with || syntax #436

Closed
hrlai opened this issue Aug 1, 2023 · 2 comments
Closed

Comments

@hrlai
Copy link

hrlai commented Aug 1, 2023

Hi there dev, cv_varsel fails when the brms model has random group effects that are specified in the (1 || group) format. For example:

library(brms)
library(projpred)

data("df_gaussian", package = "projpred")
dat_gauss <- data.frame(y = df_gaussian$y, df_gaussian$x)
# generate groups
dat_gauss$grp <- rep(1:10, each = 10)

refm_fit <- brm(
    y ~ X1 + X2 + X3 + X4 + X5 + X6 + X7 + X8 + X9 + X10 + X11 + X12 + X13 + X14 +
        X15 + X16 + X17 + X18 + X19 + X20 +
        (1 || grp),
    family = gaussian(),
    data = dat_gauss,
    ### Only for the sake of speed (not recommended in general):
    chains = 2, iter = 1000
)

cvvs_fast <- cv_varsel(
    refm_fit,
    validate_search = FALSE,
    nterms_max = 10
)

returns the following error:

Error in FUN(X[[i]], ...) : 
  Unexpected number of `|` characters in group terms. Please contact the package maintainer.

Is this something that can be generalised in projpred? I hope so because sometimes we want to do without the random covariance when the model becomes a bit too complex. Thanks!

@hrlai
Copy link
Author

hrlai commented Aug 1, 2023

Opps sorry this is a duplicate of #435. I'm going to close it to avoid extra work on your side, but will hope that this gets implemented in the near future :)

@hrlai hrlai closed this as completed Aug 1, 2023
@fweber144
Copy link
Collaborator

No problem :)

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