Back to schedule


Load the Data

Read in the data and create separate slope variables and obsid variable.

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

kashy_ppp <- read.csv("kashy.csv")

Create obsid Index Variable

kashy_ppp <- kashy_ppp %>%
  mutate(obsid = Day+14*(DYADID-1))

Troubleshooting Model Convergence Issues

Use the lmeControl() function to tweak model estimation options.

#?lmeControl

ctrl <- lmeControl(msMaxIter=10000,
                   MaxIter=100000,
                   msMaxEval=10000,
                   returnObject=TRUE,
                   niterEM=10000,
                   nlmStepMax=1000)

Stability-Influence Model

Creating Lagged Variables

kashy_ppp <- kashy_ppp %>%
  group_by(DYADID, Person) %>%
  mutate(AsatisfC_lag = lag(AsatisfC), 
         PsatisfC_lag = lag(PsatisfC))

Two-Intercept Approach

Use the lagged actor and partner variables.

stab_infl_2int  <- lme(ASATISF ~ GenderS + GenderS:AsatisfC_lag 
                          + GenderS:PsatisfC_lag - 1, 
                       data = kashy_ppp, 
                       random = ~ GenderS + GenderS:AsatisfC_lag 
                          + GenderS:PsatisfC_lag - 1|DYADID,
                       correlation = corCompSymm(form = ~1|DYADID/obsid),  
                       weights = varIdent(form = ~1|GenderS),
                       na.action = na.omit,
                       control = ctrl)

smallsummary(stab_infl_2int)
## Random effects:
##  Formula: ~GenderS + GenderS:AsatisfC_lag + GenderS:PsatisfC_lag - 1 | DYADID
##  Structure: General positive-definite, Log-Cholesky parametrization
##                           StdDev    Corr                              
## GenderSMan                0.3674092 GndrSM GndrSW GSM:AC GSW:AC GSM:PC
## GenderSWoman              0.2872582  0.784                            
## GenderSMan:AsatisfC_lag   0.2180435 -0.233 -0.070                     
## GenderSWoman:AsatisfC_lag 0.1850458 -0.206 -0.706 -0.229              
## GenderSMan:PsatisfC_lag   0.1581867 -0.251 -0.657 -0.149  0.736       
## GenderSWoman:PsatisfC_lag 0.2510808  0.174  0.157  0.718 -0.319  0.128
## Residual                  0.5810990                                   
## 
##                            Value Std.Error   DF  t-value p-value
## GenderSMan                6.3728    0.0416 2539 153.2250  0.0000
## GenderSWoman              6.4140    0.0358 2539 179.0210  0.0000
## GenderSMan:AsatisfC_lag   0.2862    0.0404 2539   7.0812  0.0000
## GenderSWoman:AsatisfC_lag 0.2601    0.0387 2539   6.7219  0.0000
## GenderSMan:PsatisfC_lag   0.0246    0.0350 2539   0.7048  0.4810
## GenderSWoman:PsatisfC_lag 0.0672    0.0413 2539   1.6255  0.1042
##                              2.5%  97.5%
## GenderSMan                 6.2913 6.4544
## GenderSWoman               6.3437 6.4842
## GenderSMan:AsatisfC_lag    0.2069 0.3654
## GenderSWoman:AsatisfC_lag  0.1842 0.3360
## GenderSMan:PsatisfC_lag   -0.0439 0.0932
## GenderSWoman:PsatisfC_lag -0.0139 0.1483

Interaction Approach

stab_infl  <- lme(ASATISF ~ GENDER*AsatisfC_lag + GENDER*PsatisfC_lag, 
                  data = kashy_ppp, 
                  random = ~ GenderS + GenderS:AsatisfC_lag 
                      + GenderS:PsatisfC_lag - 1|DYADID,
                  correlation = corCompSymm(form = ~1|DYADID/obsid),  
                  weights = varIdent(form = ~1|GenderS),
                  na.action = na.omit,
                  control = ctrl)

smallsummary(stab_infl)
## Random effects:
##  Formula: ~GenderS + GenderS:AsatisfC_lag + GenderS:PsatisfC_lag - 1 | DYADID
##  Structure: General positive-definite, Log-Cholesky parametrization
##                           StdDev    Corr                              
## GenderSMan                0.3674099 GndrSM GndrSW GSM:AC GSW:AC GSM:PC
## GenderSWoman              0.2872588  0.784                            
## GenderSMan:AsatisfC_lag   0.2180432 -0.233 -0.070                     
## GenderSWoman:AsatisfC_lag 0.1850460 -0.206 -0.706 -0.229              
## GenderSMan:PsatisfC_lag   0.1581862 -0.251 -0.657 -0.149  0.736       
## GenderSWoman:PsatisfC_lag 0.2510806  0.174  0.157  0.718 -0.319  0.128
## Residual                  0.5810991                                   
## 
##                       Value Std.Error   DF  t-value p-value
## (Intercept)          6.3934    0.0358 2539 178.4926  0.0000
## GENDER              -0.0206    0.0150 2539  -1.3754  0.1691
## AsatisfC_lag         0.2732    0.0252 2539  10.8283  0.0000
## PsatisfC_lag         0.0459    0.0262 2539   1.7548  0.0794
## GENDER:AsatisfC_lag  0.0130    0.0305 2539   0.4273  0.6692
## GENDER:PsatisfC_lag -0.0213    0.0279 2539  -0.7614  0.4465
##                        2.5%  97.5%
## (Intercept)          6.3232 6.4636
## GENDER              -0.0499 0.0088
## AsatisfC_lag         0.2237 0.3226
## PsatisfC_lag        -0.0054 0.0972
## GENDER:AsatisfC_lag -0.0467 0.0728
## GENDER:PsatisfC_lag -0.0761 0.0335

Back to schedule