Can you please help me by correcting my model or finding me some tutorials, thank you!

YunnanSingleVirus.stan (5.1 KB)

// Per week

for (w in 1 : Nw) {

m_ILIw[w] = 0;

for (i in ((w - 1) * 7 + 1) : (w * 7)) {

m_ILIw[w] = m_ILIw[w] + m_ILI[i];

```
}
```

}

}

model {

//priors

E0 ~ uniform(1, Y_C[1] * 10);

betac ~ normal(1.25, 1);

real R1 = betac / gamma;

Rt_ILI[1] ~ normal(R1, 0.5); // mean values of 2 ~ 3.5 are ok

for (t in 2 : Ni) {

Rt_ILI[t] ~ normal(Rt_ILI[t - 1], 0.5);

}

phiC ~ normal(100, 10);

phiILI ~ normal(100, 10);

// phi ~ uniform(0, 100);

rhoa ~ beta(1, 5);

// asc_ILI ~ exponential(10);

//sampling distribution

Y_C ~ neg_binomial_2(m_c * rhoc, phiC);

for (w in 1 : Nw) {

target += neg_binomial_2_lpmf(Y_ILI | m_ILIw * rhoa, phiILI);

```
nilip[w] ~ binomial(nili[w], Y_ILI[w] / Z_ILI[w]);
```

}

}

generated quantities {

real Rc = betac / gamma;

real log10_rhoa = log10(rhoa);

vector[Nt] IAR = C / N; // cumulative infection attack rate

vector[Nt] beta_t;

for (t in 1 : Nt) {

if (t <= days1[Nt1]) {

beta_t[t] = betac;

} else {

beta_t[t] = beta_t_ILI[t - days1[Nt1]];

}

}

vector[Nt] Re;

for (t in 1 : Nt) {

Re[t] = beta_t[t] / gamma * S[t] / N;

}

array[Nc] int ppd_cases = neg_binomial_2_rng(m_c * rhoc, phiC);

array[Ni] real ppd_ILI;

for (t in 1 : Ni) {

ppd_ILI[t] = neg_binomial_2_rng(m_ILI[t] / 10 * rhoa, phiILI) * 10;

}

}