I am interested in fitting a multi-dimensional IRT model for exploratory item factor analysis. The probability of getting an item correct is a function of an item intercept + slope*theta where both the slope and theta are multidimensional of order k. The problem is that for identification purposes some of the slopes need to be fixed to 0 for the first k items. For example, for item 1 the slope vector would be something like (a, 0, 0,…0) where a is a free parameter for the slope. If we think of the slopes for all the items as consisting of a j x k matrix with j = the number of items, the first k rows of that matrix would be lower triangular with zeros above the diagonal.
My question concerns the process of fixing parameters in Stan. This can be easily done by loops but I wanted to avoid loops. My question is can parameters be fixed to constant values in Stan?
Thanks for your help
Sort of, but if you just want a lower “triangular” but not necessarily square coefficient matrix, you can declare it as
The matrix is not square. it is J x k where J >> k.(e.g., say J = 32 items and k = 5 dimensions). Only the upper k rows are lower triangular. Each row corresponds to the slope elements for a single item. Also we want to apply priors separately for each item - i.e., separately for each row. In essence, the problem is that I am fitting a 1 dimensional IRT model for item 1, and 2 dimensional IRT model for item 2, …, a k-1 dimensional model for item k-1, and a k dimensional IRT model for the rest of the J - (k - 1) items. This is the same thing as fitting a k dimensional model for all items but fixing the appropriate slopes to be equal to zero. This would avoid do loops and conditional if statements.
What I am trying to conceptualize is the simplest way of specifying such a model in Stan.
That is the simplest way. A
does not have to be square. It does have to have zeros for any cell where the column index is greater than the row index. And the values have to be positive for any cell where the column index is equal to the row index.