Notation for crossover designs

David Afshartous writes,

I’m trying to adapt your p.361 code for data where the “groups” are patients w/ measurements over time.

for (j in 1:J){
    a[j] ~ dnorm (a.hat[j], tau.a)
    a.hat[j] <- g.0 + g.1*u[j]
  }

However, since it's a crossover study each patient has data on control and treatment. Thus if u[j] is the treatment indicator, u[j] will not be unique.

I'm relatively new to bugs and haven't seen any examples like this in your book. Is there a simple solution or could you point me to an example of bugs code that covers this?

One option would be to re-number the patient IDs such that the same patient has two IDs, one for control and one for treatment, but as expected this yields different parameter estimates when say running lmer().

PS - FYI, u[j] doesn't seem to be defined previously in the chapter; whereas the rest of the chapter seems to be self-contained. Did I miss something? Where is the variable u first defined?

My reply: In this case, you could use "i" for measurement, j[i] for patient, t[i] for time, and T[i] for treatment. You can then have patient effects and treatment effects and time effects and various potential interactions.

Also, in response to the u[j] question: for the radon example, that's the county-level uranium measurement (thus, a group-level predictor).