Back to schedule


Load the Data

Read in the pairwise dataset and load the packages

library(dyadr)
library(dplyr)
library(nlme)
library(ggplot2)

riggsp <- read.csv("riggsp.csv")

Riggs Example

Outcome: [Sat_A] Satisfaction
Predictor Variables: [Avoid_A, Avoid_P] Adult avoidant attachment (Actor and Partner), a mixed variable.
Moderators: [Anxiety_A, Anxiety_P] Adult anxious attachment (Actor and Partner), a mixed variable.

Data Preparation

We first grand-mean center the moderator and predictor variables.

riggsp <- riggsp %>% 
  mutate(CAvoid_A = Avoid_A - mean(Avoid_A), 
         CAvoid_P = Avoid_P - mean(Avoid_P),
         CAnxiety_A = Anxiety_A - mean(Anxiety_A), 
         CAnxiety_P = Anxiety_P - mean(Anxiety_P)) 

Saturated Two-Intercept Model

We then estimate the two-intercept model with the string gender variable and all of the anxiety by avoidance interactions:

apim_sat_two <- gls(Sat_A ~ Genderstring + CAvoid_A:Genderstring 
                    + CAvoid_P:Genderstring + CAnxiety_A:Genderstring 
                    + CAnxiety_P:Genderstring 
                    + CAnxiety_A:CAvoid_A:Genderstring 
                    + CAnxiety_A:CAvoid_P:Genderstring
                    + CAnxiety_P:CAvoid_A:Genderstring 
                    + CAnxiety_P:CAvoid_P:Genderstring - 1,
                    data = riggsp,
                    correlation = corCompSymm(form=~1|Dyad), 
                    weights = varIdent(form=~1|Genderstring), 
                    na.action = na.omit)

smallsummary(apim_sat_two)
## Correlation structure of class corCompSymm representing
##       Rho 
## 0.6222822 
## 
## Variance function structure of class varIdent representing
##      Man    Woman 
## 1.000000 1.077605 
## Residual standard error: 6.141725 
## 
##                                         Value Std.Error t-value p-value
## GenderstringMan                       45.3642    0.5767 78.6632  0.0000
## GenderstringWoman                     45.4681    0.6214 73.1654  0.0000
## GenderstringMan:CAvoid_A              -1.2850    0.5031 -2.5542  0.0112
## GenderstringWoman:CAvoid_A            -1.3207    0.5668 -2.3303  0.0205
## GenderstringMan:CAvoid_P               0.0209    0.5259  0.0397  0.9683
## GenderstringWoman:CAvoid_P            -0.4061    0.5421 -0.7490  0.4545
## GenderstringMan:CAnxiety_A            -1.2284    0.4338 -2.8317  0.0050
## GenderstringWoman:CAnxiety_A          -1.6208    0.4904 -3.3052  0.0011
## GenderstringMan:CAnxiety_P            -1.1014    0.4551 -2.4204  0.0161
## GenderstringWoman:CAnxiety_P          -0.9123    0.4675 -1.9516  0.0519
## GenderstringMan:CAvoid_A:CAnxiety_A    1.4250    0.3989  3.5722  0.0004
## GenderstringWoman:CAvoid_A:CAnxiety_A -0.9834    0.4809 -2.0450  0.0418
## GenderstringMan:CAvoid_P:CAnxiety_A   -1.1489    0.4214 -2.7262  0.0068
## GenderstringWoman:CAvoid_P:CAnxiety_A -0.3160    0.4496 -0.7028  0.4827
## GenderstringMan:CAvoid_A:CAnxiety_P   -0.0243    0.4173 -0.0582  0.9536
## GenderstringWoman:CAvoid_A:CAnxiety_P -0.2839    0.4541 -0.6252  0.5323
## GenderstringMan:CAvoid_P:CAnxiety_P   -0.9613    0.4462 -2.1542  0.0320
## GenderstringWoman:CAvoid_P:CAnxiety_P  0.3808    0.4299  0.8859  0.3764
##                                         2.5 %  97.5 %
## GenderstringMan                       44.2339 46.4945
## GenderstringWoman                     44.2501 46.6861
## GenderstringMan:CAvoid_A              -2.2710 -0.2989
## GenderstringWoman:CAvoid_A            -2.4316 -0.2099
## GenderstringMan:CAvoid_P              -1.0099  1.0517
## GenderstringWoman:CAvoid_P            -1.4686  0.6565
## GenderstringMan:CAnxiety_A            -2.0786 -0.3782
## GenderstringWoman:CAnxiety_A          -2.5819 -0.6597
## GenderstringMan:CAnxiety_P            -1.9933 -0.2095
## GenderstringWoman:CAnxiety_P          -1.8285  0.0039
## GenderstringMan:CAvoid_A:CAnxiety_A    0.6431  2.2068
## GenderstringWoman:CAvoid_A:CAnxiety_A -1.9258 -0.0409
## GenderstringMan:CAvoid_P:CAnxiety_A   -1.9748 -0.3229
## GenderstringWoman:CAvoid_P:CAnxiety_A -1.1973  0.5653
## GenderstringMan:CAvoid_A:CAnxiety_P   -0.8421  0.7935
## GenderstringWoman:CAvoid_A:CAnxiety_P -1.1740  0.6061
## GenderstringMan:CAvoid_P:CAnxiety_P   -1.8359 -0.0867
## GenderstringWoman:CAvoid_P:CAnxiety_P -0.4617  1.2233

