I am using RStan 2.21.8 and am getting an error when using arrays. Some of the stan code is shown below:

When including Stan code in your post it really helps if you make it as readable as possible by using Stan code chunks (```stan) with clear spacing and indentation. For example, use

```
vector f(vector y, vector theta, real[] x_r, int[] x_i){
vector[1] bmd;
real er;
real bmr;
real beta1;
real beta2;
real beta3;
real tval;
tval = y[1];
bmr = 0.1;
beta1 = theta[1];
beta2 = theta[2];
beta3 = theta[3];
er = er3p(tval, beta1, beta2, beta3);
bmd[1] = bmr - er;
return bmd;
}
}
transformed data {
// Necessary for algebra_solver
array[0] real x_r;
array[0] int x_i;
vector[1] bmd_guess = [0.01]';
real sdose[N_gps];
for (i in 1:N_gps) sdose[i] = dose[i]/scaling_dose;
}
```

I am getting an error that says â€śVariable array does not existâ€ť when I call `array[0] real x_r;`

.

Any suggestions?