I’m new to Stan and met a problem of my first try. I’m using the ARMA from the book to simulate a few data of the future. but it showed me errors in the block. I think the generated quantities block is correct but it has problems.

the code is:

```
ARMA_code ="""
data {
int<lower=1> T;
real y[T];
int<lower=0> n_new;
}
parameters {
real mu;
real phi;
real theta;
real<lower=0> sigma;
}
model {
// real err;
vector[T] nu;
vector[T] err;
nu[1] <- mu + phi * mu;
err[1] <- y[1] - nu[1];
for (t in 2:T) {
nu[t] <- mu + phi * y[t-1] + theta * err[t-1];
err[t] <- y[t] - nu[t];
}
err ~ normal(0,sigma);
mu ~ normal(0,10);
phi ~ normal(0,2);
theta ~ normal(0,2);
sigma ~ cauchy(0,5);
}
generated quantities{
vector[n_new+T] y_new;
// y_new[1:T] <- mu;
vector[n_new] x_pred;
y_new[T+1] = mu+phi*y[T]+theta*err+sigma;
for (i in 2:n_new){
y_new[T+i] = normal_rng(mu+phi*y_new[T+i-1]+theta*err, sigma);
}
}
"""
```

Here is the error in detail:

```
ValueError: Failed to parse Stan model 'anon_model_983af5eff8a1020ec870838c279bf070'. Error message:
SYNTAX ERROR, MESSAGE(S) FROM PARSER:
Info: assignment operator <- deprecated in the Stan language; use = instead.
Info: assignment operator <- deprecated in the Stan language; use = instead.
Info: assignment operator <- deprecated in the Stan language; use = instead.
Info: assignment operator <- deprecated in the Stan language; use = instead.
Variable "err" does not exist.
error in 'unknown file name' at line 35, column 37
-------------------------------------------------
33: // y_new[1:T] <- mu;
34: vector[n_new] x_pred;
35: y_new[T+1] = mu+phi*y[T]+theta*err+sigma;
^
36: for (i in 2:n_new){
------------------------------------------------
```

Additive question:

Can anyone explain what is the process inner of stan when fitting? I already read papers but still confuse.