I’m estimating treatment effects from a long running experiment with thousands of observations for each participant. Because they all start from different baselines I want to use the first two weeks of data before the intervention as a pre-treatment baseline, but I’m uncertain as how to specify that in Stan. The model is along the lines of

$$

y_i = \mu + \mu^{pre}*{s[i]} + \tau*{t[i]} + \alpha_{g[i]} + \beta X_i + \epsilon

$$

where $\mu^{pre}_{s[i]}$ is the subject specific baseline. I guess I can specify two models for pre- and post-treatment e.g.

```
y_pre ~ normal(intercept + baseline[subject_ind_pre], sigma_eps);
y_post ~ normal(intercept + baseline[subject_ind_post] + treatment[treatment_ind_post], sigma_eps);
```

but how do I make sure `baseline`

is only learnt from the pre-treatment data? Or is that not necessary?