Hi Stan users and experts,
May you help me with the following:
1- For model identification, I’m trying to apply a sum-to-zero constaint to the difficulty paramter (beta) such that the difficulty value for
the last item (J) is the negative sum of all (J-1) items. This should be held for each class (k).
However, based on the error I get, the sum can only be done for a vector, not a vector with arrays, vector [ ]
Any idea how to solve this issue? Here is part of my code that is related to this:
data {
int<lower=1> K ; // number of classes
int<lower=1> N ; // number of persons
int<lower=1> J ; // number of items
int<lower=0,upper=1> y[N,J] ; // response data set
}
parameters {
simplex[K] pi ; // mixing proportions
vector[N] theta ; // ability parm
ordered[K] mu ; // mean ability parm
ordered[K] beta[J] ; // difficulty parm
}
transformed parameters {
vector[K] beta_c[J] ;
for (j in 1:(J-1)) {
for (k in 1:K){
beta_c[j,k] = beta[j,k] ;
}}
for (k in 1:K){
for (j in 1:(J-1)) {
beta_c[J,k] = -1*sum(beta[j,k]); // (Error location)
}}
}
2- Since the number of items in my model do not exceed 30 items, does soft centering (i.e. beta ~ (0,1) ) is adequate for moel identifcation or is
it necessary to apply the sum-to-zero constaint to this paramter?
3- Last quations, with respect to label switching (in mixture model), I apply ordere constaint to 2 paramters, mu and beta,
is this correct, or I should apply this constrain to one parameter only ?
Thank you!