[R] repeated measurements with R

Pallier Christophe-INSERM U.562 pallier at lscp.ehess.fr
Wed Jan 21 13:41:13 CET 2004

>The problem is the following:
>We have 2 different solutions (samples), which are filtered and then
>the concentration of the filtrate is measured.
>We want to evaluate how the filter proces and the concentration
>measurement influences the detection of the difference of the two
>solutions and which step has which influence. So we filter the 2
>solutions each 6 times and get 12 filterd solutions. each of this
>filtrate is measured 8 times, so we get 12 *8 96 conc. values. i get a
>data table of:
>solution nr.filter nr.measures conc.
>1 or 2    1 till 6  1-till 8    96 values
>because the concentrations are "repeated measurements" as i was told
>by a statistician (i am not) it is not allowed to make a anova with
>the formula: conc~solution+nr.filter+nr.measures.
>my question is: 
>how can i solve this in R?
R can handle some repeated measurements designs with the 'Error' term in 
the formula provided to aov.
(see the section on multistratum models in MASS)
(if you can read French, some examples are provided  in a small tutorial 
about R available at 
http://www.pallier.org/ressources/stats_with_R/stats_with_R.pdf (work in 

More complex designs can be analysed with lme (described in the book 
Mixed Effects models in S and S-PLUS by Pinheiro and Bates)
But, you should first precise your questions, that is make clear what is 
the unit of analysis, and wether
 'solution', 'nr.filter' and 'nr.measures'  are random or fixed factors.

*Maybe* your problem can be desribed in the following way (?)

you had twelve samples (=filtered solutions) which came from two 
solutions and you applied the same 6 different filtering processes to each
of these samples. Solution and nr.filter are fixed factors, and you are 
interested in assessing their main effects and interaction.

If this is indeed the structure of your problem, then you should define 
a new factor 'sample' with 12 levels equal to 'solution:nr.measure', and 
use the following formula for the anova:


Do not use this if you do not understand the hypotheses underlying this 
For example, if you believe that there is an effect of the time at which 
the samples
were taken from the solution, then this approach is not valid.

If solution and/or filter are  random factors, then the analysis will 
also differ...

Christophe Pallier

More information about the R-help mailing list