[R] treatment effect at specific time point within mixed effects model
Afshartous, David
afshart at exchange.sba.miami.edu
Tue Sep 26 17:13:01 CEST 2006
All,
The code below is for a pseudo dataset of repeated measures on patients
where there is also a treatment factor called "drug". Time is treated
as categorical.
What code is necessary to test for a treatment effect at a single time
point,
e.g., time = 3? Does the answer matter if the design is a crossover
design,
i.e, each patient received drug and placebo?
Finally, what would be a good response to someone that suggests to do a
simple t-test (paired in crossover case) instead of the test above
within a mixed model?
thanks!
dave
z = rnorm(24, mean=0, sd=1)
time = rep(1:6, 4)
Patient = rep(1:4, each = 6)
drug = factor(rep(c("I", "P"), each = 6, times = 2)) ## P = placebo, I =
Ibuprofen
dat.new = data.frame(time, drug, z, Patient)
data.grp = groupedData(z ~ time | Patient, data = dat.new)
fm1 = lme(z ~ factor(time) + drug + factor(time):drug, data = data.grp,
random = list(Patient = ~ 1) )
More information about the R-help
mailing list