Hi David: In looking at your original post it is a bit difficult to ascertain exactly what your null hypothesis was. That is, you want to assess whether there is a treatment effect at time 3, but compared to what. I think your second post clears this up. You should refer to pages 224- 225 of Pinhiero and Bates for your answer. This shows how to specify contrasts.
> -----Original Message----- > From: [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED] On Behalf Of > Afshartous, David > Sent: Thursday, October 05, 2006 11:08 AM > To: Spencer Graves > Cc: r-help@stat.math.ethz.ch > Subject: Re: [R] treatment effect at specific time point > within mixedeffects model > > Hi Spencer, > > Thanks for your reply. > I don't think this answers my question. > > If I understand correctly, your model simply removes the > intercept and thus the intercept in fm1 is the same as the > first time factor in fm1a ... but am I confused as to why the > other coefficient estimates are now different for the time > factor if this is just a re-naming. > The coefficient estimates for the interactions are the same > for fm1 and fm1a, as expected. > > But my question relates to the signifcance of drug at a > specific time point, e.g., time = 3. The coeffecieint for > say "factor(time)3:drugP" measures the interaction of the > effect of drug=P and time=3, which is not testing what I want > to test. Based on the info below, I want to compare 3) versus 4). > > 1) time=1, Drug=I : Intercept > 2) time=1, Drug=P : Intercept + DrugP > 3) time=3, Drug=I : Intercept + factor(time)3 > 4) time=3, Drug=P : Intercept + factor(time)3 + DrugP + > factor(time)3:drugP > > I'm surprised this isn't simple or maybe I'm missing > something competely. > > thanks > dave > > > > > > -----Original Message----- > From: Spencer Graves [mailto:[EMAIL PROTECTED] > Sent: Wednesday, October 04, 2006 7:11 PM > To: Afshartous, David > Cc: r-help@stat.math.ethz.ch > Subject: Re: [R] treatment effect at specific time point > within mixed effects model > > 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 > > PLEASE do read the posting guide > > http://www.R-project.org/posting-guide.html > > and provide commented, minimal, self-contained, reproducible code. > > > > ______________________________________________ > R-help@stat.math.ethz.ch mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide > http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. > ______________________________________________ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.