Vectorization and improving speed for a complex mixture type latent trait model for response times

I also tried this. @mike-lawrence suggested something similar in an earlier post

For some reason, it gives me this error message when compiling model. I don’t understand why.

That’s why I still keep these in the for loop.

 ------------------------------------------------- 
    65:    vector[n_obs] p_t   = item[i_loc,2] - person[p_loc,1];
                                 ^
    66:    vector[n_obs] p_t   = item[i_loc,2] - person[p_loc,2];
    67:    vector[n_obs] alpha = 1/exp(item[i_loc,1]);
   -------------------------------------------------

Ill-typed arguments supplied to infix operator -. Available signatures: 
(int, int) => int
(real, real) => real
(real, vector) => vector
(vector, real) => vector
(vector, vector) => vector
(complex, complex) => complex
(real, row_vector) => row_vector
(row_vector, real) => row_vector
(row_vector, row_vector) => row_vector
(real, matrix) => matrix
(matrix, real) => matrix
(matrix, matrix) => matrix
(complex, complex_vector) => complex_vector
(complex_vector, complex) => complex_vector
(complex_vector, complex_vector) => complex_vector
(complex, complex_row_vector) => complex_row_vector
(complex_row_vector, complex) => complex_row_vector
(complex_row_vector, complex_row_vector) => complex_row_vector
(complex, complex_matrix) => complex_matrix
(complex_matrix, complex) => complex_matrix
(complex_matrix, complex_matrix) => complex_matrix
Instead supplied arguments of incompatible type: array[] real, array[] real.