I'm trying to implement a regression model with both fixed and random effects. The package I use is the lme4
.
I want to find the relationship between the continuous variables X1
and X2
, using the categorical variable F1
as a fixed effect.
When I try to implement the model model <- lmer(X1 ~ F1 + (1|X2))
I get the following error:
Number of levels of a grouping factor for the random effects must be less than the number of observations
My understanding for the error is that the X2
varies less than the X1
(which has some similar values). Why is this a problem?