[R] Repeated measures lme or anova

hadley wickham h.wickham at gmail.com
Sun Jul 6 16:20:30 CEST 2008


On Sun, Jul 6, 2008 at 7:46 AM, Martin Henry H. Stevens
<HStevens at muohio.edu> wrote:
> Hi John,
> 1. I do not know why you remove the intercept in the lme model, but keep it
> in the aov model.
> 2. The distributional assumptions are shot --- you can't run any sort of
> normal model with these data. You might consider some sort of binomial
> (metabolite detected vs. not detected).
> Hank

Following along with Hank's suggestion:

names(df) <- tolower(names(df))
library(reshape)
cast(df, drug1 + drug3 + drug2 ~ ., function(x) sum(x > 0.1))

gives:

  drug1 drug3 drug2 (all)
1     0     0     0     9
2     0     0     1     9
3     0     1     0     4
4     0     1     1     3
5     1     0     0     0
6     1     0     1     0
7     1     1     0     0
8     1     1     1     0

So drug 3 has the most effect, drug 3 about half as much, and drug 2
appears to have no effect.

Looking at the mean metabolite levels, conditional on the presence of
metabolite, gives a slightly richer story:

cast(df, drug1 + drug3 + drug2 ~ ., function(x) mean(x[x > 0.1]))
  drug1 drug3 drug2    (all)
1     0     0     0 471.6033
2     0     0     1 535.9811
3     0     1     0 217.6300
4     0     1     1 393.3667
5     1     0     0      NaN
6     1     0     1      NaN
7     1     1     0      NaN
8     1     1     1      NaN

So under drug 2 doesn't affect the number of people with a detectable
amount of metabolite, but does affect the levels.   (Although you do
need to bear in mind that the values will be more variable when there
are a few patients).  You'd probably also want to look at this on a
patient by patient basis to ensure that those responders are the same
people.

For this sort of data, I'd encourage you to try Mondrian
(http://rosuda.org/mondrian) for some interactive graphical
exploration.

Hadley


-- 
http://had.co.nz/



More information about the R-help mailing list