# Re: [R] treatment effect at specific time point within mixed effects model

From: Spencer Graves <spencer.graves_at_pdf.com>
Date: Wed 04 Oct 2006 - 23:11:21 GMT

Consider the following modification of your example:

fm1a = lme(z ~ (factor(Time)-1)*drug, data = data.grp, random = list(Patient = ~ 1) )

summary(fm1a)
<snip>

```                         Value Std.Error DF    t-value p-value
factor(Time)1       -0.6238472 0.7170161 10 -0.8700602  0.4047
factor(Time)2       -1.0155283 0.7170161 10 -1.4163256  0.1871
factor(Time)3        0.1446512 0.7170161 10  0.2017405  0.8442
factor(Time)4        0.7751736 0.7170161 10  1.0811105  0.3050
factor(Time)5        0.1566588 0.7170161 10  0.2184871  0.8314
factor(Time)6        0.0616839 0.7170161 10  0.0860286  0.9331
drugP                1.2781723 1.0140139  3  1.2605077  0.2966
factor(Time)2:drugP  0.4034690 1.4340322 10  0.2813528  0.7842
factor(Time)3:drugP -0.6754441 1.4340322 10 -0.4710104  0.6477
factor(Time)4:drugP -1.8149720 1.4340322 10 -1.2656424  0.2343
```
factor(Time)5:drugP -0.6416580 1.4340322 10 -0.4474502 0.6641 factor(Time)6:drugP -2.1396105 1.4340322 10 -1.4920240 0.1666
```      Does this answer your question?
Hope this helps.
Spencer Graves

```

Afshartous, David wrote:
>
> 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) )
>
> ______________________________________________
> R-help@stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help