[R-sig-ME] Errorin lmer for time varying predictor.

Srinidhi Jayakumar @r|n|dh|@j@y@kum@r @end|ng |rom @tonybrook@edu
Sat May 4 22:08:48 CEST 2024


Hi,

I am running a multilevel growth curve model to examine predictors of
social anhedonia (SA) trajectory through ages 12, 15 and 18. SA is a
continuous numeric variable. The age variable (Index1) has been coded as 0
for age  12, 1 for age 15 and 2 for age 18. I am currently using a time
varying predictor, stress (LSI), which was measured at ages 12, 15 and 18,
to examine whether trajectory/variation in LSI predicts difference in SA
trajectory. LSI is a continuous numeric variable. The data has been
converted to long format with SA in 1 column, LSI in the other, ID in
another and age in another column. I used the code below to run my model
using lmer. However, I get the following error. Please let me know how I
can solve this error. Please note that I have 50% missing data in SA at age
12, which I am handling using the REML method.
modelLSI_maineff_RE <- lmer(SA ~ Index1* LSI+ (1 + Index1+LSI |ID),
                            data = LSIDATA, control = lmerControl(optimizer
="bobyqa"), REML=TRUE)
summary(modelLSI_maineff_RE)

Error: number of observations (=1080) <= number of random effects
(=1479) for term (1 + Index1 + LSI | ID); the random-effects
parameters and the residual variance (or scale parameter) are probably
unidentifiable


 I did test the within-person variance for the LSI variable and
the within-person variance is significant from the Greenhouse-Geisser,
Hyunh-Feidt tests.

Also, for some reason, the model runs if I specify the random effects as
either of these 2 models. However, I want to know whether variation in LSI
predicts variation in SA trajectory between and within people. Hence, I
need both age and LSI in the random effects.
  modelLSI1 <- lmer(SA ~ Index1* LSI+ (1 + Index1 |ID),
                            data = LSIDATA, control = lmerControl(optimizer
="bobyqa"), REML=TRUE)
*OR*
  modelLSI2 <- lmer(SA ~ Index1* LSI+ (1 +LSI |ID),
                            data = LSIDATA, control = lmerControl(optimizer
="bobyqa"), REML=TRUE)

Please let me know how I can solve my error and examine the random effect
of LSI.

Thank you,
Srinidhi

	[[alternative HTML version deleted]]



More information about the R-sig-mixed-models mailing list