Yes, I get the same issue when using glm. Below is a code that reproduces the error on my computer both with glm and polr. The mc.core=1 was to used to circumvent the issure raised in this thread: Problems running LOO on >1 core
Here is the required data.
reducedvilt.csv (11.4 KB)
df<-read.csv("reducedvilt.csv")
options(mc.cores = 1)
require(rstanarm)
require(rstan)
rstan_options(auto_write = TRUE)
moddef="Inno_art ~ Vall_ha + Spann_ha + Socker_ha + Olje_ha + Balj_ha + Potatis_ha + Gron_ha + Majs_ha + Annat_ha + Lan"
WL<-stan_glm(moddef , data = df)
loo(WL,k_threshold = 0.7)
df$Inno_art<-ordered(df$Inno_art,levels=1:5,labels=LETTERS[1:5])
WL<-stan_polr(moddef , data = df, method = "logistic",
prior = R2(0.25,what = "median"), init_r = 0.1, seed = 12346,
algorithm = "sampling")
loo(WL,k_threshold = 0.7)