Outcome: Satisfaction in Roommates
Predictor: Agreeableness
Actor and Partner Main Effects: Assumed to be positive
Â
Possible Effects:
Read in the pairwise dataset
library(dyadr)
library(dplyr)
library(nlme)
library(ggplot2)
riggsp <- read.csv("riggsp.csv")
First let’s again run the basic indistinguishable APIM.
apimi <- gls(Sat_A ~ Avoid_A + Avoid_P,
na.action = na.omit,
correlation = corCompSymm (form=~1|Dyad),
data = riggsp)
smallsummary(apimi)
## Correlation structure of class corCompSymm representing
## Rho
## 0.6470868
##
## Residual standard error: 6.82339
##
## Value Std.Error t-value p-value
## (Intercept) 49.5074 1.0337 47.8915 0.0000
## Avoid_A -2.1249 0.3476 -6.1124 0.0000
## Avoid_P -1.0902 0.3476 -3.1361 0.0019
## 2.5 % 97.5 %
## (Intercept) 47.4813 51.5335
## Avoid_A -2.8062 -1.4435
## Avoid_P -1.7715 -0.4088
Next, before we add the interaction, let’s grand-mean center the two variables. We will talk much more about centering tomorrow when we discuss moderation.
riggsp <- riggsp %>%
mutate(CAvoid_A = Avoid_A - mean(Avoid_A),
CAvoid_P = Avoid_P - mean(Avoid_P))
Now we will add the actor-partner interaction using the product approach.
apimi_apint <- gls(Sat_A ~ CAvoid_A + CAvoid_P + CAvoid_A*CAvoid_P,
na.action = na.omit,
correlation = corCompSymm (form=~1|Dyad),
data = riggsp)
smallsummary(apimi_apint)
## Correlation structure of class corCompSymm representing
## Rho
## 0.6483947
##
## Residual standard error: 6.836068
##
## Value Std.Error t-value p-value
## (Intercept) 44.8441 0.5010 89.5085 0.0000
## CAvoid_A -2.1583 0.3534 -6.1080 0.0000
## CAvoid_P -1.1236 0.3534 -3.1798 0.0016
## CAvoid_A:CAvoid_P -0.2839 0.5082 -0.5586 0.5768
## 2.5 % 97.5 %
## (Intercept) 43.8622 45.8261
## CAvoid_A -2.8508 -1.4657
## CAvoid_P -1.8162 -0.4310
## CAvoid_A:CAvoid_P -1.2800 0.7122
There is no statistically significant actor-partner interaction, but the estimate is negative. We could interpret this tiny estimate as the negative actor effect of avoidance gets more negative if your partner is higher in avoidance.
Next we’ll use the absolute discrepancy approach instead of the product approach. We have to add this variable to the dataset.
riggsp <- riggsp %>%
mutate(part_desc = abs(CAvoid_A - CAvoid_P))
Now we use this discrepancy in the model.
apimi_desc <- gls(Sat_A ~ CAvoid_A + CAvoid_P + part_desc,
na.action = na.omit,
correlation = corCompSymm (form=~1|Dyad),
data = riggsp)
smallsummary(apimi_desc)
## Correlation structure of class corCompSymm representing
## Rho
## 0.6458482
##
## Residual standard error: 6.811447
##
## Value Std.Error t-value p-value
## (Intercept) 43.9011 0.8678 50.5899 0.0000
## CAvoid_A -2.3720 0.3967 -5.9787 0.0000
## CAvoid_P -1.3374 0.3967 -3.3708 0.0008
## part_desc 0.8034 0.6250 1.2855 0.1996
## 2.5 % 97.5 %
## (Intercept) 42.2002 45.6019
## CAvoid_A -3.1496 -1.5944
## CAvoid_P -2.1150 -0.5598
## part_desc -0.4215 2.0283
The absolute discrepancy effect is not statistically significant, but the sign of the estimate is positive–this indicates that as the couple is more dissimilar in avoidance they are more happy.
Let’s first run the basic distinguishable dyads APIM. Here we use the two-intercept model.
apimd <- gls(Sat_A ~ Genderstring + Genderstring:Avoid_A
+ Avoid_P:Genderstring - 1,
na.action = na.omit,
correlation = corCompSymm (form=~1|Dyad),
weights = varIdent(form=~1|Genderstring),
data = riggsp)
smallsummary(apimd)
## Correlation structure of class corCompSymm representing
## Rho
## 0.6436512
##
## Variance function structure of class varIdent representing
## Man Woman
## 1.000000 1.022121
## Residual standard error: 6.756969
##
## Value Std.Error t-value p-value
## GenderstringMan 49.4068 1.1281 43.7956 0.0000
## GenderstringWoman 49.6339 1.1531 43.0447 0.0000
## GenderstringMan:Avoid_A -1.7537 0.5075 -3.4560 0.0006
## GenderstringWoman:Avoid_A -2.4806 0.5062 -4.9008 0.0000
## GenderstringMan:Avoid_P -1.3772 0.4952 -2.7812 0.0058
## GenderstringWoman:Avoid_P -0.7890 0.5187 -1.5212 0.1293
## 2.5 % 97.5 %
## GenderstringMan 47.1958 51.6179
## GenderstringWoman 47.3739 51.8939
## GenderstringMan:Avoid_A -2.7483 -0.7592
## GenderstringWoman:Avoid_A -3.4726 -1.4885
## GenderstringMan:Avoid_P -2.3478 -0.4067
## GenderstringWoman:Avoid_P -1.8056 0.2276
All actor and partner effects are significant except for the men -> woman partner effect. We can use lincomb() to test if the actor and partner effects are different across gender.
data.frame(Actor_effects = lincomb(apimd, 3, 4),
Partner_effects = lincomb(apimd, 5, 6),
row.names = c("Mean diff", "SE", "p-value"))
## Actor_effects Partner_effects
## Mean diff 0.7268355 -0.5882618
## SE 0.7362712 0.7366442
## p-value 0.3235522 0.4245399
The actor and partner effects are not statistically different from each other. Note that although the men’s partner effect is sig and the women’s partner effects is not-sig, they are not significantly different from each other.
Next we add the actor-partner interactions using the product approach.
apimd_apint <- gls(Sat_A ~ Genderstring
+ Genderstring:CAvoid_A + Genderstring:CAvoid_P
+ Genderstring:CAvoid_A:CAvoid_P - 1,
na.action = na.omit,
correlation = corCompSymm (form=~1|Dyad),
weights = varIdent(form=~1|Genderstring),
data = riggsp)
smallsummary(apimd_apint)
## Correlation structure of class corCompSymm representing
## Rho
## 0.657623
##
## Variance function structure of class varIdent representing
## Man Woman
## 1.000000 1.013844
## Residual standard error: 6.770519
##
## Value Std.Error t-value p-value
## GenderstringMan 44.8031 0.5481 81.7421 0.0000
## GenderstringWoman 44.9597 0.5557 80.9079 0.0000
## GenderstringMan:CAvoid_A -1.7219 0.5110 -3.3696 0.0009
## GenderstringWoman:CAvoid_A -2.6165 0.5094 -5.1363 0.0000
## GenderstringMan:CAvoid_P -1.3277 0.5025 -2.6425 0.0087
## GenderstringWoman:CAvoid_P -0.8764 0.5181 -1.6916 0.0918
## GenderstringMan:CAvoid_A:CAvoid_P 0.3475 0.5548 0.6263 0.5316
## GenderstringWoman:CAvoid_A:CAvoid_P -0.9537 0.5625 -1.6954 0.0910
## 2.5 % 97.5 %
## GenderstringMan 43.7288 45.8773
## GenderstringWoman 43.8706 46.0489
## GenderstringMan:CAvoid_A -2.7234 -0.7203
## GenderstringWoman:CAvoid_A -3.6149 -1.6181
## GenderstringMan:CAvoid_P -2.3125 -0.3429
## GenderstringWoman:CAvoid_P -1.8918 0.1390
## GenderstringMan:CAvoid_A:CAvoid_P -0.7400 1.4349
## GenderstringWoman:CAvoid_A:CAvoid_P -2.0561 0.1488
The actor-partner interaction is not significant for men, but it is for women. But are they different from each other?
L1 <- data.frame(Actor_effects = lincomb(apimd, 3, 4),
Partner_effects = lincomb(apimd, 5, 6),
APint = lincomb(apimd_apint, 7, 8),
row.names = c("Mean diff", "SE", "p-value"))
L1
## Actor_effects Partner_effects APint
## Mean diff 0.7268355 -0.5882618 1.301117875
## SE 0.7362712 0.7366442 0.462346775
## p-value 0.3235522 0.4245399 0.004890486
The actor-partner interactions were significantly different between men and women, b = 0.3235522, SE = 0.4245399, p = 0.0048905. (Note that these three in-text numbers were generated by coding in R Markdown. Yes, you can change the number of decimal places with the format()
function!)
Let’s next explore what this interaction means by testing the simple slopes and graphing it. We will use a re-centering approach that allows us to see the effect of partner avoidance at high (+1 SD) and low (-1 SD) actor avoidance.
First we re-center actor avoidance. We want two new variables:
#That's right, we subtract for high and add for low!
riggsp <- riggsp %>%
mutate(High_CAvoid_A = CAvoid_A - sd(CAvoid_A),
Low_CAvoid_A = CAvoid_A + sd(CAvoid_A))
Then we use these in the models.
apimd_high <- gls(Sat_A ~ Genderstring
+ Genderstring:High_CAvoid_A + Genderstring:CAvoid_P
+ Genderstring:High_CAvoid_A:CAvoid_P - 1,
na.action = na.omit,
correlation = corCompSymm (form=~1|Dyad),
weights = varIdent(form=~1|Genderstring),
data = riggsp)
apimd_low <- gls(Sat_A ~ Genderstring
+ Genderstring:Low_CAvoid_A + Genderstring:CAvoid_P
+ Genderstring:Low_CAvoid_A:CAvoid_P - 1,
na.action = na.omit,
correlation = corCompSymm (form=~1|Dyad),
weights = varIdent(form=~1|Genderstring),
data = riggsp)
summary(apimd_high)$tTable
## Value Std.Error t-value
## GenderstringMan 42.9264037 0.7977925 53.8064767
## GenderstringWoman 42.1080843 0.7586333 55.5051852
## GenderstringMan:High_CAvoid_A -1.7218986 0.5110049 -3.3696322
## GenderstringWoman:High_CAvoid_A -2.6164936 0.5094128 -5.1362938
## GenderstringMan:CAvoid_P -0.9490301 0.8448354 -1.1233313
## GenderstringWoman:CAvoid_P -1.9157439 0.8411036 -2.2776551
## GenderstringMan:High_CAvoid_A:CAvoid_P 0.3474665 0.5548236 0.6262648
## GenderstringWoman:High_CAvoid_A:CAvoid_P -0.9536514 0.5625048 -1.6953657
## p-value
## GenderstringMan 8.812027e-157
## GenderstringWoman 1.744099e-160
## GenderstringMan:High_CAvoid_A 8.504364e-04
## GenderstringWoman:High_CAvoid_A 5.034206e-07
## GenderstringMan:CAvoid_P 2.621890e-01
## GenderstringWoman:CAvoid_P 2.344589e-02
## GenderstringMan:High_CAvoid_A:CAvoid_P 5.316143e-01
## GenderstringWoman:High_CAvoid_A:CAvoid_P 9.103676e-02
summary(apimd_low)$tTable
## Value Std.Error t-value
## GenderstringMan 46.6797292 0.7646638 61.0460801
## GenderstringWoman 47.8114124 0.8115115 58.9164923
## GenderstringMan:Low_CAvoid_A -1.7218986 0.5110049 -3.3696322
## GenderstringWoman:Low_CAvoid_A -2.6164936 0.5094128 -5.1362938
## GenderstringMan:CAvoid_P -1.7064237 0.7228286 -2.3607585
## GenderstringWoman:CAvoid_P 0.1629871 0.7622658 0.2138193
## GenderstringMan:Low_CAvoid_A:CAvoid_P 0.3474665 0.5548236 0.6262648
## GenderstringWoman:Low_CAvoid_A:CAvoid_P -0.9536514 0.5625048 -1.6953657
## p-value
## GenderstringMan 6.036219e-172
## GenderstringWoman 1.197426e-167
## GenderstringMan:Low_CAvoid_A 8.504364e-04
## GenderstringWoman:Low_CAvoid_A 5.034206e-07
## GenderstringMan:CAvoid_P 1.887285e-02
## GenderstringWoman:CAvoid_P 8.308323e-01
## GenderstringMan:Low_CAvoid_A:CAvoid_P 5.316143e-01
## GenderstringWoman:Low_CAvoid_A:CAvoid_P 9.103676e-02
All we care about is the effect of the partner’s avoidance for women when her avoidance is high…
coef(summary(apimd_high))[c(2,6),]
## Value Std.Error t-value p-value
## GenderstringWoman 42.108084 0.7586333 55.505185 1.744099e-160
## GenderstringWoman:CAvoid_P -1.915744 0.8411036 -2.277655 2.344589e-02
…and when her avoidance is low.
coef(summary(apimd_low))[c(2,6),]
## Value Std.Error t-value p-value
## GenderstringWoman 47.8114124 0.8115115 58.9164923 1.197426e-167
## GenderstringWoman:CAvoid_P 0.1629871 0.7622658 0.2138193 8.308323e-01
Finally, let’s graph the interaction. Let’s first make a dataset with only the women.
womenOnly <- riggsp %>%
filter(Gender_A == 1)
Now we will use the graphMod()
function in dyadr
. Type ?graphMod
to read about this function.
plot <- graphMod(data = womenOnly,
x = womenOnly$CAvoid_P,
y = womenOnly$Sat_A,
mod = womenOnly$CAvoid_A,
highMod = apimd_high,
lowMod = apimd_low,
int = 2,
slp = 6)
plot
plot
is a ggplot object, and so you can add onto it with functions from the ggplot2
package. For example, to create labels and change the colors:
plot +
theme_classic() +
ylab("Satisfaction") +
xlab("Partner's Avoidance") +
scale_color_manual(values = c("cadetblue", "salmon")) +
scale_color_discrete(name = "Actor's Avoidance")
See a complete list of R colors here.