From: Dov Stekel <d.j.stekel_at_bham.ac.uk>

Date: Tue 01 Aug 2006 - 04:02:51 EST

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. Received on Tue Aug 01 06:56:50 2006

Date: Tue 01 Aug 2006 - 04:02:51 EST

Douglas

That's very helpful! It's just a syntax error in my use of lme (I find the documentation hard to figure!). I'm actually also using the formula

lme(Measurement~Treatment/When etc)

as this gives the right contrasts to look at the interactions between each of the treatments and before/after. I'm still working on a model formula that will give me a single p-value for 'is the difference between before and after different for different treatments'.

And this all feels much happier than not using a random effects model and simply using patient as a blocking variable (i.e. Measurement ~ Treat/When + Patient) which seems unsatisfactory for independence reasons. (I'm not really a statistician - just the most stats-savvy person in my department!)

On 31 Jul 2006, at 18:38, Douglas Bates wrote:

> On 7/31/06, Dov Stekel <d.j.stekel@bham.ac.uk> wrote:

*>> Hi
**>>
**>> I have been asked by a colleague to perform a statistical analysis
**>> which uses random effects - but I am struggling to get this to work
**>> with nlme in R. Help would be very much appreciated!
**>>
**>> Essentially, the data consists of:
**>>
**>> 10 patients. Each patient has been given three different treatments
**>> (on
**>> three separate days). 15 measurements (continuous variable) have been
**>> taken from each patient both before and after each of the treatments.
**>> So the data looks like:
**>>
**>> Patient When Treat Measurement
**>> a before A 10.3
**>> a before A 11.2
**>> ...
**>> a after A 12.4
**>> ...
**>> a before B 11.6
**>> ...
**>> a after B ...
**>>
**>> and the same for treatment C, patients, b,c,d, etc.
**>>
**>> My colleague would like to test to see if the treatments are different
**>> from each other. i.e., is the change (before to after) due to the
**>> treatments different between the treatments. It would seem to me like
**>> a
**>> random effects model in which we are interested in the significance of
**>> the interaction terms Treat:When, with repeated measures in the
**>> patients (who are random effects, but crossed with the covariates).
**>> Unfortunately, the groupedData formula only lets me put a single
**>> covariate on the LHS - nothing as complicated as this!
**>
**> I'm not sure I understand what the LHS of a formula for a groupedData
**> object has to do with your question.
**>
**> You will need to specify the model that you wish to fit by lme and,
**> for that, you will need to decide which terms should be fixed effects
**> and which random effects. Do you think that the patients contribute
**> only an additive shift in the response or do you think that the
**> patients may have different initial values and different levels of
**> change in the Before/After responses?
**>
**> It seems that you could begin by fitting
**>
**> fm1 <- lme(Measurement ~ When*Treat, random = ~ 1 | Patient, data =
**> ...)
**>
**> and
**>
**> fm2 <- lme(Measurement ~ When*Treat, random = ~ 1|Patient/When, data =
**> ...)
**>
**> There are many other variations that you could consider but we can
**> only guess at because we don't know enough of the context of the data.
**> For example, it is possible that it would be appropriate to eliminate
**> a main effect for Treat because the Treatment cannot be expected to
**> influence the measurement before the Treatment is applied. The
**> fixed-effects term would then be specified as
**>
**> fm3 <- lme(Measurement ~ When + When:Treat, random = ...)
**>
**>>
**>> I could, of course, advise her to simply combine all 30 data points
**>> for
**>> each treatment in each patient into a single number (representing
**>> difference between before and after), but is there a way to use all
**>> the
**>> data in an LME?
**>>
**>> Thanks!
**>>
**>>
**>> Dov
**>>
**>>
**>>
**>> **************************************************************
**>>
**>> Dr Dov Stekel
**>> Lecturer in Bioinformatics
**>> School of Biosciences
**>> University of Birmingham
**>> Birmingham B15 2TT
**>> Tel: +44 121 414 4209
**>> Email: d.j.stekel@bham.ac.uk
**>>
**>> ______________________________________________
**>> 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.
**>>
**>>
*

Dr Dov Stekel

Lecturer in Bioinformatics

School of Biosciences

University of Birmingham

Birmingham B15 2TT

Tel: +44 121 414 4209

Email: d.j.stekel@bham.ac.uk

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. Received on Tue Aug 01 06:56:50 2006

Archive maintained by Robert King, hosted by
the discipline of
statistics at the
University of Newcastle,
Australia.

Archive generated by hypermail 2.1.8, at Tue 01 Aug 2006 - 10:18:20 EST.

*
Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help.
Please read the posting
guide before posting to the list.
*