[R] treatment effect at specific time point within mixedeffects model

Chuck Cleland ccleland at optonline.net
Thu Oct 5 19:18:05 CEST 2006


Afshartous, David wrote:
> Hi Harold,
> 
> Thanks for your response. 
> I'll check out p.224 in P&B, thanks.
> 
> The null hypothesis is that there is no difference between say
> A=[time=3, drug=I] 
> and B=[time=3, drug=P], or mu_A = mu_B.  If the study is a crossover
> design, i.e., 
> each patient receives drug=I and drug=P, I assume that a simple paried
> t-test could
> also be employed at time=3.  
> 
> However, I'd like to test this within a mixed effects model; With
> respect to 3) and 4) below, 
> it seems somewhat difficult to express this specific hypothesis in terms
> 
> of the model paramaters.   Ways in which this null are violated under 
> the mixed effects models could be:
> 
> 1) there is no interaction between time and Drug, i.e., there is a drug
> effect but 
> it is the same at all time points. (the specific interaction in 3) below
> represents 
> the shift of the effect of drug=P from time=1 to time=3 ... so the lack
> of significance of
> the paramater "factor(time)3:drugP" doesn't capture what I want)

  If there is no evidence for an interaction between drug and time, do
you still want to ask about the drug effect at time=3, or would you then
want to ask about the time-averaged drug effect?

> 2) there is neither interaction nor drug effect (variable Drug not
> significant).

> But both these violations are more general than my null; 
> I think testing fixed effects 3) versus 4) below is what I want, but
> this 
> also seems strange since possibly the drug effect and drug:time
> interaction as defined in the model
> are signicant (with time=1 as the reference baseline).

  If you fit a model with an intercept, main effects for drug and time,
and an interaction, would'nt the coefficient for the drug main effect
test the drug effect at a particular time?  Perhaps you only need to
change the contrasts for time so that time=3 is the reference category?

> Regardless, I assume I would need to employ coef() and vcov() to obtain
> the needed 
> info ... but I notice that coef() produces 4 values for the intercept of
> fm1
> below, does anyone know why this occurs?

  I think Harold was getting at the fact that you could get an estimate
of the drug effect at time=3 simply by setting the contrasts for time in
the right way.

> I apologize if my explanation above is confusing, I've tried to make it
> as clear as possible.
> 
> thanks again,
> dave
> 
> 
> 
> -----Original Message-----
> From: Doran, Harold [mailto:HDoran at air.org] 
> Sent: Thursday, October 05, 2006 11:40 AM
> To: Afshartous, David; Spencer Graves
> Cc: r-help at stat.math.ethz.ch
> Subject: RE: [R] treatment effect at specific time point within
> mixedeffects model
> 
> 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: r-help-bounces at stat.math.ethz.ch 
>> [mailto:r-help-bounces at stat.math.ethz.ch] On Behalf Of Afshartous, 
>> David
>> Sent: Thursday, October 05, 2006 11:08 AM
>> To: Spencer Graves
>> Cc: r-help at 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:spencer.graves at pdf.com]
>> Sent: Wednesday, October 04, 2006 7:11 PM
>> To: Afshartous, David
>> Cc: r-help at 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 at 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 at 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 at 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.
> 
> 

-- 
Chuck Cleland, Ph.D.
NDRI, Inc.
71 West 23rd Street, 8th floor
New York, NY 10010
tel: (212) 845-4495 (Tu, Th)
tel: (732) 512-0171 (M, W, F)
fax: (917) 438-0894



More information about the R-help mailing list