Hello researchers,

I am trying to run two-component mixture Poisson regression model. The mean of first cluster greater than the second. I have tried the Stan code as follow; but I am not sure how the independent variables are integrated within the model (I could not find any related Stan material over it) and where the truncated (T[0,]) option is put. Finally, I want to put mu[2] = mu[1] + theta; theta will be any postie number; but I don’t know how it can be integrated to my code? Therefore, would you please give me some hint/correction or related materials over my code?

```
data {
int<lower = 0> N; // number of data points
int <lower=0> y[N]; // observations
int<lower=1> K; // number of mixture components
int<lower=0> p; // number of Covariates
// Covariates
int <lower=0> x1[N];
real <lower=0> x2[N];
real<lower=0> x3[N];
real<lower=0> x4[N];
real <lower=0> x5[N];
}
transformed data {
real <lower=0> Amci;
Amci=mean(mci);
}
parameters {
real<lower=0> theta;
real beta[p];
simplex[2] pi; // mixing proportions
}
transformed parameters{
real lp[N];
ordered mu[2]; // locations of mixture components
for(i in 1:N){
lp[i] = beta[1] + beta[2]*x1[i] + beta[3]*x2[i] + beta[4]*x3[i] + beta[5]*x4[i];
for (k in 1:K){
mu[1] = exp(lp);
mu[2] = mu[1]+theta;
}
}
}
model {
// Priors
beta[1] ~ normal(0,1.0E-3);
beta[2] ~ normal(0,1.0E-3);
beta[3] ~ normal(0,1.0E-3);
beta[4] ~ normal(0,1.0E-3);
beta[5] ~ normal(0,1.0E-3);
theta ~ normal(0,1.0E-6)T[0,];
pi ~ beta(Amci,Amci);
// Likelihood
for (i in 1:N) {
target += log_sum_exp(log(pi) + poisson_lpmf(y | mu[1]),
log1m(pi) + poisson_lpmf(y | mu[2]));
}
```