We see that 4 of the 8 moderation effects are statistically significant. Six of the eight coefficients are negative. Note that all significant actor and partner effects for anxiety and avoidance are negative—so in general, a negative interaction effect indicates a more-is-worse effect whereas a positive interaction effect indicates an alleviation effect.

Interpretation

To more easily interpret the moderation effects, it may be beneficial to switch the predictor and the moderator. In this case, we will keep the predictor as Avoidance and the moderator as Anxiety. Interpretation of the eight interactions:

Avoid_A with Anxiety_A (Man): We would predict the negative effect of men’s own avoidance on their satisfaction to be alleviated as their anxiety goes up.

Avoid_A with Anxiety_A (Woman): We would predict the negative effect of women’s own avoidance on their satisfaction to be stronger (more negative) as their anxiety goes up.

Avoid_P with Anxiety_A (Man): We would predict the lack of an effect of the woman’s avoidance on the man’s satisfaction is made negative by his own anxiety.

Avoid_P with Anxiety_A (Woman): (not significant) We would predict that the negative effect of the man’s avoidance on the woman’s satisfaction is made worse by her own anxiety.

Avoid_A with Anxiety_P (Man): (not significant) We would predict the negative effect of men’s own avoidance on their satisfaction to be stronger as the woman’s anxiety goes up.

Avoid_A with Anxiety_P (Woman): (not significant) We would predict the negative effect of women’s own avoidance on their satisfaction to be stronger as the man’s anxiety goes up.

Avoid_P with Anxiety_P (Man): We would predict the lack of an effect of the woman’s avoidance on the man’s satisfaction is made negative by the woman’s anxiety.

Avoid_P with Anxiety_P (Woman): (not significant) We would predict that the negative effect of the man’s avoidance on the woman’s satisfaction is alleviated by the man’s anxiety.

Testing for Gender Differences in Moderation Effects

We can test if these interactions are significantly different across gender by using the test function.

gen_tests <- data.frame(act_act = lincomb(apim_sat_two, 11, 12),
                        prt_act = lincomb(apim_sat_two, 13, 14),
                        act_prt = lincomb(apim_sat_two, 15, 16),
                        prt_prt = lincomb(apim_sat_two, 17, 18),
                        row.names = c("Mean diff", "SE", "p-value"))

gen_tests
##                act_act    prt_act   act_prt     prt_prt
## Mean diff 2.4083279513 -0.8328326 0.2596097 -1.34206712
## SE        0.6498318363  0.6453611 0.6457962  0.64485056
## p-value   0.0002104929  0.1968803 0.6876845  0.03741502

Gender Interaction Approach

Alternatively, we can test if these moderation effects are significantly different across gender by running the model with gender interactions.

apim_sat_int <- gls(Sat_A ~ CAnxiety_A*CAvoid_A*Gender_A 
                    + CAnxiety_A*CAvoid_P*Gender_A
                    + CAnxiety_P*CAvoid_A*Gender_A 
                    + CAnxiety_P*CAvoid_P*Gender_A,
                    data = riggsp,
                    correlation = corCompSymm(form=~1|Dyad),
                    weights = varIdent(form=~1|Gender_A),
                    na.action = na.omit)

