Hello,
I am trying to use the categorical_logit function in stan. But I am getting an error:
Error in stanc(filename, allow_undefined = TRUE) : 0
Semantic error in ‘string’, line 34, column 8 to column 123:
Ill-typed arguments to ‘~’ statement. No distribution ‘categorical_logit’ was found with the correct signature.
My model is:
data {
int <lower=1> I; // number of students
int <lower=1> J; // number of tasks
int <lower=1> K; // number of instructors
int <lower=2> L; // number of possible scores
int <lower=1, upper=L> Outcomes[I,J,K]; // the observed score of the nth rating
}
parameters {
real beta_0;
vector[I] student_ability;
vector[J] task_diff;
vector[K] instructor_sev;
vector[L] tau;
}
model {
// priors
beta_0 ~normal(0,1);
for(i in 1:I){
student_ability[i] ~normal(0,1);
}
for(j in 1:J){
task_diff[j] ~normal(0,1);
}
for(k in 1:K){
instructor_sev[k] ~normal(0,1);
}
for(l in 1:L){
tau[l] ~normal(0,1);
}
// likelihood
for(i in 1:I){
for(j in 1:J){
for(k in 1:K){
Outcomes[i,j,k]~categorical_logit(beta_0+student_ability[i]+task_diff[j]+instructor_sev[k]+tau[Outcomes[i,j,k]]);
}
}
}
}
I need to figureout this error. I am new to stan and can not understand about this error.
Thank you.