# [R] How to analyse simple study: Placebo-controlled (2 groups) repeated measurements (ANOVA, ANCOA???)

Karl Knoblick karlknoblich at yahoo.de
Thu May 17 14:16:45 CEST 2007

```Hallo!

I have two groups (placebo/verum), every subject is measured at 5 times, the first time t0 is the baseline measurement, t1 to t4 are the measurements after applying the medication (placebo or verum). The question is, if there is a significant difference in the two groups and how large the differnce is (95% confidence intervals).

Let me give sample data
# Data
ID<-factor(rep(1:50,each=5)) # 50 subjects
GROUP<-factor(c(rep("Verum", 115), rep("Placebo", 135)))
TIME<-factor(rep(paste("t",0:4,sep=""), 50))
set.seed(1234)
Y<-rnorm(250)
# to have an effect:
Y[GROUP=="Verum" & TIME=="t1"]<-Y[GROUP=="Verum" & TIME=="t1"] + 0.6
Y[GROUP=="Verum" & TIME=="t2"]<-Y[GROUP=="Verum" & TIME=="t2"] + 0.3
Y[GROUP=="Verum" & TIME=="t3"]<-Y[GROUP=="Verum" & TIME=="t3"] + 0.9
Y[GROUP=="Verum" & TIME=="t4"]<-Y[GROUP=="Verum" & TIME=="t4"] + 0.9
DF<-data.frame(Y, ID, GROUP, TIME)

I have heard of different ways to analyse the data
1) Comparing the endpoint t4 between the groups (t-test), ignoring baseline
2) Comparing the difference t4 minus t0 between the two groups (t-test)
3) Comparing the endpoint t4 with t0 as a covariate between the groups (ANOVA - how can this model be calculated in R?)
4) Taking a summary score (im not sure but this may be a suggestion of Altman) istead of t4
5) ANOVA (repeated measurements) times t0 to t5, group placebo/verum), subject as random factor - interested in interaction times*groups (How to do this in R?)
6) as 5) but times t1 to t5, ignoring baseline (How to do this in R?)
7) as 6) but additional covariate baseline t0 (How to do this in R?)