coef(summary(apim_sat_int))
##                                    Value Std.Error     t-value
## (Intercept)                  45.41612150 0.5396262 84.16219461
## CAnxiety_A                   -1.42457619 0.3208972 -4.43935351
## CAvoid_A                     -1.30286245 0.3739701 -3.48386766
## Gender_A                      0.05195146 0.2611202  0.19895615
## CAvoid_P                     -0.19258574 0.3727011 -0.51672976
## CAnxiety_P                   -1.00685306 0.3197087 -3.14928235
## CAnxiety_A:CAvoid_A           0.22081234 0.2993412  0.73766113
## CAnxiety_A:Gender_A          -0.19617772 0.3336852 -0.58791253
## CAvoid_A:Gender_A            -0.01787352 0.3838075 -0.04656897
## CAnxiety_A:CAvoid_P          -0.73243407 0.2928428 -2.50111695
## Gender_A:CAvoid_P            -0.21348458 0.3825710 -0.55802598
## CAvoid_A:CAnxiety_P          -0.15410981 0.2930825 -0.52582402
## Gender_A:CAnxiety_P           0.09454260 0.3325424  0.28430237
## CAvoid_P:CAnxiety_P          -0.29024257 0.2966359 -0.97844730
## CAnxiety_A:CAvoid_A:Gender_A -1.20416398 0.3249159 -3.70607874
## CAnxiety_A:Gender_A:CAvoid_P  0.41641630 0.3226806  1.29049081
## CAvoid_A:Gender_A:CAnxiety_P -0.12980483 0.3228981 -0.40199934
## Gender_A:CAvoid_P:CAnxiety_P  0.67103356 0.3224253  2.08120639
##                                    p-value
## (Intercept)                  8.469629e-207
## CAnxiety_A                    1.280854e-05
## CAvoid_A                      5.699687e-04
## Gender_A                      8.424355e-01
## CAvoid_P                      6.057360e-01
## CAnxiety_P                    1.806324e-03
## CAnxiety_A:CAvoid_A           4.613128e-01
## CAnxiety_A:Gender_A           5.570454e-01
## CAvoid_A:Gender_A             9.628886e-01
## CAnxiety_A:CAvoid_P           1.292790e-02
## Gender_A:CAvoid_P             5.772542e-01
## CAvoid_A:CAnxiety_P           5.994096e-01
## Gender_A:CAnxiety_P           7.763802e-01
## CAvoid_P:CAnxiety_P           3.286631e-01
## CAnxiety_A:CAvoid_A:Gender_A  2.517722e-04
## CAnxiety_A:Gender_A:CAvoid_P  1.979012e-01
## CAvoid_A:Gender_A:CAnxiety_P  6.879786e-01
## Gender_A:CAvoid_P:CAnxiety_P  3.828620e-02

Looking at these three-way interactions with gender we find significant gender differences in the actor-actor moderation effect and the partner-partner moderation effect:

coef(summary(apim_sat_int))[15:18,]
##                                   Value Std.Error    t-value      p-value
## CAnxiety_A:CAvoid_A:Gender_A -1.2041640 0.3249159 -3.7060787 0.0002517722
## CAnxiety_A:Gender_A:CAvoid_P  0.4164163 0.3226806  1.2904908 0.1979012063
## CAvoid_A:Gender_A:CAnxiety_P -0.1298048 0.3228981 -0.4019993 0.6879786018
## Gender_A:CAvoid_P:CAnxiety_P  0.6710336 0.3224253  2.0812064 0.0382861983

These are the same p-values we found with lincomb().

cbind(t(gen_tests[3,]), coef(summary(apim_sat_int))[15:18,4])
##              p-value             
## act_act 0.0002104929 0.0002517722
## prt_act 0.1968802989 0.1979012063
## act_prt 0.6876845149 0.6879786018
## prt_prt 0.0374150187 0.0382861983

You could also perform an omnibus test to see if there is distinguishability in the moderation effects.

apim_sat_int <- gls(Sat_A ~ CAnxiety_A*CAvoid_A*Gender_A 
                        + CAnxiety_A*CAvoid_P*Gender_A
                        + CAnxiety_P*CAvoid_A*Gender_A 
                        + CAnxiety_P*CAvoid_P*Gender_A,
                    method = "ML", #using ML
                    data = riggsp,
                    correlation = corCompSymm(form=~1|Dyad),
                    weights = varIdent(form=~1|Gender_A),
                    na.action = na.omit)


