Read in the pairwise dataset
library(nlme)
library(dyadr)
library(dplyr)
riggsp<- read.csv("riggsp.csv")
# Create variables with dplyr
riggsp <- riggsp %>%
mutate(Woman = (Gender_A+1)/2,
Man = -(Gender_A-1)/2,
Abuse_AW = Abuse_A*Woman,
Abuse_PW = Abuse_P*Woman,
Abuse_AM = Abuse_A*Man,
Abuse_PM = Abuse_P*Man,
Anxiety_AW = Anxiety_A*Woman,
Anxiety_PW = Anxiety_P*Woman,
Anxiety_AM = Anxiety_A*Man,
Anxiety_PM = Anxiety_P*Man)
Making sure the X variable does not moderate the effect of the mediator on the outcome.
Abuse (X), Anxiety (M), and their interaction (XM) affecting Satisfaction (Y)
Run with ML to test the eight possible interactions.
apim_mm <- gls(Sat_A ~ Gender_A + Anxiety_A + Anxiety_P + Abuse_A + Abuse_P
+ Anxiety_A*Gender_A + Anxiety_P*Gender_A
+ Abuse_A*Gender_A + Abuse_P*Gender_A
+ Anxiety_A*Abuse_A + Anxiety_P*Abuse_P
+ Anxiety_A*Abuse_P + Anxiety_P*Abuse_A
+ Anxiety_A*Abuse_A*Gender_A + Anxiety_P*Abuse_P*Gender_A
+ Anxiety_A*Abuse_P*Gender_A + Anxiety_P*Abuse_A*Gender_A,
na.action = na.omit,
correlation = corCompSymm(form=~1|Dyad),
method="ML",
weights = varIdent(form=~1|Gender_A),
data = riggsp)
smallsummary(apim_mm)
## Correlation structure of class corCompSymm representing
## Rho
## 0.6327318
##
## Variance function structure of class varIdent representing
## -1 1
## 1.000000 1.021552
## Residual standard error: 6.484756
##
## Value Std.Error t-value p-value
## (Intercept) 54.0588 4.1213 13.1168 0.0000
## Gender_A -0.1542 1.9551 -0.0788 0.9372
## Anxiety_A -1.1823 0.8852 -1.3356 0.1827
## Anxiety_P -1.3816 0.8840 -1.5629 0.1192
## Abuse_A -0.2954 0.2580 -1.1448 0.2532
## Abuse_P 0.1167 0.2571 0.4539 0.6503
## Gender_A:Anxiety_A 0.7340 1.0946 0.6706 0.5030
## Gender_A:Anxiety_P -0.2279 1.0937 -0.2084 0.8351
## Gender_A:Abuse_A 0.0438 0.2870 0.1527 0.8787
## Gender_A:Abuse_P -0.0239 0.2862 -0.0836 0.9334
## Anxiety_A:Abuse_A 0.0592 0.0750 0.7899 0.4303
## Anxiety_P:Abuse_P 0.0248 0.0748 0.3315 0.7405
## Anxiety_A:Abuse_P -0.1010 0.0736 -1.3733 0.1707
## Anxiety_P:Abuse_A -0.0061 0.0737 -0.0822 0.9345
## Gender_A:Anxiety_A:Abuse_A -0.1012 0.0770 -1.3144 0.1897
## Gender_A:Anxiety_P:Abuse_P -0.0299 0.0769 -0.3894 0.6973
## Gender_A:Anxiety_A:Abuse_P 0.0232 0.0782 0.2973 0.7665
## Gender_A:Anxiety_P:Abuse_A 0.0579 0.0782 0.7406 0.4596
## 2.5 % 97.5 %
## (Intercept) 45.9812 62.1365
## Gender_A -3.9861 3.6778
## Anxiety_A -2.9173 0.5527
## Anxiety_P -3.1143 0.3510
## Abuse_A -0.8010 0.2103
## Abuse_P -0.3872 0.6206
## Gender_A:Anxiety_A -1.4114 2.8795
## Gender_A:Anxiety_P -2.3714 1.9157
## Gender_A:Abuse_A -0.5187 0.6063
## Gender_A:Abuse_P -0.5848 0.5369
## Anxiety_A:Abuse_A -0.0877 0.2061
## Anxiety_P:Abuse_P -0.1219 0.1715
## Anxiety_A:Abuse_P -0.2453 0.0432
## Anxiety_P:Abuse_A -0.1505 0.1383
## Gender_A:Anxiety_A:Abuse_A -0.2522 0.0497
## Gender_A:Anxiety_P:Abuse_P -0.1807 0.1208
## Gender_A:Anxiety_A:Abuse_P -0.1300 0.1764
## Gender_A:Anxiety_P:Abuse_A -0.0954 0.2113
We do see that none of the 8 tests are significant, but to be sure we do combined tests of the 8 effects.
apim_base <- gls(Sat_A ~ Gender_A + Anxiety_A + Anxiety_P
+ Abuse_A + Abuse_P
+ Anxiety_A*Gender_A + Anxiety_P*Gender_A
+ Abuse_A*Gender_A + Abuse_P*Gender_A,
na.action = na.omit,
correlation = corCompSymm(form=~1|Dyad),
method = "ML",
weights = varIdent(form=~1|Gender_A),
data = riggsp)
anova(apim_mm, apim_base)
## Model df AIC BIC logLik Test L.Ratio p-value
## apim_mm 1 21 2008.145 2086.613 -983.0727
## apim_base 2 13 2000.960 2049.535 -987.4800 1 vs 2 8.814498 0.3582
Thus, we get confirmation that the assumption of no moderated mediation is needed.
apim_stp1 <- gls(Sat_A ~ -1 + Woman + Man
+ Abuse_AW + Abuse_PW + Abuse_AM + Abuse_PM,
na.action=na.omit, correlation=corCompSymm (form=~1|Dyad),
weights=varIdent(form=~1|Gender_A),data=riggsp)
smallsummary(apim_stp1)
## Correlation structure of class corCompSymm representing
## Rho
## 0.6642598
##
## Variance function structure of class varIdent representing
## -1 1
## 1.000000 1.003592
## Residual standard error: 7.121407
##
## Value Std.Error t-value p-value
## Woman 50.5948 1.6479 30.7023 0.0000
## Man 48.0010 1.6420 29.2329 0.0000
## Abuse_AW -0.4178 0.1192 -3.5043 0.0005
## Abuse_PW -0.2250 0.1376 -1.6358 0.1029
## Abuse_AM -0.1795 0.1371 -1.3099 0.1912
## Abuse_PM -0.1744 0.1188 -1.4678 0.1432
## 2.5 % 97.5 %
## Woman 47.3650 53.8247
## Man 44.7827 51.2193
## Abuse_AW -0.6515 -0.1841
## Abuse_PW -0.4947 0.0446
## Abuse_AM -0.4482 0.0891
## Abuse_PM -0.4072 0.0585
All four paths are negative but only the Woman actor effects is statistically significant: Reporting more childhood abuse leads to less relationship satisfaction. Both these effects could be potentially mediated.
apim_stp2 <- gls(Anxiety_A ~ -1 + Woman + Man
+ Abuse_AW + Abuse_PW + Abuse_AM + Abuse_PM,
na.action=na.omit, correlation=corCompSymm (form=~1|Dyad),
weights=varIdent(form=~1|Gender_A),data=riggsp)
smallsummary(apim_stp2)
## Correlation structure of class corCompSymm representing
## Rho
## 0.1656898
##
## Variance function structure of class varIdent representing
## -1 1
## 1.0000000 0.9013311
## Residual standard error: 1.246035
##
## Value Std.Error t-value p-value
## Woman 1.9282 0.2590 7.4461 0.0000
## Man 1.9629 0.2873 6.8320 0.0000
## Abuse_AW 0.0931 0.0187 4.9701 0.0000
## Abuse_PW 0.0143 0.0216 0.6625 0.5082
## Abuse_AM 0.0556 0.0240 2.3203 0.0210
## Abuse_PM 0.0218 0.0208 1.0488 0.2951
## 2.5 % 97.5 %
## Woman 1.4207 2.4358
## Man 1.3998 2.5260
## Abuse_AW 0.0564 0.1298
## Abuse_PW -0.0280 0.0567
## Abuse_AM 0.0086 0.1027
## Abuse_PM -0.0189 0.0625
All four paths of the “a” paths are positive but only the two actor effects are statistically significant: More childhood abuse leads at anxious attachment for yourself, but not for your partner.
apim_stp34 <- gls(Sat_A ~ -1 + Woman + Man
+ Anxiety_AW + Anxiety_PW + Anxiety_AM + Anxiety_PM
+ Abuse_AW + Abuse_PW + Abuse_AM + Abuse_PM,
na.action=na.omit,
correlation=corCompSymm (form=~1|Dyad),
weights=varIdent(form=~1|Gender_A),data=riggsp)
smallsummary(apim_stp34)
## Correlation structure of class corCompSymm representing
## Rho
## 0.6201065
##
## Variance function structure of class varIdent representing
## -1 1
## 1.000000 1.011957
## Residual standard error: 6.674376
##
## Value Std.Error t-value p-value
## Woman 55.9097 1.9556 28.5903 0.0000
## Man 53.4614 1.9324 27.6652 0.0000
## Anxiety_AW -1.5250 0.4946 -3.0831 0.0022
## Anxiety_PW -1.2097 0.4458 -2.7133 0.0070
## Anxiety_AM -1.6341 0.4406 -3.7092 0.0002
## Anxiety_PM -1.1684 0.4888 -2.3904 0.0174
## Abuse_AW -0.2494 0.1215 -2.0529 0.0409
## Abuse_PW -0.1359 0.1323 -1.0268 0.3053
## Abuse_AM -0.0719 0.1308 -0.5497 0.5829
## Abuse_PM -0.0300 0.1201 -0.2495 0.8032
## 2.5 % 97.5 %
## Woman 52.0769 59.7426
## Man 49.6739 57.2489
## Anxiety_AW -2.4945 -0.5555
## Anxiety_PW -2.0835 -0.3359
## Anxiety_AM -2.4976 -0.7706
## Anxiety_PM -2.1264 -0.2104
## Abuse_AW -0.4876 -0.0113
## Abuse_PW -0.3952 0.1235
## Abuse_AM -0.3282 0.1844
## Abuse_PM -0.2653 0.2054
Step 3: All four “b” paths from Anxiety to Satisfaction are negative and statistically significant: Having a more anxious attachment style leads to less satisfaction for you and your partner, even after controlling for childhood abuse.
Step 4: All paths from Abuse to Satisfaction, c’, are negative but only the actor effect for women is statistically significant: Being abused as a child leads to lower levels of satisfaction, even after controlling for yours and your partner’s anxious attachment.
# a or X --> M effects and standard errors
act_M_a <- coef(summary(apim_stp2))[5,1]
act_W_a <- coef(summary(apim_stp2))[3,1]
part_M_a <- coef(summary(apim_stp2))[6,1]
part_W_a <- coef(summary(apim_stp2))[4,1]
act_M_a_se <- coef(summary(apim_stp2))[5,2]
act_W_a_se <- coef(summary(apim_stp2))[3,2]
part_M_a_se <- coef(summary(apim_stp2))[6,2]
part_W_a_se <- coef(summary(apim_stp2))[4,2]
# b or M --> Y effects
act_M_b <- coef(summary(apim_stp34))[5,1]
act_W_b <- coef(summary(apim_stp34))[3,1]
part_M_b <- coef(summary(apim_stp34))[6,1]
part_W_b <- coef(summary(apim_stp34))[4,1]
act_M_b_se <- coef(summary(apim_stp34))[5,2]
act_W_b_se <- coef(summary(apim_stp34))[3,2]
part_M_b_se <- coef(summary(apim_stp34))[6,2]
part_W_b_se <- coef(summary(apim_stp34))[4,2]
# c or X --> Y total effects
act_M_c <- coef(summary(apim_stp1))[5,1]
act_W_c <- coef(summary(apim_stp1))[3,1]
part_M_c <- coef(summary(apim_stp1))[6,1]
part_W_c <- coef(summary(apim_stp1))[4,1]
# cp or X --> Y direct effects
act_M_cp <- coef(summary(apim_stp34))[9,1]
act_W_cp <- coef(summary(apim_stp34))[7,1]
part_M_cp <- coef(summary(apim_stp34))[10,1]
part_W_cp <- coef(summary(apim_stp34))[8,1]
#The Eight Indirect Effects
# Actor-Actor
AA_M_IE <- act_M_a*act_M_b
AA_W_IE <- act_W_a*act_W_b
# Actor-Partner
AP_M_IE <- act_W_a*part_M_b
AP_W_IE <- act_M_a*part_W_b
# Partner-Actor
PA_M_IE <- part_M_a*act_M_b
PA_W_IE <- part_W_a*act_W_b
# Partner-Partner
PP_M_IE <- part_W_a*part_M_b
PP_W_IE <- part_M_a*part_W_b
#Testing Indirect Effects Using Multilevel Modeling
# The 95% confidence interval for Men AA indrect effect:
CI_AA_M = mmc(act_M_a, act_M_b, act_M_a_se, act_M_b_se)
# The 95% confidence interval for Women AA indrect effect:
CI_AA_W = mmc(act_W_a, act_W_b, act_W_a_se, act_W_b_se)
# The 95% confidence interval for Men AP indrect effect:
CI_AP_M = mmc(act_W_a, part_M_b, act_W_a_se, part_M_b_se)
# The 95% confidence interval for Women AP indrect effect:
CI_AP_W = mmc(act_M_a, part_W_b, act_M_a_se, part_W_b_se)
# The 95% confidence interval for Men PA indrect effect:
CI_PA_M = mmc(part_M_a, act_M_b, part_M_a_se, act_M_b_se)
# The 95% confidence interval for Women PA indrect effect:
CI_PA_W = mmc(part_W_a, act_W_b, part_W_a_se, act_W_b_se)
# The 95% confidence interval for Men PP indrect effect:
CI_PP_M = mmc(part_W_a, part_M_b, part_W_a_se, part_M_b_se)
# The 95% confidence interval for Women PP indrect effect:
CI_PP_W = mmc(part_M_a, part_W_b, part_M_a_se, part_W_b_se)
The dyadr function mmc computes the Monte Carlo confidence intervals for indirect effects It is an adaptation of the function MCMAM written by Selig and Preacher (2008). It has four pieces of information in this order: a (the X to M effect), b (the M to Y effect), standard error of a, and the standard error of b. (For other parameters look at ?mmc.)
Name | Indirect Effects | Estimate | p | 95% CI Lower | Upper |
---|---|---|---|---|---|
Actor-Actor: M | Xm -> Mm -> Ym | -0.091 | 0.02 | -0.196 | -0.012 |
Actor-Actor: W | Xw -> Mw -> Yw | -0.142 | 0.002 | -0.26 | -0.047 |
Partner-Partner: M | Xm -> Mw -> Ym | -0.017 | 0.515 | -0.08 | 0.035 |
Partner-Partner: W | Xw -> Mm -> Yw | -0.026 | 0.294 | -0.091 | 0.023 |
Actor-Partner: M | Xw -> Mw -> Ym | -0.109 | 0.017 | -0.219 | -0.019 |
Actor-Partner: W | Xm -> Mm -> Yw | -0.067 | 0.027 | -0.158 | -0.005 |
Partner-Actor: M | Xw -> Mm -> Ym | -0.036 | 0.289 | -0.115 | 0.031 |
Partner-Actor: W | Xm -> Mw -> YW | -0.022 | 0.507 | -0.099 | 0.044 |
Note that p value and lower and upper limits of the confidence interval will differ slightly because they are based on Monte Carlo estimates.
Name | Direct Effects | Direct | Total | % Mediated |
---|---|---|---|---|
Actor: Man | Xm -> Ym | -0.072 | -0.18 | 60 |
Actor: Woman | Xw -> Yw | -0.249 | -0.418 | 40.3 |
Partner: Man | Xw -> Ym | -0.03 | -0.174 | 82.8 |
Partner: Woman | Xm -> Yw | -0.136 | -0.225 | 39.6 |
Note that % Mediated
equals ab/c
or equivalently 1 - c'/c
. This value can be larger than one or negative. Make sure that the total effect is non-trivial before interpreting these values.
Actor-Actor: Men —Men who report more abuse are more anxiously attached and are then less satisfied.
Actor-Actor: Women —Women who report more abuse are more anxiously attached and are then less satisfied.
Partner-Partner: Men —Men who report more abuse have partners who are more anxiously attached and they in turn are less satisfied.
Partner-Partner: Women —Women who report more abuse have partners who are more anxiously attached and they in turn are less satisfied.
Actor-Partner: Men —Women who report more abuse are more anxiously attached and their male partners in turn are less satisfied.
Actor-Partner: Women —Men who report more abuse are more anxiously attached and their female partners in turn are less satisfied.
Partner-Actor: Men —Women who report more abuse have male partners who are more anxiously attached and the Men are less satisfied.
Partner-Actor: Women —Men who report more abuse have male partners who are more anxiously attached and the Men are less satisfied.
***
step1i = gls(Sat_A ~ Abuse_A + Abuse_P ,
na.action=na.omit,
correlation=corCompSymm (form=~1|Dyad),
data=riggsp)
smallsummary(step1i)
## Correlation structure of class corCompSymm representing
## Rho
## 0.6591908
##
## Residual standard error: 7.128683
##
## Value Std.Error t-value p-value
## (Intercept) 49.3561 1.4933 33.0509 0.0000
## Abuse_A -0.3153 0.0873 -3.6094 0.0004
## Abuse_P -0.1955 0.0873 -2.2386 0.0259
## 2.5 % 97.5 %
## (Intercept) 46.4292 52.2829
## Abuse_A -0.4865 -0.1441
## Abuse_P -0.3667 -0.0243
Both actor and partner effects are statistically significant.
step2i = gls(Anxiety_A ~ Abuse_A + Abuse_P ,
na.action=na.omit,
correlation=corCompSymm (form=~1|Dyad),
data=riggsp)
smallsummary(step2i)
## Correlation structure of class corCompSymm representing
## Rho
## 0.1581534
##
## Residual standard error: 1.189104
##
## Value Std.Error t-value p-value
## (Intercept) 1.9316 0.2081 9.2814 0.0000
## Abuse_A 0.0803 0.0148 5.4273 0.0000
## Abuse_P 0.0151 0.0148 1.0231 0.3071
## 2.5 % 97.5 %
## (Intercept) 1.5237 2.3395
## Abuse_A 0.0513 0.1093
## Abuse_P -0.0139 0.0441
Only the actor effect is statistically significant.
step34i = gls(Sat_A ~ Anxiety_A + Anxiety_P + Abuse_A + Abuse_P,
na.action=na.omit,
correlation=corCompSymm (form=~1|Dyad),
data=riggsp)
smallsummary(step34i)
## Correlation structure of class corCompSymm representing
## Rho
## 0.6143927
##
## Residual standard error: 6.682944
##
## Value Std.Error t-value p-value
## (Intercept) 54.7324 1.7265 31.7021 0.0000
## Anxiety_A -1.6013 0.3089 -5.1836 0.0000
## Anxiety_P -1.1820 0.3089 -3.8264 0.0002
## Abuse_A -0.1688 0.0865 -1.9521 0.0518
## Abuse_P -0.0764 0.0865 -0.8834 0.3777
## 2.5 % 97.5 %
## (Intercept) 51.3486 58.1162
## Anxiety_A -2.2068 -0.9958
## Anxiety_P -1.7875 -0.5766
## Abuse_A -0.3383 0.0007
## Abuse_P -0.2459 0.0931
Direct effects are not significant, but the “b” paths, both actor and partner, are significant.
# a or X --> M effects and standard errors
act_a <- coef(summary(step2i))[2,1]
part_a <- coef(summary(step2i))[3,1]
act_a_se <- coef(summary(step2i))[2,2]
part_a_se <- coef(summary(step2i))[3,2]
# b or M --> Y effects
act_b <- coef(summary(step34i))[2,1]
part_b <- coef(summary(step34i))[3,1]
act_b_se <- coef(summary(step34i))[2,2]
part_b_se <- coef(summary(step34i))[3,2]
# c or X --> Y total effects
act_c <- coef(summary(step1i))[2,1]
part_c <- coef(summary(step1i))[3,1]
# cp or X --> Y direct effects
act_cp <- coef(summary(step34i))[4,1]
part_cp <- coef(summary(step34i))[5,1]
##Indirect Effects
# Actor-Actor
AA_IE <- act_a*act_b
# Actor-Partner
AP_IE <- act_a*part_b
# Partner-Actor
PA_IE <- part_a*act_b
# Partner-Partner
PP_IE <- part_a*part_b
# The 95% confidence interval for AA indrect effect:
CI_AA = mmc(act_a, act_b, act_a_se, act_b_se)
# The 95% confidence interval for AP indrect effect:
CI_AP = mmc(act_a, part_b, act_a_se, part_b_se)
# The 95% confidence interval for PA indrect effect:
CI_PA = mmc(part_a, act_b, part_a_se, act_b_se)
# The 95% confidence interval for Men PP indrect effect:
CI_PP = mmc(part_a, part_b, part_a_se, part_b_se)
Name | Indirect Effects | Estimate | p | 95% CI Lower | Upper |
---|---|---|---|---|---|
Actor-Actor | X1 -> M1 -> Y1 | -0.129 | 0 | -0.202 | -0.068 |
Partner-Partner | X1 -> M2 -> Y1 | -0.018 | 0.302 | -0.058 | 0.017 |
Actor-Partner | X2 -> M2 -> Y1 | -0.095 | 0 | -0.161 | -0.041 |
Partner-Actor | X1 -> M2 -> Y1 | -0.024 | 0.302 | -0.076 | 0.022 |
Note that p value and lower and upper limits of the confidence interval will differ slightly because they are based on Monte Carlo estimates.
Name | Direct Effects | Direct | Total | % Mediated |
---|---|---|---|---|
Actor | X1 -> Y1 | -0.169 | -0.315 | 46.5 |
Partner | X2 -> Y1 | -0.076 | -0.196 | 60.9 |
Note that % Mediated
equals ab/c
or equivalently 1 - c'/c
. This value can be larger than one or negative. Make sure that the total effect is non-trivial before interpreting these values.
Actor-Actor —People who report more abuse are more anxiously attached and are then less satisfied.
Partner-Partner —People who report more abuse have partners who are more anxiously attached and they in turn are less satisfied.
Actor-Partner —People who report more abuse are more anxiously attached and their partners in turn are less satisfied.
Partner-Actor —People who report more abuse have partners who are more anxiously attached and those partners are less satisfied.
(diagram taken from the app APIM_MM)