Simple question (I hope).
I have the following experimental design:
Two groups: A, B (let's say they represent the two sexes), where I randomly sampled 4 subjects from each group, and measured blood pressure of each subject 3 times (let's say in 3 random time points during the day)
Here's an R example of my data:
set.seed(1) my.df <- data.frame(group = as.factor(c(rep("A",12),rep("B",12))), subject = c(sapply(c("A","B"), function(x) c(sapply(1:4, function(y) rep(paste(x,y,sep="."),3))))), measurement = c(c(sapply(rnorm(4,0,2), function(x) rnorm(3,x,1))),c(sapply(rnorm(4,0.2,1), function(x) rnorm(3,x,1)))))
What I want to test is whether the blood pressure is significantly different between the two groups, but I want to account for the random effects the subjects may have.
As far as I understand, if I had many more measurements for each subject the appropriate model would be a mixed effects model where the fixed effect is the group and the random effect is subject. For example, using the
lme4 package this would be:
fit <- lmer(measurement ~ group + (1|subject), data = my.df)
But only having 3 measurements for each subject doesn't allow a powerful estimation of the random effect. So my question is what is the appropriate alternative?
- Ignore subject and therefore use a fixed effects model.
- Perhaps use subject as a nested fixed effect, if such a thing exists?
- Any other alternatives