Dear Stan-Community,
I’m using rstanarm for Multilevel Regression and Poststratification (MRP) with functions stan_glmer() and posterior_epred(). The code does run without error and produces results that make sense. However, when running posterior_epred() with the argument ‘newdata’ specified, R silently stores a list object called ‘curWarnings’ in the environment. It contains 2 string elements: “failure to converge in 1 evaluations” and “convergence code 4 from Nelder_Mead: failure to converge in 1 evaluations”.
After a Google search it seems that it originates in some lme4 function.
I was wondering if these warnings are actually relevant for my analysis and if so, what exactly they mean?
Thank you!
Here is a reprex:
library(rstanarm)
# Create dataset
set.seed(124)
dat <- data.frame(y = sample(c(0,1), 100, replace = T),
x = sample(c(1,2,3), 100, replace = T))
# Fit model
fit <- stan_glmer(y ~ (1 | x),
family = binomial(link = "logit"),
data = dat,
seed = 505)
# posterior_epred without newdata
pred <- posterior_epred(fit, draws = 100)
# Create newdata
new <- data.frame(x = c(0,1))
# posterior_epred with newdata
pred_new <- posterior_epred(fit, newdata = new, draws = 100)
# Print returned object with warnings
print(curWarnings)
Operating System: Windows 10
R Version 4.1.1
rstanarm Version: 2.21.4