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

Bug when y ~ 0 + Intercept & family = 'poisson' & sample_prior = 'yes' #1644

Open
bfordAIMS opened this issue Apr 9, 2024 · 0 comments
Open
Labels
Milestone

Comments

@bfordAIMS
Copy link

# REPREX
library(brms)

data <- data.frame(count = rpois(1000, 0.05))

m1 <- brm(
  formula = "count ~ 1",
  family = "poisson", 
  sample_prior = "yes",
  data = data
)
m2 <- brm(
  formula = "count ~ 0 + Intercept",
  family = "poisson",
  sample_prior = "yes",
  data = data
)
m3 <- brm(
  formula = "count ~ 0 + Intercept",
  family = "poisson",
  sample_prior = "no",
  data = data
)
m4 <- brm(
  formula = "count ~ 0 + Intercept",
  family = "negbinomial",
  sample_prior = "yes",
  data = data
)
m5 <- brm(
  formula = "count ~ 0 + Intercept",
  family = "gaussian",
  sample_prior = "yes",
  data = data
)

In the above reprex, I fit four intercept-only models for the same data. The models have different combinations of (1) intercept specification: ~ 1 vs ~ 0 + Intercept; (2) family: poisson vs negbinomial vs gaussian; (3) sample_prior = 'yes' vs 'no'. Models m1, m3, m4, and m5 all compile as expected, however, m2 returns the error

Error in strsplit(gsub(" |\\n", "", tpar_prior), ";")[[1]] : 
  subscript out of bounds

this is the specific combination of y ~ 0 + Intercept & family = "poisson" & sample_prior = "yes".

@bfordAIMS bfordAIMS changed the title Bug when y ~ 0 + Intercept & family = "poisson" & sample_prior = 'yes' Bug when y ~ 0 + Intercept & family = 'poisson' & sample_prior = 'yes' Apr 9, 2024
@paul-buerkner paul-buerkner added this to the brms 2.22.0 milestone Apr 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants