In R, "Error: number of levels of each grouping factor must be < number of observations" I ran an experiment where subjects exercised in different climatic conditions. The response variable is the subjects' internal (core) temperatures.
There were 30 subjects and some participated in more than one trial. Each trial had a different ambient temperature, relative humidity, etc. Because of the non-independence of some of the subjects' data due to participating more than once, I decided to use a linear mixed effects model with Subject as the random effect. I also think I need to nest Subject within Trial due to the fact that different climatic conditions effect the subjects' temperatures.
The response variable is the subjects' temperatures and the fixed effects are the subjects' mass, age, and body fat percentage.
Here is my model, in package lme4 in R:
>mod=lmer(Temp ~ Mass + Age + Fat + (1|Subject/Trial), data=data, REML=FALSE)

I get the error: 

Error: number of levels of each grouping factor must be < number of observations

I have 43 observations and 6 different trials. Does this mean I just didn't collect enough data to be able to fit this model? Or is there another explanation/anything I can do?
 A: Welcome to the site, J.E. Without looking at your data, I am a little unclear about the trial variable. Given EdM's comment and a closer reading of your post, I want to make sure that I understand this correctly. Trials involved different conditions. So for some (but not all) subjects they had exposure to different trials. This to me sounds like a cross-classified problem rather than a purely nested trial. This would mean that your syntax should shift to the following: 
mod <- lmer(Temp ~ Mass + Age + Fat + (1|Subject) + (1|Trial), data=data)

If you have coded your data so that trial 1 is the same condition across subjects (i.e., it represents the same combination of ambient temp and relative humidity) and similarly trial 2 represents the same combination of conditions, etc., then this model syntax will be right whether your data are indeed purely nested or cross-classified. Make sure and check the summary(mod) output where it tells you the Ns in each grouping. If it is off, then check your coding of trial to make sure that trials with the same conditions are consistent across individuals. With 30 subjects and the relative small number of data points, you should use REML, which has better properties than full maximum likelihood with small samples. 
