I am writing a _lpdf function, where the y is an int type (int array actually, but make no difference for this problem). Compilation error says only real variate allowed. Then how come the hospital tutorial uses an int type y?

data {

int N; // number of obs (pregnancies)

int T; // number of weeks in campaign

int K; // number of predictors

```
int y[N]; // outcome
row_vector[K] x[N]; // predictors
int g[N]; // map obs to groups (pregnancies to women)
```

}

model {

alpha ~ normal(0,100);

a ~ normal(0,sigma);

beta ~ normal(0,100);

for(n in 1:N) {

y[n] ~ bernoulli(inv_logit( alpha + x[n]*beta));

}

}

if you implement an _lpdf function for this requirement, how would you feed y into the function?