Dyadic Score Model (DSM)
Pascal Küng
dsm.Rmd
library(interdep)
has_glmmTMB <- requireNamespace("glmmTMB", quietly = TRUE)
dsm_fitted_alt <- "Fitted DSM diagram unavailable."This vignette focuses on the Dyadic Score Model (DSM) for distinguishable dyads and its relationship to the distinguishable Actor-Partner Interdependence Model (APIM). The DSM expresses associations in terms of the dyad’s shared level and the directional difference between partners (Iida et al. 2018).
For the broader package workflow and an overview of the available model-specific vignettes, including the Actor-Partner Interdependence Model, Mixed-Composition APIM, and Dyad-Individual Model, see the Overview.
Preparing DSM Data
A DSM requires an explicitly declared direction. This direction
should be substantively meaningful when the directional coefficients are
interpreted. Here, c("female", "male") defines every
difference as female minus male.
cross_dsm_data <- prepare_interdep_data(
example_dyadic_crosssectional,
group = coupleID,
member = personID,
role = gender,
predictors = communication,
model_type = "dsm",
dsm_role_order = c("female", "male")
)
print(cross_dsm_data, n = 4)
#> # interdep data
#> # Rows: 190 | Dyads: 95 | Intensive longitudinal: no
#> # Structure: group = coupleID, member = personID, role = gender
#> # DSM direction: female - male
#> #
#> # Dyad compositions:
#> # female_x_male distinguishable 95 dyads
#> #
#> # Added columns:
#> # .i_composition inferred dyad composition
#> # .i_composition_role composition-specific member role
#> # .i_is_{comp-role} composition-role indicator columns
#> # .i_dsm_role_contrast DSM role contrast: +0.5 for the first declared
#> # role and -0.5 for the second declared role
#> # .i_{pred}_dyad_mean_gmc dyad-mean predictor: dyad's average predictor
#> # level, grand-mean centered
#> # .i_{pred}_within_dyad_diff DSM signed predictor difference: first declared
#> # role minus second declared role
#> #
#> # A tibble: 190 × 12
#> personID coupleID gender communication satisfaction .i_composition
#> <int> <int> <fct> <dbl> <dbl> <fct>
#> 1 1 1 female 4.79 4.37 female_x_male
#> 2 2 1 male 3.80 2.34 female_x_male
#> 3 3 2 female 2.91 2.44 female_x_male
#> 4 4 2 male 6.51 6.08 female_x_male
#> # ℹ 186 more rows
#> # ℹ 6 more variables: .i_composition_role <fct>,
#> # .i_is_female_x_male_female <dbl>, .i_is_female_x_male_male <dbl>,
#> # .i_dsm_role_contrast <dbl>, .i_communication_dyad_mean_gmc <dbl>,
#> # .i_communication_within_dyad_diff <dbl>For predictor values
and
,
interdep then creates:
.i_communication_dyad_mean_gmc(with representing the sample grand mean of the dyad-level predictor means).i_communication_within_dyad_diff.i_dsm_role_contrastfor female and for male.
The dyad mean and signed difference are repeated on both member rows. The outcome remains unchanged and no transformation is needed.
Cross-Sectional Gaussian DSM
For a cross-sectional Gaussian DSM, a correlated dyad random intercept and role-contrast slope represent unexplained outcome-level and outcome-difference variation.
Conceptual cross-sectional DSM. Predictor mean and predictor difference each predict both outcome scores.
The same model can be displayed in the individual-member rows used by the long-format multilevel model.
Individual-level representation of the cross-sectional DSM used for the long-format multilevel model. The centered predictor mean and female-minus-male predictor difference appear on both member rows. For the female outcome, the intercept and slopes add one-half of the corresponding outcome-difference parameters. For the male outcome, they subtract one-half. The female and male residuals may have different variances and covary.
The path labels correspond directly to the terms in the model below:
dsm_model <- glmmTMB::glmmTMB(
satisfaction ~
# Outcome-level intercept
1 +
# Predictor level -> outcome level (a11)
.i_communication_dyad_mean_gmc +
# Predictor difference -> outcome level (a12)
.i_communication_within_dyad_diff +
# Outcome-difference intercept (a20)
.i_dsm_role_contrast +
# Predictor level -> outcome difference (a21)
.i_communication_dyad_mean_gmc:.i_dsm_role_contrast +
# Predictor difference -> outcome difference (a22)
.i_communication_within_dyad_diff:.i_dsm_role_contrast +
# Outcome-level and outcome-difference residual variances and their covariance
us(1 + .i_dsm_role_contrast | coupleID),
dispformula = ~ 0,
family = gaussian(),
data = cross_dsm_data
)
summary(dsm_model)
#> Family: gaussian ( identity )
#> Formula:
#> satisfaction ~ 1 + .i_communication_dyad_mean_gmc + .i_communication_within_dyad_diff +
#> .i_dsm_role_contrast + .i_communication_dyad_mean_gmc:.i_dsm_role_contrast +
#> .i_communication_within_dyad_diff:.i_dsm_role_contrast +
#> us(1 + .i_dsm_role_contrast | coupleID)
#> Dispersion: ~0
#> Data: cross_dsm_data
#>
#> AIC BIC logLik -2*log(L) df.resid
#> 589.5 618.0 -285.7 571.5 167
#>
#> Random effects:
#>
#> Conditional model:
#> Groups Name Variance Std.Dev. Corr
#> coupleID (Intercept) 0.632 0.795
#> .i_dsm_role_contrast 3.678 1.918 -0.16
#> Number of obs: 176, groups: coupleID, 88
#>
#> Conditional model:
#> Estimate Std. Error
#> (Intercept) 5.04256 0.08481
#> .i_communication_dyad_mean_gmc 1.99024 0.07834
#> .i_communication_within_dyad_diff -0.03201 0.05372
#> .i_dsm_role_contrast 0.95644 0.20459
#> .i_communication_dyad_mean_gmc:.i_dsm_role_contrast -0.13847 0.18899
#> .i_communication_within_dyad_diff:.i_dsm_role_contrast 1.48641 0.12959
#> z value Pr(>|z|)
#> (Intercept) 59.46 < 2e-16 ***
#> .i_communication_dyad_mean_gmc 25.41 < 2e-16 ***
#> .i_communication_within_dyad_diff -0.60 0.551
#> .i_dsm_role_contrast 4.67 2.94e-06 ***
#> .i_communication_dyad_mean_gmc:.i_dsm_role_contrast -0.73 0.464
#> .i_communication_within_dyad_diff:.i_dsm_role_contrast 11.47 < 2e-16 ***
#> ---
#> Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1Interpreting the DSM paths
For the outcomes given the predictors, the long-format model estimates the same paths as the conventional score-based DSM (Iida et al. 2018).
In the conventional score-based representation, the predictors are decomposed in the same way:
where is the sample grand mean of the dyad-level predictor means.
The outcomes are also decomposed:
The long-format model fitted here does not create and as observed variables. Instead, it uses the member-level outcome directly. With complete outcome pairs, this is an equivalent parameterization of the same conditional outcome regressions.
Consider the conceptual SEM formulas:
The fitted paths for this example are:
Fitted cross-sectional DSM for the example data. The nodes identify the mean and difference scores; edge and intercept labels show the estimated DSM coefficients, and the residual labels show the estimated score-component standard deviations and correlation.
The fixed effects from our MLM model map directly to these paths as such:
| Long-format fixed effect | DSM SEM path and interpretation |
|---|---|
| Intercept | : expected dyad-average satisfaction at the sample-average communication level and no female-male communication difference |
| Communication dyad mean | : predictor level outcome level |
| Communication difference | : predictor difference outcome level |
| DSM role contrast | : expected female-minus-male outcome difference at the predictor reference values |
| Dyad mean role contrast | : predictor level outcome difference |
| Communication difference role contrast | : predictor difference outcome difference |
Thus, for example, is the change in dyad-average satisfaction associated with a one-unit larger female-minus-male communication difference, holding communication level constant. In contrast, is the change in the female-minus-male satisfaction difference associated with that same one-unit larger communication difference, holding communication level constant. The and coefficients are the DSM cross-paths. They are omitted from the reduced DSM but are needed for the full model.
The random intercept variance is unexplained variation in outcome level, and the random role-contrast slope variance is unexplained variation in the full directional outcome difference. Their covariance indicates whether unexplained outcome level and unexplained outcome difference are associated.
The curved arrow is the scale-free correlation between the outcome-mean residual and the outcome-difference residual. It is not the female-male residual correlation from the APIM.
The DSM uses the full female-minus-male difference:
Therefore, this relationship applies:
For this reason, a nonzero indicates that the two roles have different residual variances. The remaining covariance between the partners’ residuals is
Reversing the coding
Instead of computing , we can reverse the direction and compute . This changes the direction of the differences, but not the substantive model.
cross_dsm_data_inverted <- prepare_interdep_data(
example_dyadic_crosssectional,
group = coupleID,
member = personID,
role = gender,
predictors = communication,
# Request APIM columns too for comparison below.
model_type = c("dsm", "apim"),
dsm_role_order = c("male", "female")
)
dsm_model_inverted <- glmmTMB::glmmTMB(
satisfaction ~
.i_communication_dyad_mean_gmc +
.i_communication_within_dyad_diff +
.i_dsm_role_contrast +
.i_communication_dyad_mean_gmc:.i_dsm_role_contrast +
.i_communication_within_dyad_diff:.i_dsm_role_contrast +
us(1 + .i_dsm_role_contrast | coupleID),
dispformula = ~ 0,
family = gaussian(),
data = cross_dsm_data_inverted
)
female_minus_male <- glmmTMB::fixef(dsm_model)$cond
male_minus_female <- glmmTMB::fixef(dsm_model_inverted)$cond
knitr::kable(
data.frame(
`model term` = names(female_minus_male),
`female - male` = unname(female_minus_male),
`male - female` = unname(male_minus_female),
check.names = FALSE
),
digits = 3,
align = c("l", "r", "r")
)| model term | female - male | male - female |
|---|---|---|
| (Intercept) | 5.043 | 5.043 |
| .i_communication_dyad_mean_gmc | 1.990 | 1.990 |
| .i_communication_within_dyad_diff | -0.032 | 0.032 |
| .i_dsm_role_contrast | 0.956 | -0.956 |
| .i_communication_dyad_mean_gmc:.i_dsm_role_contrast | -0.138 | 0.138 |
| .i_communication_within_dyad_diff:.i_dsm_role_contrast | 1.486 | 1.486 |
The two models have identical fitted values and model fit:
.i_communication_within_dyad_diffreverses because the predictor difference reverses..i_dsm_role_contrastreverses because the represented outcome difference reverses..i_communication_dyad_mean_gmc:.i_dsm_role_contrastreverses because only the outcome difference reverses..i_communication_within_dyad_diff:.i_dsm_role_contrastremains unchanged because both differences reverse.
The intercept and .i_communication_dyad_mean_gmc also
remain unchanged. For the random effects, the variances of
(Intercept) and .i_dsm_role_contrast remain
unchanged, whereas their covariance reverses sign.
Relationship to the APIM and DIM
For distinguishable dyads, the full DSM and an unconstrained distinguishable APIM are alternative parameterizations of the same fixed associations (Iida et al. 2018).
Let’s fit the equivalent distinguishable APIM:
apim_model <- glmmTMB::glmmTMB(
satisfaction ~
# Role-specific intercepts
0 +
.i_is_female_x_male_female +
.i_is_female_x_male_male +
# Role-specific actor effects
.i_is_female_x_male_female:.i_communication_actor +
.i_is_female_x_male_male:.i_communication_actor +
# Role-specific partner effects
.i_is_female_x_male_female:.i_communication_partner +
.i_is_female_x_male_male:.i_communication_partner +
# Role-specific Gaussian residual covariance structure
us(0 +
.i_is_female_x_male_female +
.i_is_female_x_male_male
| coupleID),
dispformula = ~ 0,
family = gaussian(),
data = cross_dsm_data_inverted
)The two DSM directions and the APIM have identical fit statistics:
data.frame(
model = c("DSM: female - male", "DSM: male - female", "APIM"),
AIC = round(c(AIC(dsm_model), AIC(dsm_model_inverted), AIC(apim_model)), 3),
BIC = round(c(BIC(dsm_model), BIC(dsm_model_inverted), BIC(apim_model)), 3),
logLik = round(c(
as.numeric(logLik(dsm_model)),
as.numeric(logLik(dsm_model_inverted)),
as.numeric(logLik(apim_model))
), 3)
)
#> model AIC BIC logLik
#> 1 DSM: female - male 589.491 618.026 -285.746
#> 2 DSM: male - female 589.491 618.026 -285.746
#> 3 APIM 589.491 618.026 -285.746Fixed-effect transformation
Let and denote the actor effects on the female and male outcomes. The corresponding partner effects are and , and the APIM intercepts are and . Fixed APIM coefficients use and write out their effect and outcome role. The numbered paths through retain the published DSM notation.
The slope transformation can be understood in two steps. First, for each outcome role , form the actor-plus-partner and actor-minus-partner combinations:
The DSM slopes then follow by combining the female- and male-outcome effects:
The APIM predictors retain their original scale, whereas the DSM predictor level is grand-mean centered. Keeping the raw APIM predictors on their original scale preserves their reference values; the centering difference is handled explicitly in the intercept transformation. If is the grand mean subtracted from the DSM predictor level, the intercepts transform as
For the reverse slope transformation, first recover the role-specific actor-plus-partner and actor-minus-partner combinations:
Then, for each outcome role ,
The intercepts transform back as
The following comparison applies the APIM-to-DSM transformation to all six fixed effects:
| DSM path | From APIM transformation | From DSM model |
|---|---|---|
| a10 | 5.043 | 5.043 |
| a11 | 1.990 | 1.990 |
| a12 | -0.032 | -0.032 |
| a20 | 0.956 | 0.956 |
| a21 | -0.138 | -0.138 |
| a22 | 1.486 | 1.486 |
Random-effect transformation
Let and be the APIM random effects for the female and male outcomes. The DSM outcome-level and outcome-difference residuals are the same random effects expressed in different coordinates:
Applying this rotation to the APIM covariance matrix reproduces the DSM random intercept variance, intercept-slope covariance, and role-slope variance:
apim_vcov <- as.matrix(glmmTMB::VarCorr(apim_model)$cond$coupleID)
dsm_vcov <- as.matrix(glmmTMB::VarCorr(dsm_model)$cond$coupleID)
rotation <- rbind(
outcome_level = c(0.5, 0.5),
outcome_difference = c(1, -1)
)
apim_to_dsm_vcov <- rotation %*% apim_vcov %*% t(rotation)
data.frame(
parameter = c(
"Var(outcome mean)",
"Cov(outcome mean, outcome diff)",
"Var(outcome diff)"
),
from_DSM = round(c(
dsm_vcov[1, 1],
dsm_vcov[1, 2],
dsm_vcov[2, 2]
), 3),
from_APIM_transformation = round(c(
apim_to_dsm_vcov[1, 1],
apim_to_dsm_vcov[1, 2],
apim_to_dsm_vcov[2, 2]
), 3)
)
#> parameter from_DSM from_APIM_transformation
#> 1 Var(outcome mean) 0.632 0.632
#> 2 Cov(outcome mean, outcome diff) -0.240 -0.240
#> 3 Var(outcome diff) 3.678 3.678For exchangeable dyads, the direction of a member difference is
arbitrary. The directional intercept, both cross-paths, and the
covariance between outcome level and outcome difference must then be
zero. The remaining reduced, label-invariant DSM is algebraically the
Gaussian Dyad-Individual Model (DIM). In interdep, use
model_type = "dim" for this exchangeable model and reserve
model_type = "dsm" for distinguishable dyads.
Because the Gaussian DIM is the exchangeability-constrained version of the full DSM, exchangeability can also be tested by comparing these nested models. This is equivalent to the comparison shown in Testing distinguishability in the APIM vignette.
Intensive longitudinal DSM
The following sections are under construction and are coming soon! This extension is equivalent to the extension from the cross-sectional DIM to the ILD DIM. Please refer to that section.
Dynamic ILD DSM example
The ILD models above do not model residual serial dependence. One way to model dynamics or to account for temporal dependency is to include lagged outcomes as predictors.
Note: Dynamic models, especially with small time series, are subject to bias. This, and the choice between raw and within-person-centered outcome lags, are addressed in the APIM vignette’s discussion of dynamic models.
Return to the Actor-Partner Interdependence Model vignette, see the Mixed-Composition APIM vignette or the Dyad-Individual Model vignette for related model specifications, or return to the Overview.