Is there any way to estimate a discrete parameter in Stan?

I’ve read the topic related to modeling discrete parameter using CONCRETE or REBAR distributions appraoch. It seems that this approach has not been compared yet with the marginalization over the discrete parameter approach, as it done in finite mixture model in Stan reference. But what if this discrete parameter is related to estimation of another continuous parameter.

I’ve tried to fit mixture IRT model using Stan. The problem is that the ability parameter (theta) for each person (i) is related to the latent class (g) that the person comes from; theta(i,g).

Estimation of this model via Stan is different than JAGS, or WINBUGS since the Gibbs sampling algorithm allows to sample first from the discrete parameter (i.e. latent class).

Is it possible, for example, to declare (g) as a categorical local variable in the model block, then sample the ability parameter theta(i,g) based on this local variable?

Any idea how to solve this issue?

Thanks a lot