I have nested structure design with the following model:
Yijklt = m + ai + bij + rijk + sikl + (bs)ijkl + eijkl
where i = 1, 2, ..................., s; number of sets
j = 1, 2, ........................, r; number of replications
k = 1, 2, ........................., m; males
l = 1,2,............................, f; females
t = 1, 2, ................, n; progeny
where m is the general mean
ai is the effect of the ith set
bij is effect of jth replication in the ith set
rik is the effect of kth male in the ith set
sikl is the the effect of the lth female to kth male in the ith set
(bs)ijkl is the interaction term
The "non-mixed" model formula in R is as follows:
model <- lm(y ~ set + replication %in% set + male %in%
set + female %in% male %in% set + replication %in%
female %in% male %in% set)
model <- lm(y ~ set + replication:set + male:set + female:male:set + replication:
female:male:set)
What would be its corresponding model in mixed model using lme4 or nlme package in R?
I want to do it right.
Please note that all terms in the new mixed model are random, I just want to estimate variance components associated.
Edits: work out example based on the answers below by @Aaron
library(lme4)
set.seed(5)
d <- expand.grid(set=factor(1:3), male=factor(1:3),female=factor(1:3),
progeny = factor(1:3), replication=factor(1:4))
d$y <- rnorm(nrow(d))
(bs)ijkl
term is different from theeijkl
term, or what role thet
variable plays. (I'll post an example as an answer.) $\endgroup$