Overall, my recommendation would be to start with an easier model
Well one problem you're going to have is that your parameter declarations
real<lower=1> lambda;
real<lower=0> luce;
are not consistent with their support:
lambda~uniform(1.01,5);
luce~uniform(.01,1.5);
If you really insist on those uniform priors, which we don't
recommend (see the manual chapter on regression for our recommended
priors and motivation and references), then you need to declare the
variables as
real<lower=1.01, upper=5> lambda;
real<lower=0.01, upper=1.5> luce;
Rather than writing this:
> w_x_a_pos[ii]<-pow(px_a_pos[ii],gamma)/pow((pow(px_a_pos[ii],gamma)+pow((1-px_a_pos[ii]),gamma)),1/gamma);
> w_x_b_pos[ii]<-pow(px_b_pos[ii],gamma)/pow((pow(px_b_pos[ii],gamma)+pow((1-px_b_pos[ii]),gamma)),1/gamma);
> w_y_a_pos[ii]<-pow(py_a_pos[ii],gamma)/pow((pow(py_a_pos[ii],gamma)+pow((1-py_a_pos[ii]),gamma)),1/gamma);
> w_y_b_pos[ii]<-pow(py_b_pos[ii],gamma)/pow((pow(py_b_pos[ii],gamma)+pow((1-py_b_pos[ii]),gamma)),1/gamma);
use
functions {
real foo(real p, real gamma) {
return pow(p, gamma) / pow(pow(p, gamma) + pow(1 - p, gamma), inv(gamma));
}
}
and replace all that cut-and-paste with
w_x_a_pos[ii] <- foo(px_a_pos[ii], gamma);
...
Of course, choose a good name for foo. I have no idea what this model
is doing, though --- power functions can be very unstable if the exponents
are too large or too small.
I'd also recommend replacing all of this cut-and-paste
> vector[items_n_neg-items_n_pos] x_b_neg;
> vector[items_n_neg-items_n_pos] y_b_neg;
> vector[items_n_neg-items_n_pos] px_b_neg;
vector[items_n_neg-items_n_pos] py_b_neg;
with further array indexing, such as
vector[items_n_neg - items_n_pos] neg[2,2];
where neg[1,1] = x_a_neg, neg[1,2] = x_b_neg,
neg[2,1] = y_a_neg, etc. It'll let you replace all
the cut-and-paste with loops and should make the code
much easier to read.
Are you sure that this:
> binval[i]<-exp(luce*vf_b[i])/(exp(luce*vf_a[i])+exp(luce*vf_b[i]));
is going to be identified? Usually a binary logistic like this
is coded using only a single predictor, whereas you have three degrees
of freedom here with luce, vf_b and vf_a.