# Mixed effects model with 1 observation per level of categorical predictor

I have looked at the other questions similar to this one (e.g. here and here), but I don't think that they are quite the same as my situation, although please correct me if I am wrong.

I am trying to fit a model where I have a continuous response and a categorical predictor with 4 levels. Each level of the predictor has 5 observations. The constraint of the design is such that each observation for each level comes from a different leaf (grouping variable), with 5 different leaves. This means that each level of the categorical predictor has only 1 observation per leaf.

I am trying to fit a mixed effects model with lme4, but I want to know if there are any conceptual issues with estimating the variance components when there is only 1 observation per level of the categorical predictor per level of the grouping variable.

• So the categorical variable actually has 4*5=20 levels? What are the results from lme4? – Glen Mar 1 '19 at 15:55
• @Glen sorry no I meant that each of the 4 levels of the categorical variable was repeated only once per leaf. Each of the 5 leaves has 4 observations - 1 per level of categorical predictor. – NatWH Mar 1 '19 at 16:04

It seems that in your study leaf is treated as a random grouping variable with 5 levels (since you have 5 leaves). For a (linear) mixed effects model to make sense, you would need to have multiple values of the continuous response variable collected per level of your grouping variable. For example, you would collect these values repeatedly over time (e.g., on 4 successive days) or perhaps under different conditions (e.g., under 4 different conditions):

Grouping Variable:   Leaf #1    Leaf #2   Leaf #3    Leaf #4    Leaf #5
/ / \ \    / / \ \    / / \ \    / / \ \    / / \ \
Outcome:            *  *  * *  * *   * *  * *  * *  * *   * *  * *   * *


In the above, the star symbols displayed under each leaf indicate the multiple response values collected for that leaf.

If you need to include predictors in your (linear) mixed effects model, these can be collected either at the lowest level of the hierarchy depicted above or at the highest level.

For example, if you measure chlorophyll production for each leaf under 4 consecutive conditions, you could also measure the value of that predictor separately for each condition:

Grouping Variable:   Leaf #1    Leaf #2   Leaf #3    Leaf #4     Leaf #5
/ / \ \    / / \ \    / / \ \    / / \ \    / / \ \
Outcome:            *  *  * *  * *   * *  * *   * *  * *   * *  * *   * *

Predictor #1:       o  o  o o  o o   o o  o o  o o   o o   o o  o o   o o


In the above, the predictor # 1 has its values collected at the lowest level of the data-generating hierarchy, so its values are condition-specific in this example.

However, it is also possible to collect data values for a predictor which concerns the highest level of this hierarchy (that is, a leaf-level predictor). An example of such predictor would be leaf area (aka Predictor #2), say:

Predictor #2:           @         @          @          @          @

Grouping Variable:   Leaf #1    Leaf #2   Leaf #3    Leaf #4     Leaf #5
/ / \ \    / / \ \    / / \ \    / / \ \    / / \ \
Outcome:            *  *  * *  * *   * *  * *   * *  * *   * *  * *   * *

Predictor #1:       o  o  o o  o o   o o  o o  o o   o o   o o  o o   o o


What you need for the values of Predictor #2 is sufficient variability in its values for you to be able to estimate its effect. If all the leaves have the exact same area, then you are in trouble!

Similarly, for the values of Predictor #1, you need sufficient variability in their values within a leaf (and also across leaves) to be able to estimate the desired predictor effect.

• I would add that exploring random effects with so few observations is questionable. No point trying to capture individual deviations from mean (group) effect when this last effect is likely to be ill-measured – Umka Mar 1 '19 at 17:38