Dear all,

A friend of mine requested me to analyze some data she has generated. I am hoping for some advice on best way of properly analyzing the data as I have never worked with such complicated or nested designs.

Here is the setup. She has taken material from 5 animals and each material is subdivided into 6 plate (30 plates in total). Each plate is then assigned as either a control or a treated with a chemical AND kept at one of three concentrations. A sample is taken daily from each plate for six continuous days and measured (180 measurement in total). Her main question is whether treatment has an effect.

Here is a simulated dataset:

 df <- expand.grid( animal=LETTERS[1:5], group=c("Control", "Treated"),
                    conc=c("X", "Y", "Z"), day=1:6 )
 df$plate <- as.numeric(factor(apply(df[ ,1:3], 1, paste, collapse="")))
 df <- df[ order(df$plate), ]
 df$plate <- as.factor(df$plate)
 rownames(df) <- NULL

 set.seed(1066)
 df$value <- runif(90, 1, 2)*(df$group=="Control") +
             c(0, -0.5, -0.20)[as.numeric(df$conc)] +
             rnorm(30)[ as.numeric(df$plate) ] +
             runif(180, 0.9, 1.1)*df$day + rnorm(180, sd=0.5)

 df[1:10, ]
     animal   group conc day plate     value
 1        A Control    X   1     1 3.3403510
 2        A Control    X   2     1 5.1042965
 3        A Control    X   3     1 5.4003462
 ...
 ...
 178      E Treated    Z   4    30 2.8558186
 179      E Treated    Z   5    30 4.4567206
 180      E Treated    Z   6    30 5.4542460


I have tried analyzing the data as follows:
library(lme4)
lmer( value ~ group + day + conc + (1 | animal/plate), data=df )
lmer( value ~ group + day + conc + (1 | animal), data=df )
lmer( value ~ group + day + conc + (1 | plate), data=df )

BUT I am not sure which of the models above is appropriate. Any advice would be very useful. Many thanks in advance.

Regards, Adai

______________________________________________
R-help@r-project.org 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.

Reply via email to