I have a linear mixed model that describes the relation between a continuous outcome and the interaction between a binary grouping variable (subjects are 1 out of 2 genotypes) and a time variable (5 consecutive days). Every subject has repeated measures within a day. I have 47 subjects.
Some simulated data:
Genotype <- as.factor(append(rep("X", 230), rep("Y", 240)))
Day <- as.factor(rep(c(1:5), 94))
Subject <- as.factor(rep(c(1:47), times=1, each=10))
jitter <- rep(jitter(0.01*c(1:47)), times=1, each=10)
Outcome <- append(rnorm(230, mean=80, sd=16), rnorm(240, mean=85, sd=18)) + jitter
Data <- data.frame(Genotype, Day, Subject, Outcome)
The model is coded as:
Lmer <- lmer(Outcome ~ Genotype*Day + (1|Subject),
data = Data)
I want to perform bootstrapping. If I calculate bootstrapping results for a specific genotype on Day 1, I use this code:
new_dat <- subset(Lmer, Genotype=="X"& Day=="1")
b <- bootMer(Lmer, nsim=200,
FUN=function(x)predict(x, newdata=new_dat, re.form=NA))
b$t
now gives me a matrix of 46 columns (=N-1) with each 200 identical observations.
My goal is to bootstrap on the subject level, should I then not have only 200 bootstrapping values (thus not 46*200 values)? Am I overlooking something in my code?