I am interested in implementing a model of regression to the mean with mixed effects for zero inflation data using Stan, that is, we are trying to model a mixed variable, consisting of zeros and continuous values, to model the continuous part we will use a generalized gamma distribution conditioned for positive values and for the discrete part a logistic regression.
Chapter 13.7 in the Stan manual shows how to do zero inflated models.
data {
int<lower=0> N;
int<lower=0> y[N];
}
parameters {
real<lower=0, upper=1> theta;
real<lower=0> lambda;
}
model {
for (n in 1:N) {
if (y[n] == 0)
target += log_sum_exp(bernoulli_lpmf(1 | theta),
bernoulli_lpmf(0 | theta)
+ poisson_lpmf(y[n] | lambda));
else
target += bernoulli_lpmf(0 | theta)
+ poisson_lpmf(y[n] | lambda);
}
}
Basically, you’re going to want to replace the Poisson there with your Gamm distribution.
You also want to change the theta to be an array that’s determined by the logistic regression for each unit. See section 9.5 in the manual for logistic regression.