Hi,

This is my first time using Stan in R for HMC and I encountered the error “Mismatched array dimensions. Base type mismatch. Returned expression does not match return type LHS type = real; RHS type = real[ , ] Improper return in body of function.”, which showed at the first line of my second function MUPPpr when I try to build my own model functions to fit data. My full Stan code for my model is shown below:

```
functions{
real SSpr(vector a, vector b,vector t, int n_student, int n_item, int n_dimension){
real num0[n_student, n_item];
real num1[n_student, n_item];
real denominator[n_student, n_item];
real sspr[n_student, n_item];
real thdim[n_student, n_item];
real th[n_student, n_dimension];
int d[n_item];
return sspr;
}
```

Can anyone help me with this error? Thanks!