Hi, I have reproduced the error we the following reproducible example. The difference is now I have added some missing values and dropped two observations. Please the code below:

set.seed(101)

df ← data.frame(replicate(155,runif(90, 1, 2.5)))

set.seed(101)

df2 ← data.frame(replicate(5,runif(90, 300, 20000)))

colnames(df2) ← c(‘C1’,‘C2’,‘C3’, ‘C4’, ‘C5’)

set.seed(101)

df3 ← data.frame(replicate(5,sample(0:1,90,rep=TRUE)))

colnames(df3) ← c(‘D1’,‘D2’,‘D3’, ‘D4’, ‘D5’)

n=dim(df3)[1]

df3 ← apply (df3, 2, function(x) {x[sample( c(1:n), floor(n/10))] ← NA; x} )

set.seed(101)

df$time ← rep(c(1,6,12), each = 1)

df_complete ← cbind(df,df2,df3)

set.seed(101)

n=dim(df_complete)[1]

df_complete ← as.data.frame(df_complete)

df_complete$time ← rep(c(1,6,12), each = 1)

df_complete$ID ← rep(c(1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,

21,22,23,24,25,26,27,28,29,30), each = 3)

rand_ind ← sample(nrow(df_complete), 2, replace = F)

df_complete ← df_complete[-rand_ind,]

library(rstanarm)

n=dim(df_complete)[1]

p=dim(df_complete)[2]

p0 ← 10 # prior guess for the number of relevant variables

tau0 ← p0/(p-p0) * 1/sqrt(n)

hs_prior ← hs(df=1, global_df=1, global_scale=tau0)

t_prior ← student_t(df = 7, location = 0, scale = 2.5)

#post2 ← stan_glm(reg_formula, data = diabetes,

#
family = binomial(link = “logit”),

#
prior = hs_prior, prior_intercept = t_prior,

#
seed = SEED, adapt_delta = 0.999, refresh=0)

formula_ ← X43 ~ . -ID + (1 | ID)

stanglmer ← stan_glmer(formula_ ,

prior = hs_prior,

family = gaussian(),

data = df_complete,

seed = 12345,

chains = 4)

library(projpred)

varsel2 ← cv_varsel(stanglmer, method=‘forward’, cv_method=‘loo’, nloo = n)

Thank you again for your help!