apim_sat_noMod <- gls(Sat_A ~ CAnxiety_A*CAvoid_A*Gender_A 
                          + CAnxiety_A*CAvoid_P*Gender_A
                          + CAnxiety_P*CAvoid_A*Gender_A 
                          + CAnxiety_P*CAvoid_P*Gender_A
                      - CAnxiety_A:CAvoid_A:Gender_A 
                      - CAnxiety_A:CAvoid_P:Gender_A
                      - CAnxiety_P:CAvoid_A:Gender_A 
                      - CAnxiety_P:CAvoid_P:Gender_A,
                    method = "ML", #using ML
                    data = riggsp,
                    correlation = corCompSymm(form=~1|Dyad),
                    weights = varIdent(form=~1|Gender_A),
                    na.action = na.omit)

anova(apim_sat_int, apim_sat_noMod)
##                Model df      AIC      BIC    logLik   Test  L.Ratio
## apim_sat_int       1 21 1975.818 2054.286 -966.9091                
## apim_sat_noMod     2 17 1984.438 2047.960 -975.2192 1 vs 2 16.62009
##                p-value
## apim_sat_int          
## apim_sat_noMod  0.0023

There is distinguishability in the moderation effects \(\chi^2(4) = 16.62\), \(p = .002\).

Testing Simple Slopes

To interpret an interaction and test for simple slopes (e.g., at 1 SD above and below the mean for anxiety), we can use the method of re-centering. Zooming in on the partner-partner moderation effect for men only, to estimate the simple slopes of partner avoidance at high and low partner anxiety, for example, we re-estimate the model for those who are 1 standard deviation (sd) above and then 1 sd below the mean on partner anxiety. We then look at the “main effect” of partner avoidance as it will now refer to effect of CAvoid_P when CAnxiety_P is one standard deviation above the mean (high) or one standard deviation below the mean (low).

Note that to have CAnxiety_P be zero when it is one sd above the mean, we subtract 1 sd from the centered score and add 1 sd for one sd below the mean:

riggsp <- riggsp %>%
  mutate(High_CAnxiety_P = CAnxiety_P - sd(CAnxiety_P),
         Low_CAnxiety_P = CAnxiety_P + sd(CAnxiety_P))

This might feel counterintuitive, but you can convince yourself! We then re-run the model 2 times using these 2 re-centered variables:

apim_pxp_high <- gls(Sat_A ~ Genderstring + CAvoid_A:Genderstring 
                    + CAvoid_P:Genderstring + CAnxiety_A:Genderstring 
                    + High_CAnxiety_P:Genderstring 
                    + CAnxiety_A:CAvoid_A:Genderstring 
                    + CAnxiety_A:CAvoid_P:Genderstring
                    + High_CAnxiety_P:CAvoid_A:Genderstring 
                    + High_CAnxiety_P:CAvoid_P:Genderstring - 1,
                    data = riggsp,
                    correlation = corCompSymm(form=~1|Dyad), 
                    weights = varIdent(form=~1|Genderstring), 
                    na.action = na.omit)

coef(summary(apim_pxp_high))[c(1,3,5,7,9,11,13,15,17),]
##                                                Value Std.Error     t-value
## GenderstringMan                          43.99478660 0.7233222 60.82322491
## GenderstringMan:CAvoid_A                 -1.31520772 0.6570690 -2.00162791
## GenderstringMan:CAvoid_P                 -1.17427167 0.6387965 -1.83825627
## GenderstringMan:CAnxiety_A               -1.22839846 0.4338011 -2.83170915
## GenderstringMan:High_CAnxiety_P          -1.10139566 0.4550514 -2.42037628
## GenderstringMan:CAvoid_A:CAnxiety_A       1.42497632 0.3989027  3.57224043
## GenderstringMan:CAvoid_P:CAnxiety_A      -1.14885037 0.4214101 -2.72620543
## GenderstringMan:CAvoid_A:High_CAnxiety_P -0.02430499 0.4172554 -0.05824966
## GenderstringMan:CAvoid_P:High_CAnxiety_P -0.96127613 0.4462317 -2.15420856
##                                                p-value
## GenderstringMan                          7.342412e-168
## GenderstringMan:CAvoid_A                  4.624971e-02
## GenderstringMan:CAvoid_P                  6.704028e-02
## GenderstringMan:CAnxiety_A                4.951822e-03
## GenderstringMan:High_CAnxiety_P           1.611462e-02
## GenderstringMan:CAvoid_A:CAnxiety_A       4.138415e-04
## GenderstringMan:CAvoid_P:CAnxiety_A       6.793933e-03
## GenderstringMan:CAvoid_A:High_CAnxiety_P  9.535896e-01
## GenderstringMan:CAvoid_P:High_CAnxiety_P  3.204181e-02

