5
$\begingroup$

I am getting this error.

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

I can't see anything wrong. The number of random effects should be 15, not 30. My grouping parameter is ID0, which is nominal, and there are twice as many observations as there are unique ID0's.

Here is some data that I'm using. I've subsetted just 30 rows of it for an example, but the original data has 1,088 obs. I'm trying to estimate random slopes and intercepts.

w1 <- structure(list(ID0 = c("007a275b3b24f4866a0d026503af0f3470f57bfc", 
"007a275b3b24f4866a0d026503af0f3470f57bfc", "0225c47f9da2575d71468f753699a02b972de8ba", 
"0225c47f9da2575d71468f753699a02b972de8ba", "02dc8096dff62e94c39ec3b0df26cd7dd2ed07aa", 
"02dc8096dff62e94c39ec3b0df26cd7dd2ed07aa", "03099c4feb5d232d9c60e2bdd04434cde1741073", 
"03099c4feb5d232d9c60e2bdd04434cde1741073", "03d255805fe183e1c3b1218fe08d7bba8ffc4d87", 
"03d255805fe183e1c3b1218fe08d7bba8ffc4d87", "042746d2cd8a74b6e2bfa6a5645ae90c920cf3e1", 
"042746d2cd8a74b6e2bfa6a5645ae90c920cf3e1", "046538c636e5ed4097ede61b9f6693b376c61119", 
"046538c636e5ed4097ede61b9f6693b376c61119", "0489a242d084104452045fece4038cd45fba6d7a", 
"0489a242d084104452045fece4038cd45fba6d7a", "06500c806172e86f835e5c21a052269dd222e30c", 
"06500c806172e86f835e5c21a052269dd222e30c", "06917c5835230a589bbd5cbb40909cc45afd5c40", 
"06917c5835230a589bbd5cbb40909cc45afd5c40", "06a9c55568e3f2d2d4bcef4534e5672ccc1323db", 
"06a9c55568e3f2d2d4bcef4534e5672ccc1323db", "06ccbadee52b11e853eaab602f71c073a950cc85", 
"06ccbadee52b11e853eaab602f71c073a950cc85", "06faa13b62f5f68089d595548638ca1b81d21b49", 
"06faa13b62f5f68089d595548638ca1b81d21b49", "081d7c912e71b04e894dc21761db9ed531a99d11", 
"081d7c912e71b04e894dc21761db9ed531a99d11", "08f23961db566bb51f8fa0ae37159a8d97320157", 
"08f23961db566bb51f8fa0ae37159a8d97320157"), year = c(0, 1, 0, 
1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 
0, 1, 0, 1, 0, 1), SatisAvg = c(6, 5, 4, 4, 6.3333333333, 6, 
5.3333333333, 5.6666666667, 6.3333333333, 6.3333333333, 6.3333333333, 
7, 6, 6.3333333333, 6.6666666667, 3.6666666667, 6, 6, 6, 6, 6, 
4.3333333333, 5.6666666667, 2.6666666667, 5.3333333333, 5, 6, 
4.3333333333, 6.6666666667, 7)), .Names = c("ID0", "year", "SatisAvg"
), row.names = c(NA, -30L), class = "data.frame")
$\endgroup$
6
  • 5
    $\begingroup$ (1 + year | ID0) specify a random intercept and a random slope, both grouped by ID0. 15 unique IDs times (intercept + slope) gives 30 random effects. You don't have sufficient observations to support the model. $\endgroup$
    – Roland
    Commented Feb 2, 2016 at 17:02
  • $\begingroup$ ding That's a light bulb turning on and a sudden recall of all my coursework. Thanks. $\endgroup$
    – Jesse
    Commented Feb 2, 2016 at 17:12
  • $\begingroup$ Are you referring to any on-line course you can recommend? $\endgroup$ Commented Feb 2, 2016 at 17:14
  • 1
    $\begingroup$ @Roland: Put that sentence in a post so we can upvote it properly. It answers the OP's question. $\endgroup$
    – usεr11852
    Commented Feb 2, 2016 at 18:58
  • 1
    $\begingroup$ @Roland: Feel the rep move towards you! $\endgroup$
    – usεr11852
    Commented Feb 4, 2016 at 21:55

1 Answer 1

17
$\begingroup$

(1 + year | ID0) specify a random intercept and a random slope, both grouped by ID0, and additionally their correlation. See the cheat sheet for an explanation of the syntax.

15 unique IDs times (intercept + slope + correlation) gives 45 random effects. You don't have sufficient observations to support the model.

$\endgroup$
4
  • $\begingroup$ how many observations would you need to support this model? Trying to wrap my head around the data needed to estimate X number of random effects. $\endgroup$
    – Brigadeiro
    Commented May 23, 2023 at 3:43
  • $\begingroup$ @Brigadeiro I suspect your question reflects a lack of understanding of mixed-effects models. In your experimental design you need to decide two numbers: the number of subjects and the number of measurements per subject. 15 subjects is sufficient in many cases. For OPs model you'd want at least 3 to 5 observations of each subject. Ultimately, a power analysis is necessary. $\endgroup$
    – Roland
    Commented May 23, 2023 at 5:21
  • $\begingroup$ I am always looking to improve on what I know. I understand power, but this seems like it is less of a power issue and more of a model identification problem to me. My question is essentially how to determine how many random effects is too many? What goes into this? Thanks. $\endgroup$
    – Brigadeiro
    Commented May 24, 2023 at 15:59
  • $\begingroup$ @Brigadeiro You are expressing this in a wrong way. You have never too many random effects. The random effects result from the experimental design. You can only have data that is insufficient to estimate the model and sometimes random effects can be negligible. And even if you have insufficient data to estimate the model, you can sometimes fix that by switching to a Bayesian model with informative priors. If data is sufficient to support a mixed-effects model does not only depend on the number of fixed and random effects but also on effect sizes (including correlations between effects). $\endgroup$
    – Roland
    Commented May 25, 2023 at 4:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.