Dyadic Response Surface Analysis (DRSA) is a powerful statistical technique particularly suited for investigating the influence of specific combinations of two variables on an outcome within dyadic settings, such as pairs of individuals. By using and adapting the codes provided by Kim et al. (2021), accessible via the OSF link, we intend to replicate their study to confirm their results and practice running DRSA.
OSF link for data and code access: https://osf.io/mp5q2/
Reference:
Kim, J. J., Muise, A., Barranti, M., Mark, K. P., Rosen, N. O., Harasymchuk, C., & Impett, E. (2021). Are couples more satisfied when they match in sexual desire? New insights from response surface analyses. Social Psychological and Personality Science, 12(4), 487-496.
## Warning: package 'ggplot2' was built under R version 4.3.2
## NULL
## Rows: 366
## Columns: 16
## $ sdi_dyadic_M <dbl> 3.7, 3.9, 4.4, 4.3, 5.0, 4.6, 4.4, 4.4, 4.5, 4.6, 5.0,…
## $ sdi_dyadic_F <dbl> 3.7, 3.2, 4.6, 3.3, 3.5, 1.7, 4.3, 3.4, 1.7, 1.3, 0.5,…
## $ DiscrepancyM_F <dbl> 0.0, 0.7, -0.2, 1.0, 1.5, 2.9, 0.1, 1.0, 2.8, 3.3, 4.5…
## $ abs_Discrepancy <dbl> 0.0, 0.7, 0.2, 1.0, 1.5, 2.9, 0.1, 1.0, 2.8, 3.3, 4.5,…
## $ Zrelsat_F <dbl> 0.76422926, 0.08528598, 0.76422926, 0.76422926, 0.7642…
## $ Zrelsat_M <dbl> 0.76422926, -4.66731699, 0.76422926, 0.76422926, 0.085…
## $ Zsexsat_F <dbl> -0.3015187, -0.3015187, 1.0988680, 0.4623286, 0.207712…
## $ Zsexsat_M <dbl> 0.46232861, -3.35690771, 0.33502073, 0.20771285, 0.335…
## $ dataset_ecode1 <dbl> -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1…
## $ dataset_ecode2 <dbl> -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1…
## $ XY <dbl> 1.00, 0.60, 3.23, 0.96, 1.84, -1.90, 2.72, 1.19, -1.80…
## $ Y.c2 <dbl> 1.00, 0.25, 3.61, 0.36, 0.64, 1.00, 2.56, 0.49, 1.00, …
## $ X.c2 <dbl> 1.00, 1.44, 2.89, 2.56, 5.29, 3.61, 2.89, 2.89, 3.24, …
## $ Y.c <dbl> 1.0, 0.5, 1.9, 0.6, 0.8, -1.0, 1.6, 0.7, -1.0, -1.4, -…
## $ X.c <dbl> 1.0, 1.2, 1.7, 1.6, 2.3, 1.9, 1.7, 1.7, 1.8, 1.9, 2.3,…
## $ midpoint <dbl> 2.7, 2.7, 2.7, 2.7, 2.7, 2.7, 2.7, 2.7, 2.7, 2.7, 2.7,…
grandmean <- mean(c(mergeddata_osf$sdi_dyadic_M, mergeddata_osf$sdi_dyadic_F), na.rm=TRUE)
grandmean## [1] 3.862295
mergeddata_osf$X.c <- mergeddata_osf$sdi_dyadic_M-grandmean
mergeddata_osf$Y.c <- mergeddata_osf$sdi_dyadic_F-grandmean
mergeddata_osf$X.c2 <- mergeddata_osf$X.c*mergeddata_osf$X.c
mergeddata_osf$Y.c2 <- mergeddata_osf$Y.c*mergeddata_osf$Y.c
mergeddata_osf$XY <- mergeddata_osf$X.c*mergeddata_osf$Y.c## Warning: package 'lavaan' was built under R version 4.3.2
## This is lavaan 0.6-17
## lavaan is FREE software! Please report any bugs.
#Full DRSA Model
Relsat_dRSA.full.model <- '
Zrelsat_F ~ b1f*X.c + b2f*Y.c + b3f*X.c2 + b4f*XY + b5f*Y.c2 +
dataset_ecode1 + dataset_ecode2
Zrelsat_M ~ b1m*X.c + b2m*Y.c + b3m*X.c2 + b4m*XY + b5m*Y.c2 +
dataset_ecode1 + dataset_ecode2
Zrelsat_M ~~ Zrelsat_F
'
fit.Relsat_full_model.boot <- sem(Relsat_dRSA.full.model,
data=mergeddata_osf, meanstructure=TRUE,
estimator="ML", missing="fiml",
se="boot", bootstrap =100)
summary(fit.Relsat_full_model.boot, fit.measures = TRUE, ci = TRUE)## lavaan 0.6.17 ended normally after 25 iterations
##
## Estimator ML
## Optimization method NLMINB
## Number of model parameters 19
##
## Number of observations 366
## Number of missing patterns 2
##
## Model Test User Model:
##
## Test statistic 0.000
## Degrees of freedom 0
##
## Model Test Baseline Model:
##
## Test statistic 153.321
## Degrees of freedom 15
## P-value 0.000
##
## User Model versus Baseline Model:
##
## Comparative Fit Index (CFI) 1.000
## Tucker-Lewis Index (TLI) 1.000
##
## Robust Comparative Fit Index (CFI) 1.000
## Robust Tucker-Lewis Index (TLI) 1.000
##
## Loglikelihood and Information Criteria:
##
## Loglikelihood user model (H0) -927.193
## Loglikelihood unrestricted model (H1) -927.193
##
## Akaike (AIC) 1892.385
## Bayesian (BIC) 1966.535
## Sample-size adjusted Bayesian (SABIC) 1906.256
##
## Root Mean Square Error of Approximation:
##
## RMSEA 0.000
## 90 Percent confidence interval - lower 0.000
## 90 Percent confidence interval - upper 0.000
## P-value H_0: RMSEA <= 0.050 NA
## P-value H_0: RMSEA >= 0.080 NA
##
## Robust RMSEA 0.000
## 90 Percent confidence interval - lower 0.000
## 90 Percent confidence interval - upper 0.000
## P-value H_0: Robust RMSEA <= 0.050 NA
## P-value H_0: Robust RMSEA >= 0.080 NA
##
## Standardized Root Mean Square Residual:
##
## SRMR 0.000
##
## Parameter Estimates:
##
## Standard errors Bootstrap
## Number of requested bootstrap draws 100
## Number of successful bootstrap draws 100
##
## Regressions:
## Estimate Std.Err z-value P(>|z|) ci.lower ci.upper
## Zrelsat_F ~
## X.c (b1f) 0.149 0.068 2.204 0.027 0.026 0.292
## Y.c (b2f) 0.224 0.092 2.427 0.015 0.058 0.397
## X.c2 (b3f) 0.060 0.046 1.291 0.197 -0.041 0.145
## XY (b4f) -0.070 0.063 -1.123 0.262 -0.164 0.070
## Y.c2 (b5f) -0.030 0.048 -0.626 0.532 -0.137 0.057
## dtst_cd1 0.175 0.071 2.452 0.014 0.035 0.338
## dtst_cd2 -0.198 0.082 -2.412 0.016 -0.379 -0.013
## Zrelsat_M ~
## X.c (b1m) 0.224 0.074 3.023 0.002 0.084 0.410
## Y.c (b2m) 0.138 0.091 1.506 0.132 -0.087 0.334
## X.c2 (b3m) -0.006 0.061 -0.104 0.917 -0.115 0.137
## XY (b4m) -0.002 0.076 -0.020 0.984 -0.176 0.124
## Y.c2 (b5m) -0.030 0.048 -0.620 0.535 -0.134 0.064
## dtst_cd1 0.067 0.084 0.798 0.425 -0.117 0.237
## dtst_cd2 -0.063 0.079 -0.805 0.421 -0.254 0.080
##
## Covariances:
## Estimate Std.Err z-value P(>|z|) ci.lower ci.upper
## .Zrelsat_F ~~
## .Zrelsat_M 0.386 0.070 5.485 0.000 0.263 0.556
##
## Intercepts:
## Estimate Std.Err z-value P(>|z|) ci.lower ci.upper
## .Zrelsat_F 0.051 0.057 0.899 0.369 -0.067 0.175
## .Zrelsat_M 0.045 0.077 0.584 0.559 -0.166 0.172
##
## Variances:
## Estimate Std.Err z-value P(>|z|) ci.lower ci.upper
## .Zrelsat_F 0.800 0.079 10.166 0.000 0.660 0.979
## .Zrelsat_M 0.876 0.106 8.288 0.000 0.667 1.106
#Gender-constrained DRSA Model
Final_relsat_model <- '
Zrelsat_F ~ b2m*X.c + b1m*Y.c + b5m*X.c2 + b4m*XY + b3m*Y.c2 +
dataset_ecode1 + dataset_ecode2
Zrelsat_M ~ b1m*X.c + b2m*Y.c + b3m*X.c2 + b4m*XY + b5m*Y.c2 +
dataset_ecode1 + dataset_ecode2
Zrelsat_M ~~ Zrelsat_F
'
boot.Final_relsat_model <- sem(Final_relsat_model,
data=mergeddata_osf, meanstructure=TRUE,
estimator="ML", missing="fiml",
se="boot", bootstrap =100)
anova(boot.Final_relsat_model,fit.Relsat_full_model.boot)##
## Chi-Squared Difference Test
##
## Df AIC BIC Chisq Chisq diff RMSEA Df diff
## fit.Relsat_full_model.boot 0 1892.4 1966.5 0.0000
## boot.Final_relsat_model 5 1885.8 1940.4 3.3652 3.3652 0 5
## Pr(>Chisq)
## fit.Relsat_full_model.boot
## boot.Final_relsat_model 0.6439
## lavaan 0.6.17 ended normally after 20 iterations
##
## Estimator ML
## Optimization method NLMINB
## Number of model parameters 19
## Number of equality constraints 5
##
## Number of observations 366
## Number of missing patterns 2
##
## Model Test User Model:
##
## Test statistic 3.365
## Degrees of freedom 5
## P-value (Chi-square) 0.644
##
## Model Test Baseline Model:
##
## Test statistic 153.321
## Degrees of freedom 15
## P-value 0.000
##
## User Model versus Baseline Model:
##
## Comparative Fit Index (CFI) 1.000
## Tucker-Lewis Index (TLI) 1.035
##
## Robust Comparative Fit Index (CFI) 1.000
## Robust Tucker-Lewis Index (TLI) 1.034
##
## Loglikelihood and Information Criteria:
##
## Loglikelihood user model (H0) -928.875
## Loglikelihood unrestricted model (H1) -927.193
##
## Akaike (AIC) 1885.751
## Bayesian (BIC) 1940.387
## Sample-size adjusted Bayesian (SABIC) 1895.971
##
## Root Mean Square Error of Approximation:
##
## RMSEA 0.000
## 90 Percent confidence interval - lower 0.000
## 90 Percent confidence interval - upper 0.059
## P-value H_0: RMSEA <= 0.050 0.912
## P-value H_0: RMSEA >= 0.080 0.008
##
## Robust RMSEA 0.000
## 90 Percent confidence interval - lower 0.000
## 90 Percent confidence interval - upper 0.059
## P-value H_0: Robust RMSEA <= 0.050 0.911
## P-value H_0: Robust RMSEA >= 0.080 0.008
##
## Standardized Root Mean Square Residual:
##
## SRMR 0.010
##
## Parameter Estimates:
##
## Standard errors Bootstrap
## Number of requested bootstrap draws 100
## Number of successful bootstrap draws 100
##
## Regressions:
## Estimate Std.Err z-value P(>|z|) ci.lower ci.upper
## Zrelsat_F ~
## X.c (b2m) 0.160 0.050 3.230 0.001 0.070 0.244
## Y.c (b1m) 0.213 0.044 4.838 0.000 0.127 0.313
## X.c2 (b5m) -0.004 0.029 -0.152 0.879 -0.060 0.056
## XY (b4m) -0.020 0.052 -0.383 0.702 -0.132 0.084
## Y.c2 (b3m) -0.024 0.032 -0.744 0.457 -0.079 0.044
## dtst_cd1 0.160 0.079 2.023 0.043 -0.005 0.314
## dtst_cd2 -0.191 0.076 -2.508 0.012 -0.355 -0.058
## Zrelsat_M ~
## X.c (b1m) 0.213 0.044 4.838 0.000 0.127 0.313
## Y.c (b2m) 0.160 0.050 3.230 0.001 0.070 0.244
## X.c2 (b3m) -0.024 0.032 -0.744 0.457 -0.079 0.044
## XY (b4m) -0.020 0.052 -0.383 0.702 -0.132 0.084
## Y.c2 (b5m) -0.004 0.029 -0.152 0.879 -0.060 0.056
## dtst_cd1 0.064 0.078 0.824 0.410 -0.101 0.226
## dtst_cd2 -0.058 0.082 -0.707 0.480 -0.212 0.133
##
## Covariances:
## Estimate Std.Err z-value P(>|z|) ci.lower ci.upper
## .Zrelsat_F ~~
## .Zrelsat_M 0.386 0.070 5.550 0.000 0.230 0.539
##
## Intercepts:
## Estimate Std.Err z-value P(>|z|) ci.lower ci.upper
## .Zrelsat_F 0.075 0.068 1.109 0.267 -0.069 0.212
## .Zrelsat_M 0.039 0.073 0.529 0.597 -0.115 0.203
##
## Variances:
## Estimate Std.Err z-value P(>|z|) ci.lower ci.upper
## .Zrelsat_F 0.804 0.086 9.337 0.000 0.616 0.978
## .Zrelsat_M 0.878 0.102 8.612 0.000 0.642 1.071
Now let’s estimate response surface parameters.
Final_relsat_model <- '
Zrelsat_F ~ b2m*X.c + b1m*Y.c + b5m*X.c2 + b4m*XY + b3m*Y.c2 +
dataset_ecode1 + dataset_ecode2
Zrelsat_M ~ b1m*X.c + b2m*Y.c + b3m*X.c2 + b4m*XY + b5m*Y.c2 +
dataset_ecode1 + dataset_ecode2
Zrelsat_M ~~ Zrelsat_F
a1 := b1m + b2m
a2 := b3m + b4m + b5m
a3 := b1m - b2m
a4 := b3m - b4m + b5m
a5 := b3m - b5m
'
boot.Final_relsat_model <- sem(Final_relsat_model,
data=mergeddata_osf, meanstructure=TRUE,
estimator="ML", missing="fiml",
se="boot", bootstrap =100)
summary(boot.Final_relsat_model, fit.measures = TRUE, ci = TRUE)## lavaan 0.6.17 ended normally after 20 iterations
##
## Estimator ML
## Optimization method NLMINB
## Number of model parameters 19
## Number of equality constraints 5
##
## Number of observations 366
## Number of missing patterns 2
##
## Model Test User Model:
##
## Test statistic 3.365
## Degrees of freedom 5
## P-value (Chi-square) 0.644
##
## Model Test Baseline Model:
##
## Test statistic 153.321
## Degrees of freedom 15
## P-value 0.000
##
## User Model versus Baseline Model:
##
## Comparative Fit Index (CFI) 1.000
## Tucker-Lewis Index (TLI) 1.035
##
## Robust Comparative Fit Index (CFI) 1.000
## Robust Tucker-Lewis Index (TLI) 1.034
##
## Loglikelihood and Information Criteria:
##
## Loglikelihood user model (H0) -928.875
## Loglikelihood unrestricted model (H1) -927.193
##
## Akaike (AIC) 1885.751
## Bayesian (BIC) 1940.387
## Sample-size adjusted Bayesian (SABIC) 1895.971
##
## Root Mean Square Error of Approximation:
##
## RMSEA 0.000
## 90 Percent confidence interval - lower 0.000
## 90 Percent confidence interval - upper 0.059
## P-value H_0: RMSEA <= 0.050 0.912
## P-value H_0: RMSEA >= 0.080 0.008
##
## Robust RMSEA 0.000
## 90 Percent confidence interval - lower 0.000
## 90 Percent confidence interval - upper 0.059
## P-value H_0: Robust RMSEA <= 0.050 0.911
## P-value H_0: Robust RMSEA >= 0.080 0.008
##
## Standardized Root Mean Square Residual:
##
## SRMR 0.010
##
## Parameter Estimates:
##
## Standard errors Bootstrap
## Number of requested bootstrap draws 100
## Number of successful bootstrap draws 100
##
## Regressions:
## Estimate Std.Err z-value P(>|z|) ci.lower ci.upper
## Zrelsat_F ~
## X.c (b2m) 0.160 0.054 2.977 0.003 0.027 0.273
## Y.c (b1m) 0.213 0.051 4.185 0.000 0.104 0.312
## X.c2 (b5m) -0.004 0.032 -0.135 0.893 -0.080 0.068
## XY (b4m) -0.020 0.048 -0.418 0.676 -0.124 0.060
## Y.c2 (b3m) -0.024 0.034 -0.695 0.487 -0.107 0.046
## dtst_cd1 0.160 0.072 2.213 0.027 -0.027 0.315
## dtst_cd2 -0.191 0.075 -2.539 0.011 -0.341 -0.044
## Zrelsat_M ~
## X.c (b1m) 0.213 0.051 4.185 0.000 0.104 0.312
## Y.c (b2m) 0.160 0.054 2.977 0.003 0.027 0.273
## X.c2 (b3m) -0.024 0.034 -0.695 0.487 -0.107 0.046
## XY (b4m) -0.020 0.048 -0.418 0.676 -0.124 0.060
## Y.c2 (b5m) -0.004 0.032 -0.135 0.893 -0.080 0.068
## dtst_cd1 0.064 0.082 0.790 0.430 -0.075 0.236
## dtst_cd2 -0.058 0.085 -0.679 0.497 -0.252 0.104
##
## Covariances:
## Estimate Std.Err z-value P(>|z|) ci.lower ci.upper
## .Zrelsat_F ~~
## .Zrelsat_M 0.386 0.066 5.816 0.000 0.247 0.538
##
## Intercepts:
## Estimate Std.Err z-value P(>|z|) ci.lower ci.upper
## .Zrelsat_F 0.075 0.070 1.072 0.284 -0.084 0.212
## .Zrelsat_M 0.039 0.066 0.589 0.556 -0.088 0.186
##
## Variances:
## Estimate Std.Err z-value P(>|z|) ci.lower ci.upper
## .Zrelsat_F 0.804 0.083 9.708 0.000 0.615 0.936
## .Zrelsat_M 0.878 0.110 8.015 0.000 0.643 1.094
##
## Defined Parameters:
## Estimate Std.Err z-value P(>|z|) ci.lower ci.upper
## a1 0.374 0.095 3.950 0.000 0.141 0.561
## a2 -0.048 0.050 -0.951 0.341 -0.174 0.034
## a3 0.053 0.047 1.133 0.257 -0.043 0.151
## a4 -0.008 0.091 -0.089 0.929 -0.179 0.198
## a5 -0.019 0.036 -0.530 0.596 -0.115 0.060
## b2m b1m b5m b4m b3m Z_F~_1 Z_F~_2
## b2m 0.003
## b1m 0.002 0.003
## b5m 0.001 0.000 0.001
## b4m -0.001 -0.001 -0.001 0.002
## b3m 0.001 0.001 0.000 -0.001 0.001
## Zrelsat_F~dataset_ecode1 0.001 0.001 0.000 0.000 0.000 0.005
## Zrelsat_F~dataset_ecode2 -0.002 -0.002 0.000 0.000 0.000 -0.004 0.006
## b1m 0.002 0.003 0.000 -0.001 0.001 0.001 -0.002
## b2m 0.003 0.002 0.001 -0.001 0.001 0.001 -0.002
## b3m 0.001 0.001 0.000 -0.001 0.001 0.000 0.000
## b4m -0.001 -0.001 -0.001 0.002 -0.001 0.000 0.000
## b5m 0.001 0.000 0.001 -0.001 0.000 0.000 0.000
## Zrelsat_M~dataset_ecode1 0.002 0.001 0.000 0.000 0.000 0.002 -0.002
## Zrelsat_M~dataset_ecode2 -0.002 -0.001 0.000 -0.001 0.000 -0.002 0.003
## Zrelsat_F~~Zrelsat_M 0.000 0.000 0.000 0.000 0.000 0.001 0.000
## Zrelsat_F~~Zrelsat_F 0.000 0.000 0.000 0.000 0.000 -0.001 0.001
## Zrelsat_M~~Zrelsat_M 0.002 0.002 0.000 -0.001 0.000 0.002 -0.001
## Zrelsat_F~1 -0.002 -0.002 -0.001 0.001 -0.001 0.000 0.002
## Zrelsat_M~1 -0.002 -0.002 -0.001 0.001 -0.001 -0.001 0.001
## b1m b2m b3m b4m b5m Z_M~_1 Z_M~_2
## b2m
## b1m
## b5m
## b4m
## b3m
## Zrelsat_F~dataset_ecode1
## Zrelsat_F~dataset_ecode2
## b1m 0.003
## b2m 0.002 0.003
## b3m 0.001 0.001 0.001
## b4m -0.001 -0.001 -0.001 0.002
## b5m 0.000 0.001 0.000 -0.001 0.001
## Zrelsat_M~dataset_ecode1 0.001 0.002 0.000 0.000 0.000 0.007
## Zrelsat_M~dataset_ecode2 -0.001 -0.002 0.000 -0.001 0.000 -0.005 0.007
## Zrelsat_F~~Zrelsat_M 0.000 0.000 0.000 0.000 0.000 0.001 0.000
## Zrelsat_F~~Zrelsat_F 0.000 0.000 0.000 0.000 0.000 0.001 0.000
## Zrelsat_M~~Zrelsat_M 0.002 0.002 0.000 -0.001 0.000 0.003 0.000
## Zrelsat_F~1 -0.002 -0.002 -0.001 0.001 -0.001 -0.001 0.001
## Zrelsat_M~1 -0.002 -0.002 -0.001 0.001 -0.001 0.000 0.001
## Z_F~~Z_M Z_F~~Z_F Z_M~~Z Zr_F~1 Zr_M~1
## b2m
## b1m
## b5m
## b4m
## b3m
## Zrelsat_F~dataset_ecode1
## Zrelsat_F~dataset_ecode2
## b1m
## b2m
## b3m
## b4m
## b5m
## Zrelsat_M~dataset_ecode1
## Zrelsat_M~dataset_ecode2
## Zrelsat_F~~Zrelsat_M 0.004
## Zrelsat_F~~Zrelsat_F 0.004 0.007
## Zrelsat_M~~Zrelsat_M 0.005 0.004 0.012
## Zrelsat_F~1 -0.001 -0.002 -0.003 0.005
## Zrelsat_M~1 -0.001 -0.001 -0.003 0.003 0.004
Plot
## Loading required package: lattice
Final_relsatRSA <- RSA.ST(x= 0.161, y= 0.213, x2= -0.004, xy = -0.020, y2 = -0.024, b0 = 0.074,
SE = c(x= 0.053, y= 0.052,x2= 0.032,xy= 0.055,y2= 0.033),
COV= c(x_y= 0.001 , x2_xy = -0.001, x2_y2 = 0.000, y2_xy = -0.001),df = 366)
Final_relsatRSA.rawdata <- data.frame(with(mergeddata_osf, (cbind(X.c,Y.c,Zrelsat_F))))#woman is actor and man is partner here
Final_relsatRSA.rawdata<- Final_relsatRSA.rawdata[complete.cases(Final_relsatRSA.rawdata), ] # Create dataframe for RSA plot
#Plot
Final_relsatRSA.plot <- plotRSA(x = 0.161, y = 0.213, x2 = -0.004, xy = -0.020, y2 = -0.024, b0 = 0.074, xlab = "Partner Desire",ylab = "Actor Desire",zlab = "Actor Rel Sat",type = "3d", surface = "predict", xlim = c(-4,4),ylim = c(-4,4),zlim = c(-4,2),
points=list(data = Final_relsatRSA.rawdata, show = T,value = "raw", legend=FALSE))
Final_relsatRSA.plot#Full DRSA Model
Sexsat_dRSA.full.model <- '
Zsexsat_F ~ b1f*X.c + b2f*Y.c + b3f*X.c2 + b4f*XY + b5f*Y.c2 +
dataset_ecode1 + dataset_ecode2
Zsexsat_M ~ b1m*X.c + b2m*Y.c + b3m*X.c2 + b4m*XY + b5m*Y.c2 +
dataset_ecode1 + dataset_ecode2
Zsexsat_M ~~ Zsexsat_F
'
fit.Sexsat_full_model.boot <- sem(Sexsat_dRSA.full.model ,
data=mergeddata_osf, meanstructure=TRUE ,
estimator="ML", missing="fiml",
se="boot", bootstrap =100)
summary(fit.Sexsat_full_model.boot)## lavaan 0.6.17 ended normally after 24 iterations
##
## Estimator ML
## Optimization method NLMINB
## Number of model parameters 19
##
## Number of observations 366
## Number of missing patterns 4
##
## Model Test User Model:
##
## Test statistic 0.000
## Degrees of freedom 0
##
## Parameter Estimates:
##
## Standard errors Bootstrap
## Number of requested bootstrap draws 100
## Number of successful bootstrap draws 100
##
## Regressions:
## Estimate Std.Err z-value P(>|z|)
## Zsexsat_F ~
## X.c (b1f) 0.189 0.061 3.078 0.002
## Y.c (b2f) 0.450 0.069 6.563 0.000
## X.c2 (b3f) 0.027 0.057 0.474 0.636
## XY (b4f) 0.009 0.066 0.131 0.896
## Y.c2 (b5f) -0.067 0.041 -1.653 0.098
## dtst_cd1 0.324 0.066 4.912 0.000
## dtst_cd2 -0.306 0.068 -4.514 0.000
## Zsexsat_M ~
## X.c (b1m) 0.418 0.082 5.073 0.000
## Y.c (b2m) 0.282 0.078 3.606 0.000
## X.c2 (b3m) -0.064 0.057 -1.125 0.261
## XY (b4m) 0.082 0.075 1.087 0.277
## Y.c2 (b5m) -0.037 0.042 -0.885 0.376
## dtst_cd1 0.215 0.072 3.002 0.003
## dtst_cd2 -0.240 0.067 -3.587 0.000
##
## Covariances:
## Estimate Std.Err z-value P(>|z|)
## .Zsexsat_F ~~
## .Zsexsat_M 0.272 0.048 5.726 0.000
##
## Intercepts:
## Estimate Std.Err z-value P(>|z|)
## .Zsexsat_F 0.199 0.058 3.431 0.001
## .Zsexsat_M 0.034 0.064 0.529 0.597
##
## Variances:
## Estimate Std.Err z-value P(>|z|)
## .Zsexsat_F 0.567 0.052 10.954 0.000
## .Zsexsat_M 0.743 0.075 9.846 0.000
#Gender-constrained DRSA Model
Final_sexsat_model <- '
Zsexsat_F ~ b2m*X.c + b1m*Y.c + b5m*X.c2 + b4m*XY + b3m*Y.c2 +
dataset_ecode1 + dataset_ecode2
Zsexsat_M ~ b1m*X.c + b2m*Y.c + b3m*X.c2 + b4m*XY + b5m*Y.c2 +
dataset_ecode1 + dataset_ecode2
Zsexsat_M ~~ Zsexsat_F
a1 := b1m + b2m
a2 := b3m + b4m + b5m
a3 := b1m - b2m
a4 := b3m - b4m + b5m
a5 := b3m - b5m
'
boot.Final_sexsat_model <- sem(Final_sexsat_model,
data=mergeddata_osf, meanstructure=TRUE,
estimator="ML", missing="fiml",
se="boot", bootstrap =100)
anova(fit.Sexsat_full_model.boot,boot.Final_sexsat_model)##
## Chi-Squared Difference Test
##
## Df AIC BIC Chisq Chisq diff RMSEA Df diff
## fit.Sexsat_full_model.boot 0 1703.4 1777.6 0.0000
## boot.Final_sexsat_model 5 1699.2 1753.9 5.7962 5.7962 0.020858 5
## Pr(>Chisq)
## fit.Sexsat_full_model.boot
## boot.Final_sexsat_model 0.3266
## lavaan 0.6.17 ended normally after 19 iterations
##
## Estimator ML
## Optimization method NLMINB
## Number of model parameters 19
## Number of equality constraints 5
##
## Number of observations 366
## Number of missing patterns 4
##
## Model Test User Model:
##
## Test statistic 5.796
## Degrees of freedom 5
## P-value (Chi-square) 0.327
##
## Parameter Estimates:
##
## Standard errors Bootstrap
## Number of requested bootstrap draws 100
## Number of successful bootstrap draws 100
##
## Regressions:
## Estimate Std.Err z-value P(>|z|)
## Zsexsat_F ~
## X.c (b2m) 0.243 0.045 5.458 0.000
## Y.c (b1m) 0.421 0.050 8.450 0.000
## X.c2 (b5m) -0.028 0.030 -0.937 0.349
## XY (b4m) 0.067 0.048 1.400 0.162
## Y.c2 (b3m) -0.071 0.032 -2.215 0.027
## dtst_cd1 0.312 0.061 5.114 0.000
## dtst_cd2 -0.301 0.061 -4.957 0.000
## Zsexsat_M ~
## X.c (b1m) 0.421 0.050 8.450 0.000
## Y.c (b2m) 0.243 0.045 5.458 0.000
## X.c2 (b3m) -0.071 0.032 -2.215 0.027
## XY (b4m) 0.067 0.048 1.400 0.162
## Y.c2 (b5m) -0.028 0.030 -0.937 0.349
## dtst_cd1 0.193 0.065 2.955 0.003
## dtst_cd2 -0.214 0.072 -2.991 0.003
##
## Covariances:
## Estimate Std.Err z-value P(>|z|)
## .Zsexsat_F ~~
## .Zsexsat_M 0.274 0.042 6.489 0.000
##
## Intercepts:
## Estimate Std.Err z-value P(>|z|)
## .Zsexsat_F 0.212 0.047 4.513 0.000
## .Zsexsat_M 0.022 0.065 0.344 0.731
##
## Variances:
## Estimate Std.Err z-value P(>|z|)
## .Zsexsat_F 0.573 0.045 12.805 0.000
## .Zsexsat_M 0.746 0.068 10.963 0.000
##
## Defined Parameters:
## Estimate Std.Err z-value P(>|z|)
## a1 0.664 0.073 9.111 0.000
## a2 -0.032 0.044 -0.714 0.475
## a3 0.177 0.061 2.913 0.004
## a4 -0.166 0.085 -1.941 0.052
## a5 -0.043 0.039 -1.112 0.266
## b2m b1m b5m b4m b3m Z_F~_1 Z_F~_2
## b2m 0.002
## b1m 0.000 0.002
## b5m 0.001 0.000 0.001
## b4m -0.001 -0.001 -0.001 0.002
## b3m 0.000 0.001 0.000 -0.001 0.001
## Zsexsat_F~dataset_ecode1 0.001 0.001 0.000 0.000 0.000 0.004
## Zsexsat_F~dataset_ecode2 0.000 -0.001 0.000 -0.001 0.000 -0.002 0.004
## b1m 0.000 0.002 0.000 -0.001 0.001 0.001 -0.001
## b2m 0.002 0.000 0.001 -0.001 0.000 0.001 0.000
## b3m 0.000 0.001 0.000 -0.001 0.001 0.000 0.000
## b4m -0.001 -0.001 -0.001 0.002 -0.001 0.000 -0.001
## b5m 0.001 0.000 0.001 -0.001 0.000 0.000 0.000
## Zsexsat_M~dataset_ecode1 0.001 0.000 0.000 -0.001 0.000 0.002 0.000
## Zsexsat_M~dataset_ecode2 0.000 -0.001 0.000 0.000 0.000 -0.001 0.002
## Zsexsat_F~~Zsexsat_M 0.000 0.000 0.000 0.000 0.000 0.000 0.000
## Zsexsat_F~~Zsexsat_F 0.000 0.000 0.000 0.000 0.000 0.000 0.000
## Zsexsat_M~~Zsexsat_M 0.000 0.001 0.000 0.000 0.000 0.000 0.001
## Zsexsat_F~1 -0.001 -0.001 -0.001 0.001 -0.001 0.000 0.001
## Zsexsat_M~1 0.000 -0.002 -0.001 0.001 -0.001 -0.001 0.001
## b1m b2m b3m b4m b5m Z_M~_1 Z_M~_2
## b2m
## b1m
## b5m
## b4m
## b3m
## Zsexsat_F~dataset_ecode1
## Zsexsat_F~dataset_ecode2
## b1m 0.002
## b2m 0.000 0.002
## b3m 0.001 0.000 0.001
## b4m -0.001 -0.001 -0.001 0.002
## b5m 0.000 0.001 0.000 -0.001 0.001
## Zsexsat_M~dataset_ecode1 0.000 0.001 0.000 -0.001 0.000 0.004
## Zsexsat_M~dataset_ecode2 -0.001 0.000 0.000 0.000 0.000 -0.003 0.005
## Zsexsat_F~~Zsexsat_M 0.000 0.000 0.000 0.000 0.000 0.001 0.000
## Zsexsat_F~~Zsexsat_F 0.000 0.000 0.000 0.000 0.000 0.001 0.000
## Zsexsat_M~~Zsexsat_M 0.001 0.000 0.000 0.000 0.000 0.001 -0.001
## Zsexsat_F~1 -0.001 -0.001 -0.001 0.001 -0.001 0.000 0.000
## Zsexsat_M~1 -0.002 0.000 -0.001 0.001 -0.001 0.000 0.001
## Z_F~~Z_M Z_F~~Z_F Z_M~~Z Zs_F~1 Zs_M~1
## b2m
## b1m
## b5m
## b4m
## b3m
## Zsexsat_F~dataset_ecode1
## Zsexsat_F~dataset_ecode2
## b1m
## b2m
## b3m
## b4m
## b5m
## Zsexsat_M~dataset_ecode1
## Zsexsat_M~dataset_ecode2
## Zsexsat_F~~Zsexsat_M 0.002
## Zsexsat_F~~Zsexsat_F 0.001 0.002
## Zsexsat_M~~Zsexsat_M 0.002 0.000 0.005
## Zsexsat_F~1 0.000 0.000 0.000 0.002
## Zsexsat_M~1 -0.001 0.000 -0.002 0.001 0.004
Plot
Final_sexsatRSA <- RSA.ST(x = 0.243, y = 0.421, x2 = -0.028, xy = 0.067, y2 = -0.071, b0 = 0.210,
SE = c(x= 0.046, y= 0.047,x2= 0.029,xy= 0.045,y2= 0.030),
COV= c(x_y= 0.000 , x2_xy = 0.001, x2_y2 = 0.000, y2_xy = 0.000),df = 366)
Final_sexsatRSA.rawdata <- data.frame(with(mergeddata_osf, (cbind(X.c,Y.c,Zsexsat_F))))#assuming woman is actor and man is partner here
Final_sexsatRSA.rawdata<- Final_sexsatRSA.rawdata[complete.cases(Final_sexsatRSA.rawdata), ] # Create dataframe for RSA plot
#Plot
Final_sexsatRSA.plot <- plotRSA(x = 0.243, y = 0.421, x2 = -0.028, xy = 0.067, y2 = -0.071, b0 = 0.210, xlab = "Partner Desire",ylab = "Actor Desire",zlab = "Actor Sex Sat",type = "3d", surface = "predict", xlim = c(-4,4),ylim = c(-4,4),zlim = c(-4,2), points=list(data = Final_sexsatRSA.rawdata, show = T,value = "raw", legend=FALSE))
Final_sexsatRSA.plot