We are trying to run Triadic APIM growth curve models using multilevel modeling. We have cortisol (cort) measurements across 4 time points for families of mothers, fathers, and children. We want to run a three-intercept APIM growth curve model to analyze the extent of interdependence from one time point to next across family members (lagged predictors of the outcome). I want to confirm that the code and data structure we envision would work as intended.
Expected R code to run:
model <- lmer (cortT ~ 0 + men + women + child + ##intercepts for all family members
men*A_cortT-1 + women*A_cortT-1 + child*A_cortT-1 + ##actor effects for all family
men*ChildasP_cortT-1 + men*WomenasP_cortT-1 + ##partner effects on men outcome
women*ChildAsP_cortT-1 + women*MenasP_cortT-1 + ##partner effect on women outcome
child*MenAsP_cortT-1 + child*WomenasP_cortT-1 + ##partner effects on child outcome
(1|time) + (1 + time | family / member) ## nesting structure, time is crossed and not nested in members
Expected Data Structure:
Family | Member | Time | Men | Women | Child | CortT | A_CortT-1 | ChildAsP_cortT-1 | MenAsP_cortT-1 | WomenAsP_cortT-1 |
---|---|---|---|---|---|---|---|---|---|---|
1 | 1 | 1 | 1 | 0 | 0 | m1 | - | - | - | - |
1 | 1 | 2 | 1 | 0 | 0 | m2 | m1 | c1 | - | w1 |
1 | 1 | 3 | 1 | 0 | 0 | m3 | m2 | c2 | - | w2 |
1 | 1 | 4 | 1 | 0 | 0 | m4 | m3 | c3 | - | w3 |
1 | 2 | 1 | 0 | 1 | 0 | w1 | - | - | - | - |
1 | 2 | 2 | 0 | 1 | 0 | w2 | w1 | c1 | m1 | - |
1 | 2 | 3 | 0 | 1 | 0 | w3 | w2 | c2 | m2 | - |
1 | 2 | 4 | 0 | 1 | 0 | w4 | w3 | c3 | m3 | - |
1 | 3 | 1 | 0 | 0 | 1 | c1 | - | - | - | - |
1 | 3 | 2 | 0 | 0 | 1 | c2 | c1 | - | m1 | w1 |
1 | 3 | 3 | 0 | 0 | 1 | c3 | c2 | - | m2 | w2 |
1 | 3 | 4 | 0 | 0 | 1 | c4 | c3 | - | m3 | w3 |
... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... |
In addition, I could use some help on how to create the actor and partner variables on R from the CortT variable, moving the appropriate rows to their corresponding places in the actor and partner variables (see the table).
Thank you for your help in advance! All the best