I am doing a retrospective cohort study in which I have taken information from 4 health markers: calories
, exercise time
, work hours
, and sleep hours
as well as an outcome variable healthsurvey
. All variables are continuous, take on only positive values, and are measured monthly across approximately 1000 subjects for two years - essentially, 24 measurements of each variable for each subject. The residuals are Gaussian, and the models below by and large fit the criteria for LMM diagnostics. The head of data looks like this:
There's significant autocorrelation within all dependent variables, and I was wondering how I could craft a model to judge associations between the four independent variables and the outcome. I was thinking a linear mixed model or a GLMM is the best way to go. I loaded nlme
and lme4
into R and came up with these ideas, but I just want to know if I'm on the wrong track:
lme(healthsurvey~calories+exercise+laborhours+sleephours, random=calories+exercise+laborhours+sleephours|subject, correlation = corCompSymm(), method = "ML")
But if that didn't work, I was thinking of doing something with lme4
, a package I'll admit I'm less familiar with:
lmer(healthsurvey~calories+exercise+laborhours+sleephours+(calories|subject)+(exercise|subject)+(laborhours|subject)+(sleephours|subject), REML=FALSE)
The specifics of variable selection/etc aren't important right now. I'd just like to know if a linear mixed model was a smart way to model this data, and if so, treating each of my covariates as random effects since they vary across subjects.