I am analyzing a longitudinal dataset ("df") of ~3000 subjects who were evaluated six times over the course of the study. Subjects were recruited from 9 different sites and categorized into 1 of 3 groups based upon their mechanism of injury. I am interested in evaluating whether a clinical outcome (which we will call "FactorA") differs by group, time (in weeks; continuous variable), or a group by time interaction. My base model is:
baseModel= lmer(FactorA ~ Group + Time + Group:Time, data=df)
This dataset has been analyzed previously and the authors of that study report random effects for model intercept and time were added based on subject nested in site under the assumption of an autoregressive correlation structure, AR(1). I am struggling to recreate the random effects specified by the previous authors while keeping the AR(1) correlation structure. Based on the previous study, I believe I need to add two, separate random effects into my model:
Random effect for intercept: (1|site/subject)
Random effect for time: (Time|site/subject), data=df)
If I use the lmer package, I can easily add both random effect statements
lmerModel = lmer(FactorA ~ Group + Time + Group:Time + (1|site/subject) + (Time|site/participant_id), data = df)
However, I cannot figure out how to change the correlation structure (and have seen older posts (circa 2010) suggesting that this option isn't available in lmer).
Conversely, with the nlme package I can specify the correlation structure using "correlation=corAR1()" but I cannot figure out how to add both random statements to my model.
Does anyone know how to build a model with separate random effects statements while specifying the correlation structure? Or can my two random effect statements be combined into a single statement?