Back to schedule


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

library(tidyr)
library(dplyr)
library(nlme)

kashy_ppp <- read.csv(file.choose(), header=TRUE)

kashy_ppp <- kashy_ppp %>%
  mutate(slope_m = man*(time), slope_w = woman*(time), obsid = Day+14*(dyadid-1))

Longitudnal APIM

APIM_long  <- lme(satisf_A ~ genderE + conflict_A + conflict_P
                    + genderE*conflict_A + genderE*conflict_P, 
                    data = kashy_ppp, 
                    random = ~ man + woman  + conflict_A + conflict_P - 1|dyadid,
                    correlation = corCompSymm(form = ~1|dyadid/obsid),  
                    weights = varIdent(form = ~1|genderS),
                    na.action = na.omit)

summary(APIM_long)
## Linear mixed-effects model fit by REML
##  Data: kashy_ppp 
##        AIC      BIC    logLik
##   5134.899 5247.891 -2548.449
## 
## Random effects:
##  Formula: ~man + woman + conflict_A + conflict_P - 1 | dyadid
##  Structure: General positive-definite, Log-Cholesky parametrization
##            StdDev     Corr                
## man        0.60782469 man    woman  cnfl_A
## woman      0.48142010  0.756              
## conflict_A 0.11813139 -0.086 -0.147       
## conflict_P 0.08352535 -0.245 -0.419  0.529
## Residual   0.52654298                     
## 
## Correlation Structure: Compound symmetry
##  Formula: ~1 | dyadid/obsid 
##  Parameter estimate(s):
##       Rho 
## 0.2570029 
## Variance function:
##  Structure: Different standard deviations per stratum
##  Formula: ~1 | genderS 
##  Parameter estimates:
##        M        F 
## 1.000000 1.041919 
## Fixed effects: satisf_A ~ genderE + conflict_A + conflict_P + genderE * conflict_A +      genderE * conflict_P 
##                        Value  Std.Error   DF   t-value p-value
## (Intercept)         6.793863 0.05703066 2725 119.12649  0.0000
## genderE            -0.105341 0.02716656 2725  -3.87759  0.0001
## conflict_A         -0.162913 0.01535975 2725 -10.60651  0.0000
## conflict_P         -0.067184 0.01275868 2725  -5.26576  0.0000
## genderE:conflict_A  0.023139 0.01104504 2725   2.09494  0.0363
## genderE:conflict_P -0.005632 0.01091235 2725  -0.51610  0.6058
##  Correlation: 
##                    (Intr) gendrE cnfl_A cnfl_P gnE:_A
## genderE             0.205                            
## conflict_A         -0.263  0.021                     
## conflict_P         -0.406  0.085  0.205              
## genderE:conflict_A -0.013 -0.235  0.040  0.032       
## genderE:conflict_P  0.023 -0.232 -0.014 -0.084 -0.700
## 
## Standardized Within-Group Residuals:
##         Min          Q1         Med          Q3         Max 
## -8.21124048 -0.32191033  0.08574289  0.42395256  4.04125601 
## 
## Number of Observations: 2833
## Number of Groups: 103

Stability-Influence Model

Create lagged variables.

kashy_ppp <- kashy_ppp %>%
  group_by(dyadid, person) %>%
  mutate(conflict_A_lag = lag(conflict_A),
         conflict_P_lag = lag(conflict_P))

Use the lagged actor and partner variables. Note: the random effects of the lagged vairables could not be estimated with default iteration criteria.

stability_influence  <- lme(satisf_A ~ genderE + conflict_A_lag + conflict_P_lag
                    + genderE*conflict_A_lag + genderE*conflict_P_lag, 
                    data = kashy_ppp, 
                    random = ~ man + woman  + slope_m + slope_w - 1|dyadid,
                    correlation = corCompSymm(form = ~1|dyadid/obsid),  
                    weights = varIdent(form = ~1|genderS),
                    na.action = na.omit)

summary(stability_influence)
## Linear mixed-effects model fit by REML
##  Data: kashy_ppp 
##        AIC      BIC    logLik
##   5227.887 5339.442 -2594.944
## 
## Random effects:
##  Formula: ~man + woman + slope_m + slope_w - 1 | dyadid
##  Structure: General positive-definite, Log-Cholesky parametrization
##          StdDev     Corr                
## man      0.68670843 man    woman  slop_m
## woman    0.54831053  0.799              
## slope_m  0.06050170 -0.096  0.077       
## slope_w  0.05550318 -0.025  0.112  0.370
## Residual 0.56848033                     
## 
## Correlation Structure: Compound symmetry
##  Formula: ~1 | dyadid/obsid 
##  Parameter estimate(s):
##       Rho 
## 0.4424515 
## Variance function:
##  Structure: Different standard deviations per stratum
##  Formula: ~1 | genderS 
##  Parameter estimates:
##       M       F 
## 1.00000 1.10986 
## Fixed effects: satisf_A ~ genderE + conflict_A_lag + conflict_P_lag + genderE *      conflict_A_lag + genderE * conflict_P_lag 
##                            Value  Std.Error   DF  t-value p-value
## (Intercept)             6.389147 0.06557319 2519 97.43535  0.0000
## genderE                -0.062342 0.02754897 2519 -2.26294  0.0237
## conflict_A_lag         -0.010262 0.00993596 2519 -1.03283  0.3018
## conflict_P_lag         -0.019723 0.00999770 2519 -1.97280  0.0486
## genderE:conflict_A_lag -0.004603 0.01249644 2519 -0.36831  0.7127
## genderE:conflict_P_lag  0.009993 0.01254681 2519  0.79648  0.4258
##  Correlation: 
##                        (Intr) gendrE cnf_A_ cnf_P_ gE:_A_
## genderE                 0.184                            
## conflict_A_lag         -0.291  0.029                     
## conflict_P_lag         -0.291  0.076 -0.049              
## genderE:conflict_A_lag -0.008 -0.206  0.015  0.085       
## genderE:conflict_P_lag  0.038 -0.210 -0.007 -0.183 -0.771
## 
## Standardized Within-Group Residuals:
##        Min         Q1        Med         Q3        Max 
## -6.5246302 -0.2164129  0.1083552  0.3976447  3.1681865 
## 
## Number of Observations: 2627
## Number of Groups: 103

Back to schedule