Here is the reprex. Admittedly, I can only get it to cause the error on my Mac and not the Windows one, which has me completely baffled. (both machines still error with the original code)
Are you able to replicate the error, @avehtari?
library(brms)
#make the data
out1 <- c(0.4259, 0.42855, 0.4193, 0.3835, 0.348, 0.5182, 0.52025, 0.44115,
0.4603, 0.44805, 0.3567857, 0.3799, 0.50925, 0.4768, 0.56815, 0.3948421,
0.42665, 0.37795, 0.36645, 0.34565, 0.7618947, 0.8046667, 0.42105, 0.40785,
0.41405, 0.43255, 0.3467895, 0.4078, 0.3496429, 0.4345263, 0.3606, 0.4466389,
0.3419714, 0.3883143, 0.3832778, 0.4014444, 0.3393714, 0.4705, 0.3766,
0.3727143, 0.403, 0.3646774, 0.3610571, 0.5300833, 0.4632778, 0.4330556,
0.3387568, 0.3698824, 0.3623429, 0.3744412, 0.3373889, 0.4087632, 0.5207692,
0.5020857, 0.4230278, 0.3997714, 0.4826571, 0.3942222, 0.3812432, 0.3345143,
0.3699737, 0.3783143, 0.615833, 0.582929, 0.59, 0.559, 0.6004, 0.56274, 0.59394,
0.59537, 0.5802, 0.599667, 0.55908, 0.57475, 0.5909, 0.58331, 0.584053, 0.553714,
0.577391, 0.55479, 0.5277, 0.540563, 0.544611, 0.599187, 0.577923, 0.583842,
0.563524, 0.574, 0.542056, 0.54887, 0.583167, 0.595, 0.588, 0.54663, 0.4306, 0.547,
0.56587, 0.5517, 0.55697, 0.51808, 0.57569, 0.52975, 0.56571, 0.52133, 0.55158,
0.59483, 0.62878, 0.543733, 0.480909, 0.61368, 0.57294, 0.577353, 0.497968, 0.562611,
0.626611, 0.591759, 0.592515, 0.538882, 0.5612, 0.553219, 0.57397, 0.539781, 0.562767, 0.556472)
out2 <- c(0.0001, 0.0001, 0.0001, 0.0001, 0.15, 0.0001, 0.0001, 0.0001, 0.0001, 0.0001, 0.3, 0.0001,
0.0001, 0.0001, 0.0001, 0.05, 0.0001, 0.0001, 0.0001, 0.0001, 0.0001, 0.0001, 0.0001, 0.0001,
0.0001, 0.0001, 0.05, 0.0001, 0.3, 0.0001, 0.0001, 0.0001, 0.0001, 0.0001, 0.0001, 0.0001,
0.0001, 0.0001, 0.0001, 0.0001, 0.0001, 0.1143, 0.0001, 0.0001, 0.0001, 0.0001, 0.0001, 0.02857,
0.0001, 0.02857, 0.0001, 0.0001, 0.0001, 0.0001, 0.0001, 0.0001, 0.0001, 0.0001, 0.0001, 0.0001,
0.0001, 0.0001, 0.4444, 0.12, 0.45, 0.1364, 0.25, 0.2083, 0.1, 0.2, 0.08696, 0.3684, 0.2353,
0.16, 0.1304, 0.09091, 0.1364, 0.1667, 0.0001, 0.09524, 0.08696, 0.05882, 0.05263, 0.0001, 0.2273,
0.0001, 0.08696, 0.2222, 0.0001, 0.08, 0.1176, 0.3125, 0.08333, 0.1892, 0.02703, 0.02857, 0.1351,
0.2222, 0.1053, 0.1429, 0.1944, 0.1351, 0.1316, 0.1429, 0.2778, 0.2121, 0.0001, 0.05405, 0.1282,
0.05882, 0.05556, 0.07895, 0.1111, 0.05128, 0.0001, 0.2105, 0.07895, 0.05556, 0.06061, 0.05714,
0.1316, 0.0001, 0.1429, 0.02632)
out3 <- c(0.5, 0.05, 0.2, 0.1, 0.1, 0.2, 0.05, 0.0001, 0.05, 0.0001, 0.15, 0.2, 0.0001, 0.0001, 0.0001,
0.35, 0.15, 0.1, 0.0001, 0.05, 0.1, 0.05, 0.05, 0.05, 0.05, 0.0001, 0.25, 0.15, 0.25, 0.0001,
0.1, 0.0001, 0.4, 0.8, 0.5, 0.5, 0.8, 0.0001, 0.0001, 0.4, 0.2, 0.8, 0.6, 0.0001, 0.0001, 0.5,
0.9999, 0.2, 0.4, 0.8, 0.25, 0.4, 0.25, 0.0001, 0.25, 0.4, 0.0001, 0.9999, 0.6667, 0.2, 0.0001,
0.4, 0.0001, 0.0001, 0.05, 0.1111, 0.0001, 0.0001, 0.0001, 0.0001, 0.0001, 0.09524, 0.0001,
0.0001, 0.05882, 0.0001, 0.0001, 0.04545, 0.0001, 0.0001, 0.05882, 0.04348, 0.0001, 0.0001,
0.05556, 0.0001, 0.0001, 0.0001, 0.0001, 0.1333, 0.0001, 0.0001, 0.1875, 0.0001, 0.0001, 0.0001,
0.0001, 0.0001, 0.0001, 0.0001, 0.0001, 0.0001, 0.5, 0.0001, 0.0001, 0.0001, 0.0001, 0.9999,
0.0001, 0.0001, 0.0001, 0.0001, 0.25, 0.0001, 0.0001, 0.0001, 0.0001, 0.25, 0.1429, 0.0001,
0.0001, 0.0001, 0.0001, 0.0001)
id <- as.character(c("4f9", "06b", "6b8", "10", "47f", "148", "230", "430", "699", "aa4", "c03", "d4c", "d83", "fc8",
"2df", "6ea", "12a", "40a", "aa6", "e25", "51b", "3b6", "263", "aac", "a87", "67d", "39e", "a40",
"f0f", "3ac", "ece", "4f9", "06b", "6b8", "10", "47f", "148", "230", "430", "699", "aa4", "c03",
"d4c", "d83", "fc8", "2df", "6ea", "12a", "40a", "aa6", "e25", "51b", "3b6", "263", "aac", "a87",
"67d", "39e", "a40", "f0f", "3ac", "ece", "4f9", "06b", "6b8", "10", "47f", "148", "230", "430",
"699", "aa4", "c03", "d4c", "d83", "fc8", "2df", "6ea", "12a", "40a", "aa6", "e25", "51b", "3b6",
"263", "aac", "a87", "67d", "39e", "a40", "f0f", "3ac", "ece", "4f9", "06b", "6b8", "10", "47f",
"148", "230", "430", "699", "aa4", "c03", "d4c", "d83", "fc8", "2df", "6ea", "12a", "40a", "aa6",
"e25", "51b", "3b6", "263", "aac", "a87", "67d", "39e", "a40", "f0f", "3ac", "ece"))
environment <- as.factor(c(1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2))
load <- as.factor(c(1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2))
dat <- data.frame(out1, out2, out3, id, environment, load)
f1 <- bf(out1 ~ environment+load + (1|id),
phi ~ environment+load + (1|id)) + Beta()
f2 <- bf(out2 ~ environment+load + (1|id),
phi ~ environment+load + (1|id)) + Beta()
f3<- bf(out3 ~ environment+load + (1|id),
phi ~ environment+load + (1|id)) + Beta()
fit_dist <- brm(
f1 + f2 + f3 + set_rescor(FALSE),
data = dat, chains = 4, cores = 4, iter = 10000, warmup = 8000,
prior = c(prior(normal(0, 3), class=b, resp= out1), prior(gamma(1.5, .7), class=b, resp= out1, dpar= phi, lb=0),
prior(normal(0, .5), class=sd, resp= out1), prior(normal(0, .5), class=sd, resp= out1, dpar= phi),
prior(normal(0, 3), class=b, resp= out2), prior(gamma(1.5, .7), class=b, resp= out2, dpar= phi, lb=0),
prior(normal(0, .5), class=sd, resp= out2), prior(normal(0, .5), class=sd, resp= out2, dpar=phi),
prior(normal(0, 3), class=b, resp= out3), prior(gamma(1.5, .7), class=b, resp= out3, dpar= phi, lb=0),
prior(normal(0, .5), class=sd, resp= out3), prior(normal(0, .5), class=sd, resp= out3, dpar=phi)),
control = list(adapt_delta = 0.99), save_pars=save_pars(all=TRUE), seed = 711,
)
#hopefully make the error
fit_dist <- add_criterion(fit_dist, "loo", moment_match = TRUE)