I am trying to fit a 2pl IRT / Ideal Point model like the one described by Bafumi, Gelman, Park, and Kaplan (2005) http://www.stat.columbia.edu/~gelman/research/published/171.pdf
But I am having some trouble with identification in brms, particularly when I try to model the parameters hierarchically. Here is what I have been playing around with:
formula_2pl <- bf(y ~ gamma * (theta - beta),
theta ~ 1 + (1 | id),
beta ~ 1 + (1 |i| bill),
gamma ~ 1 + (1 |i| bill),
nl = TRUE)
prior_2pl <-
prior("lkj(2)", class = "cor") +
prior("normal(0, 1)", class = "sd", nlpar = "gamma") +
prior("cauchy(0, 1)", class = "sd", nlpar = "beta") +
prior("cauchy(0, 1)", class = "sd", nlpar = "theta") +
prior("normal(0, 2)", class = "b", nlpar = "gamma") +
prior("normal(0, 2)", class = "b", nlpar = "beta") +
prior("normal(0, 2)", class = "b", nlpar = "theta")
fit_2pl <- brm(
formula = formula_2pl,
data = ij_level,
family = brmsfamily("bernoulli", "logit"),
prior = prior_2pl,
seed = 666,
iter = 2000,
chains = 4,
cores = 4,
backend = "cmdstanr",
adapt_delta = 0.95,
max_treedepth = 15,
inits = "0"
)
The main issue seems to manifest itself in very low effective sample sizes for gamma. I have tried to implement some of the solutions from: Low number of effective samples with 2PL latent space model / IRT but I am not sure how to go about it in brms.