Thurstonian model

Great, many thanks Bob.

My function was doing the same as the Stan function sort_indices_asc(). I was trying to implement something similar to this (from A Cognitive Model for Aggregating People's Rankings):

image

Just to be confusing I’ve called the variable x, z in my Stan code. I’ve managed to get it working now when sigma is fixed to 1. It seemed that changing the line

z[i, y_argsort[i]] ~ normal(mu, 1));

to this:

z[i] ~ normal(mu[y_argsort[i]], 1`);

did the trick. My understanding of the model is that each sample of latent ratings for person j (x_j in the model above) should have the same rank as the observed data for person y (y_j). Or equivalently, if x_j is sorted according to sort_indices_asc(y_j), the ratings should then be in ascending order (so the ordered vector could be used for the model constraint).

It actually seems to work quite well now when I try it with the data from the paper above.

My next problem is identifying the model. In the paper they allow sigma to vary by rater, but they did not identify the model (they just post processed the samples). This does not work at all well in Stan

I wonder if anyone knows how I might identify this model sensibly?

All the best,

Oscar

For anyone is interested, the full Stan code is now:

data {
int<lower=0> K; // number of items being ranked
int<lower=0> J; // number of raters
int<lower=1,upper=K> y[J,K]; // y[i] is a vector of

real<lower = 0> mu_sd_prior;
}

transformed data{

int y_argsort[J, K];

for (i in 1:J){
y_argsort[i] = sort_indices_asc(y[i]);
}
}

parameters {
vector[K-1] mu_hat;
//real<lower=0> sigma[J];
ordered[K] z[J];
}

transformed parameters{
vector[K] mu;
mu = append_row(0, mu_hat);
}

model {

mu_hat ~ normal(0, mu_sd_prior);
//sigma ~ cauchy(0, 1);
for (j in 1:J){
z[j] ~ normal(mu[y_argsort[j]], 1); //I would like this to be: z[j] ~ normal(mu[y_argsort[j]], sigma[j]); But I’m not sure how to identify the model
}

}