Simple linear regression with predictions looks like this:

```
data {
int<lower=1> D;
int<lower=1> N;
matrix[N, D] X;
vector[N] Y;
int<lower=1> N_pred;
matrix[N_pred, D] X_pred;
}
parameters {
real a;
vector[D] b;
real<lower=1> s;
}
model {
vector[N] mu = (X * b) + a;
Y ~ normal(mu, s);
}
generated quantities {
vector[N_pred] Y_pred;
{
vector[N_pred] mu_pred = (X_pred * b) + a;
Y_pred = normal_rng(mu_pred, s);
}
}
```

Sometimes, though, after compiling the model specified by this code, I just want to fit some parameters, and donât want to generate any posterior predictive distributions. But because itâs been specified as above, if I donât pass `N_pred`

and `X_pred`

variables to STAN at runtime, it yells at me (totally fairly!). I usually get around this by just passing in data which has `N_pred`

set equal to `N`

and `X_pred`

equal to `X`

but that seems really dumb and a waste of compute cycles when I donât care about that stuff at all.

Is there any way to code this model so that, at sampling time, after compilation is long-since-finished, I have the option to either pass in `N_pred`

and `X_pred`

and have the `generated quantities`

code run as written *or* pass in neither of those pieces of data and have the sampling process completely skip the generated quantities section entirely? Iâd be totally fine if to achieve that goal I was required to have a variable in the `data`

block called `should_i_generate_quantities`

that I would need to be set to `1`

when I want to give both extra bits of data and run the last block and be set to `0`

when I donât want to bother with anything related to the last block.

Thanks!