Daniel Lakeland writes with a question about lmer() that is more generally a question about partially nested multilevel models:

I often think of a hierarchical or mixed model as a series of corrections to be applied among groups so that at the highest level, some set of trends can be described among the corrected data. (this probably comes from my applied mathematics background)

In a recent data set that I have from work, we are trying to determine if there is any warpage in a set of doors, and if so, which panels and how big is the warpage, and what type is it?

I have one kind of measurement which is automatically calibrated in the y direction (up and down, thanks to gravity) and another kind of measurement that is not (horizontal measurements).

I’m trying to use lmer from the lme4 package to fit a model that would help determine whether these doors are warped.

I want to include a term like (1|set_of_calibrated_measurements) and another term that is like (1+x|uncalibrated_set). However I can’t figure out how to specify the grouping factors so that they group by the factor AND subset by a subset of groups… To try to make this clearer suppose that I have a factor with the levels VA,VB,VC,HA,HB,HC

All the V groups should have a single variable intercept, whereas all the H groups should have both a variable intercept AND x slope.

I think this is a general issue when you have different kinds of calibrations to be applied to different subsets of the data, and the calibration can be thought of as a “variable” effect (in your ANOVA paper terminology) but the type of variable effect depends on the type of group.

I realize that I could create a new factor called “isV” or something like that, but it doesn’t solve the problem because even with the additional factor, I can’t figure out how to write the model formula.

My reply:

1. lmer() is great, but it can’t do everything.