Hello,

I’m trying to use the generated quantities block in Pystan and it seems to be throwing an error.

```
liability_code = """
data {
int<lower=0> N;
vector[N] BIlmt_model2;
vector[N] multi_policy_count_model;
vector[N] unit_value_model2;
vector[N] yrs_owned_model2;
vector[N] credit_c5_score;
vector[N] credit_c6_score;
vector[N] c6_2;
vector[N] c6_3;
vector[N] credit_52778_score;
vector[N] nohit_52778;
vector[N] thinfile_52778;
vector[N] class_model2_Sport;
vector[N] class_model2_Street;
vector[N] class_model2_other;
vector[N] Single_Driver_Age_model;
vector[N] Driver_Age_model;
int<lower=0> y1[N];
int<lower=0> N_new;
vector[N_new] BIlmt_model2;
vector[N_new] multi_policy_count_model;
vector[N_new] unit_value_model2;
vector[N_new] yrs_owned_model2;
vector[N_new] credit_c5_score;
vector[N_new] credit_c6_score;
vector[N_new] c6_2;
vector[N_new] c6_3;
vector[N_new] credit_52778_score;
vector[N_new] nohit_52778;
vector[N_new] thinfile_52778;
vector[N_new] class_model2_Sport;
vector[N_new] class_model2_Street;
vector[N_new] class_model2_other;
vector[N_new] Single_Driver_Age_model;
vector[N_new] Driver_Age_model;
}
parameters {
real BIlmt_coeff;
real unit_value_model2_coeff;
real yrs_owned_model2_coeff;
real credit_c5_score_coeff;
real credit_c6_score_coeff;
real c6_2_coeff;
real c6_3_coeff;
real credit_52778_score_coeff;
real thinfile_52778_coeff;
real nohit_52778_coeff;
real class_model2_Sport_coeff;
real class_model2_Street_coeff;
real class_model2_other_coeff;
real Single_Driver_Age_model_coeff;
real Driver_Age_model_coeff;
real intercept; // parameter for mean or intercept
}
model {
BIlmt_coeff ~ normal(0, 1);
unit_value_model2_coeff ~ normal(0, 1);
yrs_owned_model2_coeff ~ normal(0, 1);
credit_c5_score_coeff ~ normal(0, 1);
credit_c6_score_coeff ~ normal(0, 1);
c6_2_coeff ~ normal(0, 1);
c6_3_coeff ~ normal(0, 1);
credit_52778_score_coeff ~ normal(0,1);
thinfile_52778_coeff ~ normal(0,1);
nohit_52778_coeff ~ normal(0,1);
class_model2_Sport_coeff ~ normal(0, 1);
class_model2_Street_coeff ~ normal(0, 1);
class_model2_other_coeff ~ normal(0, 1);
Single_Driver_Age_model_coeff ~ normal(0, 1);
Driver_Age_model_coeff ~ normal(0, 1);
intercept ~ normal(0,5);
y1 ~ poisson_log(BIlmt_model2*BIlmt_coeff + multi_policy_count_model*.9 + \
unit_value_model2*unit_value_model2_coeff + yrs_owned_model2*unit_value_model2_coeff +\
yrs_owned_model2*yrs_owned_model2_coeff + credit_c5_score*credit_c5_score_coeff +\
credit_c6_score*credit_c6_score_coeff + c6_2*c6_2_coeff + c6_3*c6_3_coeff +\
class_model2_Sport*class_model2_Sport_coeff + class_model2_Street*class_model2_Street_coeff +\
class_model2_other*class_model2_other_coeff + \
Single_Driver_Age_model*Single_Driver_Age_model_coeff + \
Driver_Age_model*Driver_Age_model_coeff + credit_52778_score*credit_52778_score_coeff + \
thinfile_52778*thinfile_52778_coeff + nohit_52778*nohit_52778_coeff + intercept);
}
generated quantities {
vector[N_new] y_new;
for (n in 1:N_new)
y_new[n] = poisson_log(BIlmt_model2[n]*BIlmt_coeff + multi_policy_count_model[n]*.9 + \
unit_value_model2_ne*unit_value_model2_coeff + yrs_owned_model2[n]*unit_value_model2_coeff +\
yrs_owned_model2_ne*yrs_owned_model2_coeff + credit_c5_score[n]*credit_c5_score_coeff +\
credit_c6_score[n]*credit_c6_score_coeff + c6_2[n]*c6_2_coeff + c6_3[n]*c6_3_coeff +\
class_model2_Sport[n]*class_model2_Sport_coeff + class_model2_Street[n]*class_model2_Street_coeff +\
class_model2_other[n]*class_model2_other_coeff + \
Single_Driver_Age_model[n]*Single_Driver_Age_model_coeff + \
Driver_Age_model[n]*Driver_Age_model_coeff + credit_52778_score[n]*credit_52778_score_coeff + \
thinfile_52778[n]*thinfile_52778_coeff + nohit_52778[n]*nohit_52778_coeff + intercept);
}
```

This is throwing

```
ValueError: Failed to parse Stan model 'anon_model_e4b33c3d25ec074c3b0ac0b520ba39ea'. Error message:
SYNTAX ERROR, MESSAGE(S) FROM PARSER:
Duplicate declaration of variable, name=BIlmt_model2; attempt to redeclare as vector in data; previously declared as vector in data
error in 'unknown file name' at line 24, column 30
-------------------------------------------------
22: int<lower=0> N_new;
23:
24: vector[N_new] BIlmt_model2;
^
25: vector[N_new] multi_policy_count_model;
-------------------------------------------------
```

I’m not sure what I’m doing wrong.