Stan works on the unconstrained space anyway. The two solutions may result in the same.

Did you put some priors on the parameters?

The exp in `poisson`

is able to overflow. The sample should be ok, normally.

continuing with your first modelling approach:

for(i in 1:N){

lp[i] = beta[1] + beta[2]*di[i] + beta[3]*gcc[i] + beta[4]*ma[i] + beta[5]*en[i];

mu[1] = exp(lp[i]);

}

mu[2] = mu[1]+ci;

}

What does the loop do? There are two options here::

If you have two `mu`

then then loop is not required.

Then you can restrict restrict `mu`

by

`vector<lower=0>[2] mu;`

and omit the loop.

or do you have a two vectors the size N for `each`

observation?

Then you can write define `mu`

as

vector<lower=0>[N] mu[2];

with

`mu1[1] = exp(beta[1] + beta[2]*x1 + beta[3]*x2 + beta[4]*x3 + beta[5]*x4);`

and

`mu[2] = mu[1] + c;`

BTW, If you define x1 as Matrix X you can write `mu[1] = exp(X * beta);`

From your intro post:

Then mu1 = mu2 + c, with c > 0? But your model says the opposite.

Since you add only a constant you may calculate the log_mix formula by hand and see if you benefit from some simplifications.