For men, when the woman’s anxiety is high there is a marginally significant negative effect of the woman’s avoidance on his satisfaction.

apim_pxp_low <- gls(Sat_A ~ Genderstring + CAvoid_A:Genderstring 
                    + CAvoid_P:Genderstring + CAnxiety_A:Genderstring 
                    + Low_CAnxiety_P:Genderstring 
                    + CAnxiety_A:CAvoid_A:Genderstring 
                    + CAnxiety_A:CAvoid_P:Genderstring
                    + Low_CAnxiety_P:CAvoid_A:Genderstring 
                    + Low_CAnxiety_P:CAvoid_P:Genderstring - 1,
                    data = riggsp,
                    correlation = corCompSymm(form=~1|Dyad), 
                    weights = varIdent(form=~1|Genderstring), 
                    na.action = na.omit)

coef(summary(apim_pxp_low))[c(1,3,5,7,9,11,13,15,17),]
##                                               Value Std.Error     t-value
## GenderstringMan                         46.73355349 0.8843883 52.84280189
## GenderstringMan:CAvoid_A                -1.25477014 0.7827789 -1.60296871
## GenderstringMan:CAvoid_P                 1.21606936 0.8722350  1.39419926
## GenderstringMan:CAnxiety_A              -1.22839846 0.4338011 -2.83170915
## GenderstringMan:Low_CAnxiety_P          -1.10139566 0.4550514 -2.42037628
## GenderstringMan:CAvoid_A:CAnxiety_A      1.42497632 0.3989027  3.57224043
## GenderstringMan:CAvoid_P:CAnxiety_A     -1.14885037 0.4214101 -2.72620543
## GenderstringMan:CAvoid_A:Low_CAnxiety_P -0.02430499 0.4172554 -0.05824966
## GenderstringMan:CAvoid_P:Low_CAnxiety_P -0.96127613 0.4462317 -2.15420856
##                                               p-value
## GenderstringMan                         1.652271e-151
## GenderstringMan:CAvoid_A                 1.100227e-01
## GenderstringMan:CAvoid_P                 1.643174e-01
## GenderstringMan:CAnxiety_A               4.951822e-03
## GenderstringMan:Low_CAnxiety_P           1.611462e-02
## GenderstringMan:CAvoid_A:CAnxiety_A      4.138415e-04
## GenderstringMan:CAvoid_P:CAnxiety_A      6.793933e-03
## GenderstringMan:CAvoid_A:Low_CAnxiety_P  9.535896e-01
## GenderstringMan:CAvoid_P:Low_CAnxiety_P  3.204181e-02

Now we see that when partner (woman) anxiety is low there is no statistically significant negative effect of partner avoidance on satisfaction, in fact, the coefficient for partner avoidance is now positive. But this coefficient is not significantly different from zero.

Making Interaction Figures

It would be nice to have a figure for the moderation of partner avoidance effect by actor anxiety.

To graph this interaction we need to note the position of the y-intercept and slope for CAvoid_P when CAnxiety_A is high and the y-intercept and slope for CAvoid_P when CAnxiety_A low. In this case the positions are 1 and 4 respectively. Then, we can use the graphMod() function in dyadr to make the figure. Recall that you can run the command ?graphMod to see what the graphMod() function needs.

?graphMod
plot <- graphMod(riggsp,
                 x = riggsp$CAvoid_P,
                 y = riggsp$Sat_A,
                 mod = riggsp$CAnxiety_P,
                 apim_pxp_high,
                 apim_pxp_low,
                 1, 5)

plot

We can then add labels and change the colors, etc.

plot +
  theme_classic() +
  ylab("Man's Satisfaction") +
  xlab("Woman's Avoidance") +
  scale_color_manual(values = c("cadetblue", "salmon")) +
  scale_color_discrete(name = "Woman's Anxiety")


Back to schedule