The random-slope linear mixed model is
with independence between the random effects and errors. The estimates are
Incubators are treated as exchangeable representatives of possible growth environments, so a random slope permits their growth rates to differ while estimating a population mean growth rate. The formula 0+hours deliberately removes a random intercept: larvae are assigned only after hatching, so it is reasonable to assume no incubator-specific baseline at time zero. Random assignment supports this common-baseline assumption in expectation; it does not prove that observed initial sizes or other baseline differences are exactly identical.
For a new incubator, no observations are available to estimate its realized random slope, and its mean effect is zero. Under squared-error loss the best prediction integrates over that effect and the residual error:
This is the plug-in conditional expectation given the population parameters, rather than a prediction using a fitted effect from one of the four existing incubators. Ignoring parameter-estimation uncertainty, the prediction variance for a new individual is ; it is not just the uncertainty in the population mean.
Add a location-specific random intercept to the random-slope linear mixed model:
Take the location effects, incubator slopes and individual errors to be mutually independent, with the original variances and . The random intercept models variation already present at hatching because of the origin of the eggs. Because larvae are subsequently assigned to incubators, location and incubator are crossed random effects, not automatically nested groups. The corresponding code is
fly.model.loc <- lmer(size ~ hours + (0+hours|incubator) + (1|location))
The resulting covariance between two observations contains if they share a location and if they share an incubator. If the three named locations themselves are the only populations of interest, use a fixed location factor instead:
fly.model.loc.fixed <- lmer(size ~ hours + location + (0+hours|incubator))
Choosing between these interpretations depends on the inferential target; with only three locations, a location variance component will be weakly estimated.