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

Error: Internal renaming led to duplicated names #1648

Open
bhara033 opened this issue Apr 17, 2024 · 7 comments
Open

Error: Internal renaming led to duplicated names #1648

bhara033 opened this issue Apr 17, 2024 · 7 comments

Comments

@bhara033
Copy link

bhara033 commented Apr 17, 2024

Please note:

The brms issue tracker is reserved for bug reports and feature requests. brms-related questions should rather be asked on https://discourse.mc-stan.org/ in order to reach a wider community.

Hello Paul,

Hope you are doing well. I am fairly new to using "brms" but wanted to report, what I consider, a bug.
When I tried to run the model below, I got the following error:

Error: Internal renaming led to duplicated names.
Occured for: 'var21', 'var22', 'var23', 'var24', 'var25', 'var26', 'var27', 'var28', 'var29', 'var21', 'var22', 'var23', 'var24', 'var25', 'var26', 'var27', 'var28', 'var29'

I checked to make sure that my column names were, in fact, not duplicated. The error seems to be strange because I am able to run several other models using the same dataset without any issues.

I would be grateful if you could help me understand what's going on here.

My model:

result <- brm(
  bf(
    mvbind(var9, var10, var15, var16) ~ var2 + var13 + var14 + var19 + var21 + var22 + var23 + var24 + var25 + var26 + var27 + var28 + var29 + var30 + var34 + var48 + var49 + var53 + var54 + var55 + var58 + var61 + var63 + var64 + var89 + var90 + var91 + var92 + var93 + var94,
           zi ~ var2 + var5 + var114,
		   autocor = ~ar(time = var2, gr = var4:var3:var1)
    ),
  data = y,
  family = zero_inflated_negbinomial(),
  iter = 2000, # default 2000
  warmup = 1000, # default iter/2
  chains = 4, # default 4
  cores = 32,
  backend = "rstan",
  open_progress = TRUE,
  save_pars = save_pars(all = TRUE))
  )

Another issue I wanted to bring to your attention is that currently I am unable to use the option "backend = "cmdstanr"." The reason I wish to use this feature is to leverage parallel computing in "brms" (I am unsure if using the backend = "rstan" also achieves the same thing). Initially, I got an error saying I needed to install this additional R package called "cmdstanr." When I attempted to install it, the installer terminated with the following warning:

Warning in install.packages :
package ‘cmdstanr’ is not available for this version of R

Could you please help me in addressing this issue? Thank you!

Regards,

Suhas

@paul-buerkner
Copy link
Owner

paul-buerkner commented Apr 17, 2024 via email

@paul-buerkner
Copy link
Owner

paul-buerkner commented Apr 17, 2024 via email

@bhara033
Copy link
Author

Sure, Paul! I will share a full reprex for the error with you soon. Thank you!

@bhara033
Copy link
Author

I have invited you to collaborate on the "test" repository on GitHub. Thank you!

@paul-buerkner
Copy link
Owner

paul-buerkner commented Apr 17, 2024 via email

@bmfazio
Copy link
Contributor

bmfazio commented Apr 18, 2024

Hi, here's a minimal reprex. The error happens because var2 is a factor, so the coefficient for level "2" clashes for the slope on var22. Should be solvable from the user side by renaming but a more informative error message may be useful.

library(brms)
y = data.frame(
  var1 = 0,
  var2 = as.factor(1:3),
  var22 = 0
)
get_prior(bf(var1 ~ var2 + var22), data = y)

@bhara033
Copy link
Author

bhara033 commented Apr 18, 2024

Thank you, @bmfazio! Renaming var2 fixed the issue for me. Sorry for deleting the text file containing R code I posted earlier. I found some issues that needed to be fixed. I can repost it if needed. Thank you!

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

3 participants