I am looking at a 2x2 crossover study with period-specific baseline measurements and the according post-treatment outcome values
- Intervention (A or B)
- Sequence (AB or BA)
- Period (visit day1 and visit day2)
- some numerical outcome (y=post treatment, x=baseline pre treatment)
So basically I've got four measurements (x1, y1, x2, y2) for each participant within sequence 'AB' and 'BA'. The dataset is in long format for "Period" (day 1 and day 2), but baseline and post-treatment values are in separate columns.
I fit the following SAS model (with baseline differences as covariate):
PROC MIXED DATA=MIXED_ALL;
CLASSES Sequenz Periode Intervention ID;
MODEL y=xdiff Sequenz Periode Intervention /DDFM=SATTERTH solution e3;
REPEATED Periode/SUBJECT=ID(Sequenz) TYPE=UN;`
ESTIMATE 'trteff' Intervention 1 -1/CL;
LSMEANS Intervention /pdiff e;
which gives the same results - same estimates, same df - as the R Code:
lme(y ~ Intervention + Periode + Sequenz + xdiff, random = ~Periode|ID/Sequenz, data = MIXED_ALL, REML=T)
Now 2 questions arise. 1) With lme I can't switch to ddfm=Kenward-Rogers. Yet, I am not able to reproduce the code with lmer()
lmer(y ~ Intervention + Periode + Sequenz + xdiff + (Periode|ID) + (Periode|ID:Sequenz), data=MIXED_ALL)
is apparently the wrong syntax as it gives me errors.
2) I am trying to jointly model (x1,y1,x2,y2) (see Merothra, A recommended analysis for 2 × 2 crossover trials with baseline measurements)
The data is reshaped into long format over the 4 visits (4 repeated measures for each participant x1, y1, x2, y2). We've got 8 blocks now: base1, post1, base2, post2 for sequence "AB" and "BA".
According to these blocks dummy variables t1 to t8 are specified.
- Intervention (A or B)
- Sequence (AB or BA)
- visit (visit1=base1, visit2=post1, visit3=base2, visit4=post2)
- t1=1 if visit1=1, 0 otherwise
- t3=1 if visit3=1, 0 otherwise (the expected values for base1 are equal for sequence AB and BA, same holds for base2)
- t2, t4, t6, t8 are the post values for the two different days and the according treatment sequence group
CLASSES Sequenz visit ID;
MODEL y=t1 t2 t3 t4 t6 t8/NOINT solution e3;
REPEATED visit/SUBJECT=ID(Sequenz) TYPE=UN;`
ESTIMATE 'trteff' t2 1 t4 -1 t6 -1 t8 1/DIVISOR=2 CL;
I am not able to reproduce this code in R. The degrees of freedom are completely different (around times 3). Can anyone help to translate the SAS code above to R?