# Specifying a linear mixed model in lmer with replications nested within a fully crossed design

I’m trying to specify a linear mixed model for a somewhat complicated, nested & crossed method comparison study with replicated measurements. The goal is to partition and compare variances. It’s more complicated than the typical introductory examples I have seen and I’m not quite sure how to do it correctly.

The data I have collected comes from a comparison of different laboratory measurement methods (4 levels), each evaluated for all combinations for parameter1 (10 levels) and parameter2 (40 levels). Measurements (repeated for each unique combination of method, parameter1 and parameter2) were done on 60 different subjects characterized by sex. Each measurement was replicated 800 times (almost 80 million rows of observation) and the difference (true value determined beforehand by a reference method - measured value) was recorded.

Therefore: method x parameter1 x parameter2 are fully crossed (all combinations of factor levels occur once), subjects are nested within sex, and replicated measurements are nested within subject.

Following some advice (https://mailman.ucsd.edu/pipermail/ling-r-lang-l/2011-February/000225.html, and Barr et al., 2013), I would like to initially specify a maximal random effects structure for this, i.e., to account for between-subject differences in the sensitivity to all of the conditions, and then strip down the model from there. But I’m having a really hard time wrapping my head around the formula syntax and the model logic at the same time.

I’m shooting in the dark here, but what about:

(1 + method*param1*param2*sex | sex/subj_id)  # which expands to
(1 + method*param1*param2*sex | sex) + (1 + method*param1*param2*sex | sex:subj_id)


I don’t think that’s correct, though. It seems strange to have sex on both sides of the equation.

I would be very grateful for any help.

On a related issue: I intend to regress on the difference between measured value and (known) true value: diff ~ …. Is there any reason to instead regress the known true value onto the measured value: measured ~ true + …?

• In what sense do you have a measured value and a known true value? Is the response yes/no, or something like that? – gung - Reinstate Monica Aug 11 '14 at 14:48
• Not quite. Concentrations of a protein were measured by 4 "cheap" measurement methods after its "true" concentration within each sample (subj_id) has been established by a reference method which is more precise by orders of magnitudes (and can therefore be considered, in this context, to be without measurement error). – coanil Aug 11 '14 at 14:53

Since each subj_id is associated with one and only one value of sex, you need not mention sex in the random part of the model formula. The model using maximal random effects would be:
(1 + method*param1*param2 | subj_id)
• Wouldn't a specification including subj_id nested in sex result in different (smaller) variances for the random effects? I.e., in a nested model, (1+method*param1*param2|sex:subj_id), the variances should be smaller than in the non-nested one (1+method*param1*param2|subj_id), since each value of sex specifies a sub-population of subj_id. So, the modeler's choice in this regard (based on considerations that are currently unfathomable to me) should make a material difference to the resulting covariance parameters. Am I right? (I need to understand this for my current research). – clarpaul Apr 10 '16 at 20:52