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")
(1 + year | ID0)
specify a random intercept and a random slope, both grouped byID0
. 15 unique IDs times (intercept + slope) gives 30 random effects. You don't have sufficient observations to support the model. $\endgroup$