I would like to analyse data with a crossover design. Each subject was assigned to a sequence (AB or BA), i.e. 2 periods. Each period consisted of one measurement before treatment (baseline or pre-treatment) and one after treatment.
The data look like:
subject | sequence | period | treatment | time | result 1 AB 1 A pre 5 1 AB 1 A post 7 1 AB 2 B pre 6 1 AB 2 B post 5 ...
I would like to compare pre- and post-treatment results for each treatment. My attempt was to use a mixed model with treatment, sequence, period, time (pre or post-treatment) and interaction between time and treatment.
In R, this would look like:
lme(result ~ treatment + sequence + period + time + time*treatment, random = ~1|subject)
Is this a correct way for comparing the pre- and post-treatment results in a crossover design?