We are looking to develop an hierarchical ordered two-parameter logistic model with missing data, and we are starting with this case-study model as on stan website (http://mc-stan.org/users/documentation/case-studies/hierarchical_2pl.html). We would like to consider missing data as well, thus we have made an adjustment following section 11.1 of the latest Stan manual. The code is the following (highlighted the problematic line):

data {

int<lower=1> I; // # items

int<lower=1> J; // # persons

int<lower=1> N; // # observations

int<lower=1> N_mis; // # missing observations

int<lower=1, upper=I> ii[N]; // item for n

int<lower=1, upper=J> jj[N]; // person for n

int<lower=0, upper=1> y[N]; // correctness for n

}

parameters {

vector[J] theta; // abilities

vector[2] xi[I]; // alpha/beta pair vectors

vector[2] mu; // vector for alpha/beta means

vector<lower=0>[2] tau; // vector for alpha/beta residual sds

cholesky_factor_corr[2] L_Omega;

**real y_mis[N_mis];**

}

transformed parameters {

vector[I] alpha;

vector[I] beta;

for (i in 1:I) {

alpha[i] = exp(xi[i,1]);

beta[i] = xi[i,2];

}

}

model {

matrix[2,2] L_Sigma;

L_Sigma = diag_pre_multiply(tau, L_Omega);

for (i in 1:I)

xi[i] ~ multi_normal_cholesky(mu, L_Sigma);

theta ~ normal(0, 1);

L_Omega ~ lkj_corr_cholesky(4);

mu[1] ~ normal(0,1);

tau[1] ~ exponential(.1);

mu[2] ~ normal(0,5);

tau[2] ~ exponential(.1);

for (n in 1:N)

y[n] ~ bernoulli_logit(alpha[ii] .* (theta[jj] - beta[ii]));

for (n in 1:N_mis)

y_mis[n] ~ bernoulli_logit(alpha[ii] .* (theta[jj] - beta[ii]));

}

generated quantities {

corr_matrix[2] Omega;

Omega = multiply_lower_tri_self_transpose(L_Omega);

}

"

The parser then generates the following error:

No matches for:

real ~ bernoulli_logit(vector)

Available argument signatures for bernoulli_logit:

int ~ bernoulli_logit(real)

int ~ bernoulli_logit(real[])

int ~ bernoulli_logit(vector)

int ~ bernoulli_logit(row vector)

int[] ~ bernoulli_logit(real)

int[] ~ bernoulli_logit(real[])

int[] ~ bernoulli_logit(vector)

int[] ~ bernoulli_logit(row vector)

require real scalar return type for probability function.

ERROR at line 42

40: y[n] ~ bernoulli_logit(alpha[ii] .* (theta[jj] - beta[ii]));

41: for (n in 1:N_mis)

42: y_mis[n] ~ bernoulli_logit(alpha[ii] .* (theta[jj] - beta[ii]));

^

43: }

Apparently, the real argument cannot work for the bernoulli_logit function, while an integer is not accepted in the parameter block. Any suggestions on how to get round this issue?