[R-sig-ME] How to analyze a 2x2 crossover with baseline in R?

Emmanuel Curis emmanuel.curis at parisdescartes.fr
Tue Jun 11 19:58:44 CEST 2013


Hello,

Thank you very much for the hint and the sample code. I'll make some
tests with this, and take the time to carefully write the needed
contrasts, including in addition the Sequence effect...

On Mon, Jun 10, 2013 at 06:09:16PM +0000, Ben Bolker wrote:
« Emmanuel Curis <emmanuel.curis at ...> writes:
« 
«   The basic recipe here is to collapse your analysis into
« a one-way analysis and then (hopefully) to reconstruct the
« desired the contrasts.  I started to do this (below), but didn't
« have quite enough time to finish it ...
« 
« 
« library("nlme")
« try(m1 <- lme( X7_SRF ~ Traitement + Periode, random = ~ 1|Numero,
«        data = donnees,
«        control = list( msVerbose = TRUE ) ))
« 
« donnees <- transform(donnees,TP=interaction(Traitement,Periode,drop=TRUE))
« 
« m2 <- lme( X7_SRF ~ TP, random = ~ 1|Numero,
«        data = donnees,
«        control = list( msVerbose = TRUE ) )
« summary(m2)$tTable
« 
« I didn't succeed in the rest of this, but see
« http://www.math.mcmaster.ca/~bolker/classes/s4c03/hw/hw2_s4c03.pdf
« OR:
« http://stackoverflow.com/questions/9335708/
«    contrasts-for-lm-using-contrast-package
« (broken URL)
« 
« for more information ...
« 
« contr1 <- matrix(
«                  c(1,0,0,0,0,             # baseline
«                     -1,1/2,1/2,0,0,       # baseline vs M1
«                     0,-1/2,-1/2,1/2,1/2, # M1 vs M2
«                    -1,1/2,0,1/2,0,       # baseline vs placebo
«                     0,-1/2,1/2,-1/2,1/2), # placebo vs treatment
«                     ## 0,1/2,-1/2,-1/2,1/2), # interaction:
«                                           # (T2-P2)-(T1-P1) = T2+P1-T1-P2
«               byrow=TRUE,ncol=5,
«       dimnames=list(c("b","b_vs_M1","M1_vs_M2","b_vs_P","P_vs_T"),
«                       c("B","PM1","TM1","PM2","TM2")))
«                   
« solve(contr1)
« 
« _______________________________________________
« R-sig-mixed-models at r-project.org mailing list
« https://stat.ethz.ch/mailman/listinfo/r-sig-mixed-models

-- 
                                Emmanuel CURIS
                                emmanuel.curis at parisdescartes.fr

Page WWW: http://emmanuel.curis.online.fr/index.html



More information about the R-sig-mixed-models mailing list