I am currently trying to analyse data from a crossover study. In brief, the study is of a crossover design, where each participant takes part in 2 separate sessions, where they play a game. This game repeatedly measures a few different variables, let's call one reaction time. During one session, reaction time is measured 30 times. Before one of the sessions, each participant is given either placebo or treatment, and half the participants receive placebo the first time, and half receive treatment the first time. Consequently, each participant has 60 data points, were 30 are under placebo, and 30 are under treatment.

I am aware that crossover studies have their own considerations, but at the moment I am stuck with how to properly fit a mixed model for this data. The way I understand it, I need to tell the model what a subject is (i.e., that the 60 measurements for every participant are correlated), but it has also been pointed out to me that the 30 measurements of each session are also correlated, and need to be defined as such in the model, before I try to parse out the within-subject effect of the treatment.

Can anyone verify this, and possibly tell me how to best to this? I use SAS, and my code looks like this at the moment:

proc mixed data=test;
  class ID Session Drug MeasurePoint Sequence;
  model ReactionTime=Drug Sequence Session MeasurePoint / ddfm=kenwardroger;
  random int / subject=ID;
  repeated MeasurePoint / subject=ID*Drug type=ar(1);
  lsmeans Drug / diff;

Sequence refers to the sequence of drug / placebo, and MeasurePoint to the order of the measurements during each session. I am not overly interested in the effect of time over each session.

Also, is the ar(1) covariance matrix proper?

  • 1
    $\begingroup$ (To whom it may concern: although this requires SAS expertise to answer, it seems to me it is as much a statistical question as a coding question.) $\endgroup$ Sep 5, 2016 at 15:21

1 Answer 1


Firstly, you have multiple observations per subject and per period. As you correctly point out the correlation within subject across session and within the periods needs to be accounted for. There are a number of ways to express this in SAS e.g. "repeated session ID".

Generally, when you know nothing else making very strong assumptions about the correlation structure over time (e.g. type=AR(1) or type=CS or just having a random subject effect on the intercept) is not advisable. In my experience AR(1) tends to treat the furthest apart observations as if they were independent and you end up pretending like you have several times your actual number of (independent) subjects, when you do not. This can lead to a substantial overconfidence in the analysis results with confidence intervals having very poor coverage. If you have sufficient data, it is usually recommended to use an unstructured covariance matrix. One way to specify this here is to write "repeated measurement session / subject=ID type=UN@CS;", when there is only two sessions.

Can you actually identify the effects of drug, session and sequence all at once in a 2 period 2 treatment 2 sequence cross-over? Is drug not a linear combination of session and sequence?


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.