0

I want to use a multilevel regression to analyse the effect of some independent variables on a dependent variable and use varying intercept and slope.

My regression includes non-numeric independent variables which I want to use for the varying intercept and slope. The dependent variable is a numeric variable. When using this multilevel regression I get the following error:

Error: number of observations (=88594) <= number of random effects (=337477) for term (1 + x | z); the random-effects parameters and the residual variance (or scale parameter) are probably unidentifiable

x and z are characters and are correlated with each other and with y. This is the regression I use:

multi_reg1 <- lmer(y~ 1 + x + (1 + x| z), REML = FALSE, data = data_frame1)

Is there a way to fix this problem or is it not possible and I have to use other regression methods?

Ben Bolker
  • 211,554
  • 25
  • 370
  • 453
Silpknot
  • 3
  • 1
  • How many levels (unique values) do `x` and `z` have? It's possible to override this error (see `?lmerControl`), but before you do that you should think carefully about whether the model you're trying to fit is actually identifiable. – Ben Bolker Jun 23 '22 at 21:20
  • I think the number of unique values is the problem as x = 233 and z = 1303. I am not sure if the multilevel model is the best approach but I want to figure out the impact of x and z on y. When using a linear regression the result is biased due to the high number of unique values of z. (The aim of my analysis is to find the drivers of y.) – Silpknot Jun 24 '22 at 06:20

0 Answers0