Dyadic growth curve modelling in brms


Please also provide the following information in addition to your question:

  • Operating System: MacOS High Sierra
  • brms Version: 2.5.0

Am trying to execute dyadic growth curve analysis in brms. Specifically, hoping to fit a model like the following that is done in nlme.

dyadGC <- lme(Y ~ GENDER + TIME + GENDER*TIME, 
                      data = data, 
                      random = ~ GenderS + GenderS:TIME  - 1|dyadid,
                      correlation = corCompSymm(form = ~1|dyadid/obsid),  
                      weights = varIdent(form = ~1|GenderS),
                      na.action = na.omit)

Where GENDER is contrast coded (-1 and 1) and GenderS is a variable containing strings that indicate “Male” and “Female”. I know that correlation/residual structures are a feature request that is still open, but is there already there a way to fit something similar without the heterogenous compound symmetry correlation structure (e.g., replacing it with the AR(1) structure possibly)?

I have tried the following:

formula <- bf(y ~ TIME + GENDER + GENDER*TIME + 
                (0 + genderS + genderS*TIME | hhid))
m1 <- brm(formula=formula, data=data, chains = 1, 
                   autocor = cor_ar(~ TIME | genderS), cov=TRUE)

But this seems to be a slightly different specification. I was hoping someone could offer some advice.


The compound symmetry is not yet supported in brms. If you want to use Stan regardless, you have to extract the generated Stan code via make_stancode and then amend it.

Not sure what you mean by “similar”. In any case, “AR(1)” is a different correlation structure that may or may not make sense for your data set. In particular, it seems as if the grouping variable in brms is GenderS but in nlme isdyadid/obsid`. Is there a particular reason for using a different grouping structure?


Hi Paul, thanks for your quick response. The reason for the different grouping structure is because I wasn’t sure how to specify the equivalent of nlme's “correlation” and “weights” specification in brms. Namely, I wanted individual residual variances by GenderS, but correlations between the two within each dyad (identified with obsid). I had thought replacing obsid with GenderS should be the same given that every dyad has two members (one from each gender), but if I switch out obsid for GenderS in the nlme model it fails to converge (the code here is adapted from https://randilgarcia.github.io/week-dyad-workshop/Growth_Curve_Modeling.html#dyadic_growth_curve_modeling).

In my particular case, an AR(1) structure would make sense within each obsid, but I would also need to obtain a between individual (and within dyad) correlation. What would be best is an unstructured correlation matrix that estimates residual variance at each time point for each individual within each dyad and the correlations between dyad members. At the moment if I can achieve a model that estimates residual variance for separately for each individual within dyads and any kind of correlation structure between them that would help. Am primarily trying to see if I can achieve the same kind of specification in brms as in nlme.

Also, with my model specification in brms returns standard deviations of residuals for 4 variables (GenderSFemale, GenderSMale, TIME, GenderSMale:TIME), but nlme returns (GenderSFemale, GenderSMale, GenderSFemale:TIME, GenderSMale:TIME), which is slightly different.