Seemingly Unrelated Regression example stan manual

Hello everyone, I am currently implementing a multivariate probit specification and as I am new to STAN I am doing this step by step. I am currently stuck with the SUR part, where I take the following user guide source as a benchmark:

The matrix of regressors X is defined to have the dimension (N x J), where the rows represent individuals and columns represent the number of regressors. To me, it seems as if every equation has the exact same value for all covariates as no distinction between the equations is made. Am I seeing something wrong here?

Additionally, when considering the block of code below, beta is multiplied by x[n]. I interpret this as a matrix multiplication between beta (dimension K x J) and x[n] (dimension 1 x J). As this would not make any sense, I believe I am missing something.

parameters {
  matrix[K, J] beta;
  cov_matrix[K] Sigma;
model {
  vector[K] mu[N];
  for (n in 1:N)
    mu[n] = beta * x[n];
  y ~ multi_normal(mu, Sigma);

Could somebody see where I am making the mistake?

First, a note that the version of the users guide you linked to is old. At the top, you’ll find a link to view current version. However, the current version uses syntax that is not available in the version of rstan on CRAN, so it’s worth also answering the question using the old syntax.

Yes, in this example every regression uses the same covariates.

Vectors in Stan are column vectors, so x is an array of N column vectors that are all J x 1.