I’ve been working with rstanarm and loo for several months, just updated to the newest versions a couple weeks ago, and since then have started seeing this error message when running the
> l_full5 <- loo(full5, k_threshold = 0.7) 1 problematic observation(s) found. Model will be refit 1 times. Fitting model 1 out of 1 (leaving out observation 2252) Error in new_CppObject_xp(fields$.module, fields$.pointer, ...) : Exception: model_bernoulli_namespace::model_bernoulli: N[k0__] is 0, but must be greater than or equal to 1 (in 'model_bernoulli' at line 12) failed to create the sampler; sampling not done Error in check_stanfit(stanfit) : Invalid stanfit object produced please report bug
This only happens when a problematic observation(s) is/are found, and furthermore, seems to happen every time a problematic observation is found. This is happening for the more complex models I’m using.
Here are the data I’m using: dat_with_soil2.csv (865.8 KB),
and code that should reproduce the problem:
dat$BAc5 <- scale(dat$BAc5) dat$BAh5 <- scale(dat$BAh5) dat$n_con <- scale(dat$n_con) dat$n_het <- scale(dat$n_het) dat$gap <- scale(dat$gap) dat$ph <- scale(dat$ph) dat$tec <- scale(dat$tec) dat$org <- scale(dat$org) full5 <- stan_glm(surv ~ n_con + n_het + BAc5*gap + BAh5*gap + BAc5*ph + BAh5*ph + BAc5*tec + BAh5*tec + BAc5*org + BAh5*org, prior = student_t(df=7, location=0, autoscale=TRUE), prior_intercept = student_t(df=7, location=0, autoscale=TRUE), adapt_delta = 0.99, init_r = 0.1, family = binomial(link = "logit"), data = dat)
l_full5 <- loo(full5, k_threshold=0.7)
I hugely appreciate any guidance you might have. Thank you so much for the work you do!
- Operating System: Windows 10
- rstanarm Version: 2.17.4
- loo Version: 2.0.0
- R Version: 3.3.1