## 
##  DESCRIPTIVES
## 
##  Descriptives                                                                                       
##  ────────────────────────────────────────────────────────────────────────────────────────────────── 
##                          rel.sat      sex.sat     self.comp    love         age         rel.years   
##  ────────────────────────────────────────────────────────────────────────────────────────────────── 
##    N                           273         273          274          274         276          276   
##    Missing                       3           3            2            2           0            0   
##    Mean                   4.019231    4.805861     3.033693     6.072802    31.83696     7.097826   
##    Median                 4.250000    5.000000     3.000000     6.190476    32.00000     6.000000   
##    Standard deviation    0.9346015    1.399298    0.7036088    0.6793942    4.569330     4.139547   
##    Minimum               0.2500000    1.000000     1.333333     3.333333          20            1   
##    Maximum                5.250000    7.000000     4.750000     7.000000          46           22   
##  ──────────────────────────────────────────────────────────────────────────────────────────────────
##           vars   n  mean   sd median trimmed  mad   min   max range  skew
## rel.sat      1 273  4.02 0.93   4.25    4.10 1.11  0.25  5.25  5.00 -0.80
## sex.sat      2 273  4.81 1.40   5.00    4.87 1.48  1.00  7.00  6.00 -0.39
## self.comp    3 274  3.03 0.70   3.00    3.03 0.74  1.33  4.75  3.42  0.05
## love         4 274  6.07 0.68   6.19    6.14 0.64  3.33  7.00  3.67 -1.00
## age          5 276 31.84 4.57  32.00   31.67 4.45 20.00 46.00 26.00  0.32
##           kurtosis   se percent_data_present
## rel.sat       0.31 0.06                98.91
## sex.sat      -0.32 0.08                98.91
## self.comp    -0.54 0.04                99.28
## love          1.22 0.04                99.28
## age           0.05 0.28               100.00
##    mydata$role.f   n percent
##  non-gestational 138     0.5
##      gestational 138     0.5
##  mydata$sex.f   n percent
##          male 138     0.5
##        female 138     0.5
##  mydata$gender.f   n    percent
##              man 133 0.48188406
##            woman 136 0.49275362
##     other gender   7 0.02536232
##  mydata$gestational.partner.f   n percent
##               non-gestational 138     0.5
##                   gestational 138     0.5
## 
## Reliability analysis   
## Call: psych::alpha(x = .)
## 
##   raw_alpha std.alpha G6(smc) average_r S/N    ase mean   sd median_r
##       0.91      0.91    0.89      0.72  11 0.0093    4 0.93     0.72
## 
##     95% confidence boundaries 
##          lower alpha upper
## Feldt     0.89  0.91  0.92
## Duhachek  0.89  0.91  0.92
## 
##  Reliability if an item is dropped:
##     raw_alpha std.alpha G6(smc) average_r  S/N alpha se  var.r med.r
## rs1      0.91      0.91    0.87      0.77 10.0   0.0096 0.0010  0.75
## rs2      0.87      0.88    0.85      0.72  7.7   0.0133 0.0056  0.68
## rs3      0.87      0.88    0.83      0.71  7.3   0.0133 0.0016  0.69
## rs4      0.87      0.88    0.83      0.70  7.0   0.0137 0.0017  0.69
## 
##  Item statistics 
##       n raw.r std.r r.cor r.drop mean   sd
## rs1 273  0.87  0.85  0.77   0.74  3.9 1.25
## rs2 273  0.89  0.89  0.85   0.81  4.1 1.02
## rs3 273  0.90  0.90  0.87   0.82  4.0 0.99
## rs4 273  0.90  0.91  0.88   0.83  4.1 0.94
## 
## Non missing response frequency for each item
##     0    1    2    3    4    5    6 miss
## rs1 0 0.03 0.11 0.22 0.26 0.30 0.07 0.01
## rs2 0 0.02 0.05 0.19 0.29 0.45 0.00 0.01
## rs3 0 0.01 0.05 0.23 0.31 0.40 0.00 0.01
## rs4 0 0.00 0.05 0.21 0.33 0.40 0.00 0.01
## 
## Reliability analysis   
## Call: psych::alpha(x = .)
## 
##   raw_alpha std.alpha G6(smc) average_r S/N    ase mean  sd median_r
##       0.91      0.92    0.89      0.73  11 0.0084  4.8 1.4     0.73
## 
##     95% confidence boundaries 
##          lower alpha upper
## Feldt      0.9  0.91  0.93
## Duhachek   0.9  0.91  0.93
## 
##  Reliability if an item is dropped:
##     raw_alpha std.alpha G6(smc) average_r S/N alpha se   var.r med.r
## ss1      0.89      0.89    0.85      0.73 8.2    0.012 0.00124  0.74
## ss2      0.88      0.88    0.83      0.71 7.4    0.012 0.00039  0.72
## ss3      0.89      0.89    0.85      0.74 8.4    0.011 0.00047  0.74
## ss4      0.89      0.89    0.85      0.74 8.4    0.011 0.00004  0.74
## 
##  Item statistics 
##       n raw.r std.r r.cor r.drop mean  sd
## ss1 273  0.90  0.89  0.84   0.80  4.6 1.5
## ss2 271  0.91  0.91  0.87   0.83  4.9 1.5
## ss3 271  0.89  0.89  0.83   0.79  4.9 1.5
## ss4 272  0.89  0.89  0.83   0.79  4.8 1.7
## 
## Non missing response frequency for each item
##        1    2    3    4    5    6    7 miss
## ss1 0.04 0.07 0.10 0.23 0.28 0.18 0.11 0.01
## ss2 0.02 0.04 0.09 0.23 0.23 0.24 0.15 0.02
## ss3 0.03 0.04 0.06 0.26 0.21 0.21 0.18 0.02
## ss4 0.03 0.08 0.12 0.17 0.22 0.20 0.17 0.01
## 
## Reliability analysis   
## Call: psych::alpha(x = .)
## 
##   raw_alpha std.alpha G6(smc) average_r S/N   ase mean  sd median_r
##       0.86      0.86    0.87      0.34 6.1 0.012    3 0.7     0.32
## 
##     95% confidence boundaries 
##          lower alpha upper
## Feldt     0.83  0.86  0.88
## Duhachek  0.84  0.86  0.88
## 
##  Reliability if an item is dropped:
##       raw_alpha std.alpha G6(smc) average_r S/N alpha se var.r med.r
## sc1r       0.84      0.84    0.86      0.33 5.3    0.014 0.013  0.31
## sc2        0.85      0.85    0.87      0.34 5.7    0.013 0.014  0.32
## sc3        0.85      0.85    0.86      0.34 5.7    0.013 0.013  0.33
## sc4r       0.85      0.85    0.86      0.34 5.6    0.014 0.014  0.31
## sc5        0.85      0.85    0.86      0.34 5.6    0.013 0.015  0.31
## sc6        0.85      0.85    0.86      0.33 5.5    0.013 0.015  0.31
## sc7        0.85      0.85    0.86      0.34 5.7    0.013 0.013  0.33
## sc8r       0.85      0.85    0.87      0.35 5.9    0.013 0.012  0.32
## sc9r       0.85      0.85    0.86      0.34 5.6    0.014 0.012  0.32
## sc10       0.86      0.86    0.87      0.35 6.0    0.012 0.012  0.35
## sc11r      0.84      0.84    0.85      0.33 5.3    0.014 0.010  0.31
## sc12r      0.84      0.84    0.86      0.33 5.4    0.014 0.012  0.31
## 
##  Item statistics 
##         n raw.r std.r r.cor r.drop mean   sd
## sc1r  274  0.72  0.70  0.68   0.63  2.7 1.25
## sc2   274  0.57  0.59  0.53   0.48  3.3 1.00
## sc3   274  0.57  0.59  0.55   0.49  3.7 0.93
## sc4r  273  0.66  0.64  0.60   0.56  2.8 1.23
## sc5   271  0.62  0.63  0.59   0.54  3.4 1.05
## sc6   274  0.64  0.65  0.61   0.56  3.0 1.11
## sc7   274  0.59  0.61  0.57   0.50  3.7 0.99
## sc8r  274  0.57  0.55  0.49   0.46  2.5 1.16
## sc9r  274  0.66  0.64  0.61   0.56  2.5 1.23
## sc10  273  0.50  0.50  0.43   0.38  2.9 1.14
## sc11r 274  0.73  0.72  0.71   0.66  2.6 1.20
## sc12r 274  0.69  0.68  0.66   0.61  3.2 1.12
## 
## Non missing response frequency for each item
##          1    2    3    4    5 miss
## sc1r  0.21 0.26 0.25 0.18 0.09 0.01
## sc2   0.02 0.23 0.27 0.38 0.09 0.01
## sc3   0.03 0.07 0.28 0.45 0.18 0.01
## sc4r  0.14 0.32 0.22 0.21 0.11 0.01
## sc5   0.04 0.14 0.32 0.33 0.17 0.02
## sc6   0.08 0.30 0.28 0.25 0.09 0.01
## sc7   0.03 0.08 0.27 0.42 0.20 0.01
## sc8r  0.19 0.36 0.22 0.16 0.07 0.01
## sc9r  0.23 0.34 0.19 0.18 0.07 0.01
## sc10  0.13 0.24 0.26 0.30 0.06 0.01
## sc11r 0.18 0.35 0.24 0.14 0.09 0.01
## sc12r 0.06 0.22 0.32 0.25 0.14 0.01
## 
## Reliability analysis   
## Call: psych::alpha(x = .)
## 
##   raw_alpha std.alpha G6(smc) average_r S/N    ase mean   sd median_r
##       0.93      0.94    0.95      0.41  15 0.0061  6.1 0.68     0.41
## 
##     95% confidence boundaries 
##          lower alpha upper
## Feldt     0.92  0.93  0.94
## Duhachek  0.92  0.93  0.94
## 
##  Reliability if an item is dropped:
##       raw_alpha std.alpha G6(smc) average_r S/N alpha se var.r med.r
## cl1r       0.93      0.93    0.95      0.41  14   0.0063 0.015  0.41
## cl2r       0.93      0.94    0.95      0.43  15   0.0057 0.011  0.42
## cl3r       0.92      0.93    0.95      0.41  14   0.0065 0.014  0.41
## cl4r       0.93      0.93    0.95      0.42  14   0.0062 0.015  0.41
## cl5r       0.92      0.93    0.95      0.40  14   0.0064 0.014  0.41
## cl6r       0.93      0.93    0.95      0.41  14   0.0064 0.015  0.41
## cl7r       0.93      0.93    0.95      0.42  14   0.0063 0.014  0.41
## cl8r       0.93      0.93    0.95      0.41  14   0.0064 0.015  0.41
## cl9r       0.92      0.93    0.95      0.40  14   0.0065 0.014  0.40
## cl10r      0.92      0.93    0.95      0.41  14   0.0065 0.015  0.41
## cl11r      0.93      0.93    0.95      0.41  14   0.0063 0.015  0.41
## cl12r      0.92      0.93    0.95      0.41  14   0.0065 0.015  0.41
## cl13r      0.92      0.93    0.95      0.41  14   0.0065 0.015  0.41
## cl14r      0.93      0.93    0.95      0.42  14   0.0063 0.015  0.42
## cl15r      0.92      0.93    0.95      0.40  13   0.0066 0.015  0.40
## cl16r      0.93      0.93    0.95      0.41  14   0.0064 0.015  0.41
## cl17r      0.93      0.93    0.95      0.41  14   0.0064 0.015  0.41
## cl18r      0.93      0.93    0.95      0.41  14   0.0063 0.015  0.41
## cl19r      0.93      0.93    0.95      0.41  14   0.0063 0.015  0.41
## cl20r      0.92      0.93    0.95      0.41  14   0.0065 0.015  0.41
## cl21r      0.93      0.93    0.95      0.41  14   0.0063 0.015  0.41
## 
##  Item statistics 
##         n raw.r std.r r.cor r.drop mean   sd
## cl1r  274  0.63  0.64  0.62   0.58  6.4 0.88
## cl2r  274  0.39  0.37  0.32   0.31  5.5 1.32
## cl3r  274  0.71  0.72  0.71   0.68  6.2 0.93
## cl4r  273  0.61  0.60  0.58   0.55  5.6 1.31
## cl5r  274  0.73  0.75  0.75   0.70  6.5 0.79
## cl6r  273  0.70  0.71  0.70   0.66  6.5 0.80
## cl7r  274  0.62  0.60  0.59   0.56  6.1 1.24
## cl8r  274  0.67  0.65  0.64   0.62  5.9 1.17
## cl9r  274  0.76  0.76  0.75   0.72  6.3 1.00
## cl10r 273  0.72  0.70  0.69   0.67  5.8 1.17
## cl11r 274  0.65  0.63  0.61   0.60  5.2 1.29
## cl12r 273  0.72  0.71  0.70   0.67  6.2 0.97
## cl13r 271  0.72  0.70  0.68   0.66  5.8 1.20
## cl14r 274  0.60  0.59  0.57   0.55  5.8 1.12
## cl15r 274  0.78  0.78  0.77   0.75  5.9 1.11
## cl16r 274  0.66  0.65  0.64   0.61  5.8 1.11
## cl17r 274  0.65  0.64  0.63   0.60  5.7 1.17
## cl18r 274  0.62  0.64  0.62   0.58  6.6 0.69
## cl19r 274  0.66  0.69  0.68   0.63  6.6 0.70
## cl20r 274  0.71  0.72  0.71   0.68  6.3 0.93
## cl21r 274  0.60  0.64  0.62   0.57  6.8 0.62
## 
## Non missing response frequency for each item
##       1    2    3    4    5    6    7 miss
## cl1r  0 0.00 0.00 0.04 0.12 0.24 0.59 0.01
## cl2r  0 0.03 0.05 0.12 0.27 0.25 0.27 0.01
## cl3r  0 0.00 0.00 0.04 0.19 0.24 0.53 0.01
## cl4r  0 0.01 0.04 0.15 0.21 0.25 0.33 0.01
## cl5r  0 0.00 0.00 0.03 0.07 0.24 0.66 0.01
## cl6r  0 0.00 0.01 0.02 0.08 0.22 0.67 0.01
## cl7r  0 0.01 0.02 0.10 0.15 0.16 0.54 0.01
## cl8r  0 0.01 0.02 0.12 0.17 0.27 0.41 0.01
## cl9r  0 0.00 0.01 0.04 0.15 0.22 0.58 0.01
## cl10r 0 0.00 0.02 0.16 0.19 0.28 0.35 0.01
## cl11r 0 0.01 0.04 0.32 0.22 0.19 0.23 0.01
## cl12r 0 0.00 0.01 0.02 0.22 0.27 0.48 0.01
## cl13r 0 0.01 0.03 0.11 0.21 0.26 0.38 0.02
## cl14r 0 0.01 0.01 0.11 0.24 0.32 0.31 0.01
## cl15r 0 0.00 0.02 0.11 0.22 0.22 0.43 0.01
## cl16r 0 0.01 0.02 0.09 0.24 0.31 0.34 0.01
## cl17r 0 0.00 0.03 0.12 0.28 0.23 0.33 0.01
## cl18r 0 0.00 0.00 0.01 0.07 0.20 0.72 0.01
## cl19r 0 0.00 0.00 0.02 0.06 0.18 0.74 0.01
## cl20r 0 0.00 0.01 0.04 0.13 0.26 0.56 0.01
## cl21r 0 0.00 0.00 0.01 0.05 0.09 0.85 0.01
#looking at distributions
hist(mydata$age)

hist(mydata$rel.sat) #relationship status  is a little left skewed (most people answered strongly positive)

hist(mydata$sex.sat)

hist(mydata$self.comp)

hist(mydata$love) #compassionate love is a little left skewed (most people answered strongly positive)

ggplot(data=subset(mydata, !is.na(role.f)), aes(x=sex.sat, y=role.f)) +
  geom_boxplot(fill='#94AEBC', color='black') +
  coord_flip() +
  theme_classic() +
  labs(x = "sexual satisfaction", y = "relationship role", title ='sexual satisfaction by partner')
## Warning: Removed 3 rows containing non-finite values (`stat_boxplot()`).

ggplot(data=subset(mydata, !is.na(role.f)), aes(x=rel.sat, y=role.f)) +
  geom_boxplot(fill='#94AEBC', color='black') +
  coord_flip() +
  theme_classic() +
  labs(x = "relationship satisfaction", y = "relationship role", title ='relationship satisfaction by partner')
## Warning: Removed 3 rows containing non-finite values (`stat_boxplot()`).

ggplot(data=subset(mydata, !is.na(role.f)), aes(x=love, y=role.f)) +
  geom_boxplot(fill='#94AEBC', color='black') +
  coord_flip() +
  theme_classic() +
  labs(x = "compassionate love", y = "relationship role", title ='compassionate love by partner')
## Warning: Removed 2 rows containing non-finite values (`stat_boxplot()`).

ggplot(data=subset(mydata, !is.na(role.f)), aes(x=self.comp, y=role.f)) +
  geom_boxplot(fill='#94AEBC', color='black') +
  coord_flip() +
  theme_classic() +
  labs(x = "self compassion", y = "relationship role", title ='self compassion by partner')
## Warning: Removed 2 rows containing non-finite values (`stat_boxplot()`).

#Correlations         
comp <- mydata[,c("self.comp", "sex.sat", "rel.sat", "love", "gestational.partner", "age", "income", "education", "loss.weeks", "rel.years")]

#calculating correlations and CIs
cor1 <- cor.mtest(comp, use="pairwise.complete.obs", conf.level = 0.95)
cor1
## $p
##                        self.comp      sex.sat      rel.sat         love
## self.comp           0.000000e+00 3.834986e-02 5.962195e-02 8.769832e-01
## sex.sat             3.834986e-02 0.000000e+00 2.046658e-14 1.916208e-02
## rel.sat             5.962195e-02 2.046658e-14 0.000000e+00 3.136925e-14
## love                8.769832e-01 1.916208e-02 3.136925e-14 0.000000e+00
## gestational.partner 6.422483e-05 5.988147e-01 1.488873e-01 9.567515e-01
## age                 6.035453e-01 2.143584e-03 2.617902e-04 4.258826e-02
## income              9.332211e-01 8.275007e-01 4.684359e-01 1.595956e-02
## education           2.519745e-01 9.889428e-01 8.230529e-01 3.602680e-01
## loss.weeks          3.796762e-01 3.203366e-01 5.508404e-01 8.618932e-01
## rel.years           5.644727e-01 1.543879e-03 1.301954e-03 1.102045e-01
##                     gestational.partner          age       income    education
## self.comp                  6.422483e-05 6.035453e-01 9.332211e-01 2.519745e-01
## sex.sat                    5.988147e-01 2.143584e-03 8.275007e-01 9.889428e-01
## rel.sat                    1.488873e-01 2.617902e-04 4.684359e-01 8.230529e-01
## love                       9.567515e-01 4.258826e-02 1.595956e-02 3.602680e-01
## gestational.partner        0.000000e+00 1.075398e-02 8.664865e-01 2.502990e-03
## age                        1.075398e-02 0.000000e+00 1.254813e-04 4.127823e-06
## income                     8.664865e-01 1.254813e-04 0.000000e+00 6.571578e-07
## education                  2.502990e-03 4.127823e-06 6.571578e-07 0.000000e+00
## loss.weeks                 8.917981e-02 7.564722e-01 6.444847e-02 4.330702e-01
## rel.years                  9.421988e-01 6.260874e-08 7.601757e-01 3.801821e-02
##                     loss.weeks    rel.years
## self.comp           0.37967622 5.644727e-01
## sex.sat             0.32033656 1.543879e-03
## rel.sat             0.55084044 1.301954e-03
## love                0.86189324 1.102045e-01
## gestational.partner 0.08917981 9.421988e-01
## age                 0.75647222 6.260874e-08
## income              0.06444847 7.601757e-01
## education           0.43307022 3.801821e-02
## loss.weeks          0.00000000 1.580312e-01
## rel.years           0.15803119 0.000000e+00
## 
## $lowCI
##                        self.comp     sex.sat      rel.sat        love
## self.comp            1.000000000  0.00682565 -0.004629601 -0.10922731
## sex.sat              0.006825650  1.00000000  0.341247652  0.02342028
## rel.sat             -0.004629601  0.34124765  1.000000000  0.33690088
## love                -0.109227311  0.02342028  0.336900882  1.00000000
## gestational.partner -0.347685961 -0.15012712 -0.031447271 -0.12174369
## age                 -0.087317106 -0.29721072 -0.329390317 -0.23764487
## income              -0.123737005 -0.13200028 -0.162226813 -0.25995864
## education           -0.049650409 -0.11998875 -0.132585893 -0.17347121
## loss.weeks          -0.093607061 -0.25146783 -0.218828229 -0.15366686
## rel.years           -0.152826184 -0.30261085 -0.305353780 -0.21277222
##                     gestational.partner         age     income    education
## self.comp                   -0.34768596 -0.08731711 -0.1237370 -0.049650409
## sex.sat                     -0.15012712 -0.29721072 -0.1320003 -0.119988747
## rel.sat                     -0.03144727 -0.32939032 -0.1622268 -0.132585893
## love                        -0.12174369 -0.23764487 -0.2599586 -0.173471213
## gestational.partner          1.00000000 -0.26655871 -0.1283137  0.064827790
## age                         -0.26655871  1.00000000  0.1140342  0.160819225
## income                      -0.12831371  0.11403422  1.0000000  0.183335819
## education                    0.06482779  0.16081923  0.1833358  1.000000000
## loss.weeks                  -0.30601126 -0.14161519 -0.3177025 -0.233441013
## rel.years                   -0.11374376  0.20840350 -0.1000128  0.007017119
##                      loss.weeks    rel.years
## self.comp           -0.09360706 -0.152826184
## sex.sat             -0.25146783 -0.302610855
## rel.sat             -0.21882823 -0.305353780
## love                -0.15366686 -0.212772220
## gestational.partner -0.30601126 -0.113743760
## age                 -0.14161519  0.208403496
## income              -0.31770246 -0.100012765
## education           -0.23344101  0.007017119
## loss.weeks           1.00000000 -0.047402384
## rel.years           -0.04740238  1.000000000
## 
## $uppCI
##                       self.comp     sex.sat     rel.sat         love
## self.comp            1.00000000  0.24099292  0.22975385  0.127751956
## sex.sat              0.24099292  1.00000000  0.53344754  0.256563987
## rel.sat              0.22975385  0.53344754  1.00000000  0.529285227
## love                 0.12775196  0.25656399  0.52928523  1.000000000
## gestational.partner -0.12404821  0.08706771  0.20419057  0.115253667
## age                  0.14945079 -0.06779390 -0.10321610 -0.004157844
## income               0.11369116  0.10582940  0.07518721 -0.027497893
## education            0.18708137  0.11832125  0.10568053  0.063672601
## loss.weeks           0.24117278  0.08400836  0.11820566  0.182924757
## rel.years            0.08388812 -0.07369807 -0.07670317  0.022041859
##                     gestational.partner          age       income education
## self.comp                   -0.12404821  0.149450788  0.113691163 0.1870814
## sex.sat                      0.08706771 -0.067793897  0.105829400 0.1183213
## rel.sat                      0.20419057 -0.103216097  0.075187210 0.1056805
## love                         0.11525367 -0.004157844 -0.027497893 0.0636726
## gestational.partner          1.00000000 -0.035895370  0.108230003 0.2940899
## age                         -0.03589537  1.000000000  0.338336639 0.3802452
## income                       0.10823000  0.338336639  1.000000000 0.4002878
## education                    0.29408988  0.380245166  0.400287787 1.0000000
## loss.weeks                   0.02248781  0.193582763  0.009540358 0.1017221
## rel.years                    0.12239005  0.420868169  0.136475397 0.2403409
##                      loss.weeks   rel.years
## self.comp           0.241172785  0.08388812
## sex.sat             0.084008361 -0.07369807
## rel.sat             0.118205655 -0.07670317
## love                0.182924757  0.02204186
## gestational.partner 0.022487812  0.12239005
## age                 0.193582763  0.42086817
## income              0.009540358  0.13647540
## education           0.101722084  0.24034092
## loss.weeks          1.000000000  0.28323180
## rel.years           0.283231803  1.00000000
cor1b <- cor(comp, use="pairwise.complete.obs")

rownames(cor1b) <- c("Self-Compassion",
                                       "Sexual Satisfaction",
                                         "Relationship Satisfaction",
                     "Compassionate Love",
                     "Gestational Partner",
                                         "Age",
                                         "Income",
                                         "Educational attainment",
                                         "Weeks at loss",
                                         "Years in relationship")


colnames(cor1b) <- c("Self-Compassion",
                                       "Sexual Satisfaction",
                                         "Relationship Satisfaction",
                     "Compassionate Love",
                     "Gestational Partner",
                                         "Age",
                                         "Income",
                                         "Educational attainment",
                                         "Weeks at loss",
                                         "Years in relationship")

    
corrplot(cor1b, method="color", type="upper",
         addCoef.col = "black", tl.col="black", tl.srt=40, p.mat = cor1$p, tl.cex = 0.7,
         insig = "label_sig",sig.level =.05, pch.cex = .5,   
         diag=FALSE, number.cex = .8,
    col=colorRampPalette(c("hotpink", "white", "#728393"))(50), cl.pos = 'n')
## Warning in corrplot(cor1b, method = "color", type = "upper", addCoef.col =
## "black", : p.mat and corr may be not paired, their rownames and colnames are
## not totally same!

#non-gestational partner is the lower binary value, correlations with being pregnant would be positive
# MODEL INTERPRETATION CHEAT SHEAT #

# a1 = non-gestational partner's actor effect
# a2 = gestational partner's actor effect
# p12 = partner effect: non-gestational partner influences gestational partner
# p21 = partner effect: gestational partner influences non-gestational partner
#########################################################################################################
#MODEL 1: self-compassion and relationship satisfaction

model1 <- '
 rel.sat_1  ~ a1*self.comp_1
 rel.sat_2  ~ a2*self.comp_2
 rel.sat_1  ~ p12*self.comp_2
 rel.sat_2  ~ p21*self.comp_1
 self.comp_1 ~ mx1*1
 self.comp_2 ~ mx2*1
 rel.sat_1 ~ my1*1
 rel.sat_2 ~ my2*1
 self.comp_1 ~~ vx1*self.comp_1
 self.comp_2 ~~ vx2*self.comp_2
 rel.sat_1 ~~ vy1*rel.sat_1
 rel.sat_2 ~~ vy2*rel.sat_2
 self.comp_2 ~~ cx*self.comp_1
 rel.sat_2 ~~ cy*rel.sat_1'
 

model1.fit <- lavaan::sem(model1,fixed.x=FALSE,  se = "bootstrap", bootstrap = 5000, data = mydata.wide, missing="fiml")
summary(model1.fit, fit.measures=TRUE, standardize=TRUE, rsquare=TRUE,estimates = TRUE, ci = TRUE)
## lavaan 0.6.15 ended normally after 30 iterations
## 
##   Estimator                                         ML
##   Optimization method                           NLMINB
##   Number of model parameters                        14
## 
##   Number of observations                           139
##   Number of missing patterns                         4
## 
## Model Test User Model:
##                                                       
##   Test statistic                                 0.000
##   Degrees of freedom                                 0
## 
## Model Test Baseline Model:
## 
##   Test statistic                                64.887
##   Degrees of freedom                                 6
##   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)               -618.797
##   Loglikelihood unrestricted model (H1)       -618.797
##                                                       
##   Akaike (AIC)                                1265.594
##   Bayesian (BIC)                              1306.677
##   Sample-size adjusted Bayesian (SABIC)       1262.384
## 
## 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             5000
##   Number of successful bootstrap draws            5000
## 
## Regressions:
##                    Estimate  Std.Err  z-value  P(>|z|) ci.lower ci.upper
##   rel.sat_1 ~                                                           
##     slf.cm_1  (a1)    0.174    0.089    1.967    0.049   -0.002    0.342
##   rel.sat_2 ~                                                           
##     slf.cm_2  (a2)    0.191    0.116    1.644    0.100   -0.036    0.419
##   rel.sat_1 ~                                                           
##     slf.cm_2 (p12)    0.098    0.103    0.957    0.339   -0.097    0.305
##   rel.sat_2 ~                                                           
##     slf.cm_1 (p21)    0.045    0.112    0.405    0.686   -0.181    0.267
##    Std.lv  Std.all
##                   
##     0.174    0.130
##                   
##     0.191    0.139
##                   
##     0.098    0.073
##                   
##     0.045    0.033
## 
## Covariances:
##                    Estimate  Std.Err  z-value  P(>|z|) ci.lower ci.upper
##   self.comp_1 ~~                                                        
##     slf.cmp_2 (cx)    0.058    0.043    1.345    0.179   -0.024    0.141
##  .rel.sat_1 ~~                                                          
##    .rel.sat_2 (cy)    0.492    0.107    4.622    0.000    0.292    0.710
##    Std.lv  Std.all
##                   
##     0.058    0.124
##                   
##     0.492    0.585
## 
## Intercepts:
##                    Estimate  Std.Err  z-value  P(>|z|) ci.lower ci.upper
##     slf.cm_1 (mx1)    2.864    0.059   48.329    0.000    2.748    2.978
##     slf.cm_2 (mx2)    3.199    0.058   55.434    0.000    3.085    3.314
##    .rel.st_1 (my1)    3.291    0.415    7.939    0.000    2.482    4.090
##    .rel.st_2 (my2)    3.193    0.417    7.651    0.000    2.416    4.052
##    Std.lv  Std.all
##     2.864    4.197
##     3.199    4.693
##     3.291    3.581
##     3.193    3.405
## 
## Variances:
##                    Estimate  Std.Err  z-value  P(>|z|) ci.lower ci.upper
##     slf.cm_1 (vx1)    0.466    0.048    9.740    0.000    0.369    0.559
##     slf.cm_2 (vx2)    0.465    0.046   10.174    0.000    0.374    0.557
##    .rel.st_1 (vy1)    0.824    0.111    7.400    0.000    0.603    1.038
##    .rel.st_2 (vy2)    0.860    0.117    7.368    0.000    0.639    1.102
##    Std.lv  Std.all
##     0.466    1.000
##     0.465    1.000
##     0.824    0.976
##     0.860    0.978
## 
## R-Square:
##                    Estimate
##     rel.sat_1         0.024
##     rel.sat_2         0.022
model1.stand <- standardizedSolution(model1.fit, type = "std.all", se = TRUE, pvalue = TRUE, ci = TRUE)

#non-gestational partner actor effect (a1): relationship satisfaction is predicted by self-compassion

semPaths(model1.fit, 
         # general lay-out for a nice APIM:
           fade = F, "est", layout='tree2', rotation = 2, style = "ram",
           intercepts = F, residuals = F,  optimizeLatRes = T, curve = 3.1,  
         # labels and their sizes:
           nodeLabels=c("Gest. P: Relation. Satisf.", "Non-Gest. P: Relation. Satisf.", 
                                 "Gest. P: Self Comp.", "Non-Gest. P: Self Comp."), sizeMan=20,  sizeMan2=18,
         # position and size of parameter estimates:
           edge.label.position = 0.45, edge.label.cex=1.2, label.cex = 1.25)

stargazer(model1.stand, summary=FALSE, type='html', rownames=TRUE, initial.zero=FALSE, digits=3,
          title='Standardized Coefficients', out = "model1.html")
## 
## <table style="text-align:center"><caption><strong>Standardized Coefficients</strong></caption>
## <tr><td colspan="11" style="border-bottom: 1px solid black"></td></tr><tr><td style="text-align:left"></td><td>lhs</td><td>op</td><td>rhs</td><td>label</td><td>est.std</td><td>se</td><td>z</td><td>pvalue</td><td>ci.lower</td><td>ci.upper</td></tr>
## <tr><td colspan="11" style="border-bottom: 1px solid black"></td></tr><tr><td style="text-align:left">1</td><td>rel.sat_1</td><td>~</td><td>self.comp_1</td><td>a1</td><td>.130</td><td>.067</td><td>1.925</td><td>.054</td><td>-.002</td><td>.261</td></tr>
## <tr><td style="text-align:left">2</td><td>rel.sat_2</td><td>~</td><td>self.comp_2</td><td>a2</td><td>.139</td><td>.085</td><td>1.631</td><td>.103</td><td>-.028</td><td>.306</td></tr>
## <tr><td style="text-align:left">3</td><td>rel.sat_1</td><td>~</td><td>self.comp_2</td><td>p12</td><td>.073</td><td>.075</td><td>.977</td><td>.328</td><td>-.073</td><td>.219</td></tr>
## <tr><td style="text-align:left">4</td><td>rel.sat_2</td><td>~</td><td>self.comp_1</td><td>p21</td><td>.033</td><td>.082</td><td>.403</td><td>.687</td><td>-.127</td><td>.193</td></tr>
## <tr><td style="text-align:left">5</td><td>self.comp_1</td><td></td><td></td><td>mx1</td><td>4.197</td><td>.230</td><td>18.266</td><td>0</td><td>3.747</td><td>4.648</td></tr>
## <tr><td style="text-align:left">6</td><td>self.comp_2</td><td></td><td></td><td>mx2</td><td>4.693</td><td>.244</td><td>19.217</td><td>0</td><td>4.214</td><td>5.172</td></tr>
## <tr><td style="text-align:left">7</td><td>rel.sat_1</td><td></td><td></td><td>my1</td><td>3.581</td><td>.570</td><td>6.282</td><td>0</td><td>2.464</td><td>4.698</td></tr>
## <tr><td style="text-align:left">8</td><td>rel.sat_2</td><td></td><td></td><td>my2</td><td>3.405</td><td>.490</td><td>6.954</td><td>0</td><td>2.446</td><td>4.365</td></tr>
## <tr><td style="text-align:left">9</td><td>self.comp_1</td><td>~~</td><td>self.comp_1</td><td>vx1</td><td>1</td><td>0</td><td></td><td></td><td>1</td><td>1</td></tr>
## <tr><td style="text-align:left">10</td><td>self.comp_2</td><td>~~</td><td>self.comp_2</td><td>vx2</td><td>1</td><td>0</td><td></td><td></td><td>1</td><td>1</td></tr>
## <tr><td style="text-align:left">11</td><td>rel.sat_1</td><td>~~</td><td>rel.sat_1</td><td>vy1</td><td>.976</td><td>.022</td><td>45.283</td><td>0</td><td>.933</td><td>1.018</td></tr>
## <tr><td style="text-align:left">12</td><td>rel.sat_2</td><td>~~</td><td>rel.sat_2</td><td>vy2</td><td>.978</td><td>.024</td><td>41.436</td><td>0</td><td>.932</td><td>1.025</td></tr>
## <tr><td style="text-align:left">13</td><td>self.comp_1</td><td>~~</td><td>self.comp_2</td><td>cx</td><td>.124</td><td>.090</td><td>1.376</td><td>.169</td><td>-.053</td><td>.300</td></tr>
## <tr><td style="text-align:left">14</td><td>rel.sat_1</td><td>~~</td><td>rel.sat_2</td><td>cy</td><td>.585</td><td>.070</td><td>8.350</td><td>0</td><td>.447</td><td>.722</td></tr>
## <tr><td colspan="11" style="border-bottom: 1px solid black"></td></tr></table>
#MODEL 2: compassionate love and sexual satisfaction

model2 <- '
 sex.sat_1  ~ a1*love_1
 sex.sat_2  ~ a2*love_2
 sex.sat_1  ~ p12*love_2
 sex.sat_2  ~ p21*love_1
 love_1 ~ mx1*1
 love_2 ~ mx2*1
 sex.sat_1 ~ my1*1
 sex.sat_2 ~ my2*1
 love_1 ~~ vx1*love_1
 love_2 ~~ vx2*love_2
 sex.sat_1 ~~ vy1*sex.sat_1
 sex.sat_2 ~~ vy2*sex.sat_2
 love_2 ~~ cx*love_1
 sex.sat_2 ~~ cy*sex.sat_1'
 

model2.fit <- lavaan::sem(model2,fixed.x=FALSE,  se = "bootstrap", bootstrap = 5000, data = mydata.wide, missing="fiml")
summary(model2.fit, fit.measures=TRUE, standardize=TRUE, rsquare=TRUE,estimates = TRUE, ci = TRUE)
## lavaan 0.6.15 ended normally after 44 iterations
## 
##   Estimator                                         ML
##   Optimization method                           NLMINB
##   Number of model parameters                        14
## 
##   Number of observations                           139
##   Number of missing patterns                         6
## 
## Model Test User Model:
##                                                       
##   Test statistic                                 0.000
##   Degrees of freedom                                 0
## 
## Model Test Baseline Model:
## 
##   Test statistic                                91.528
##   Degrees of freedom                                 6
##   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)               -714.991
##   Loglikelihood unrestricted model (H1)       -714.991
##                                                       
##   Akaike (AIC)                                1457.982
##   Bayesian (BIC)                              1499.064
##   Sample-size adjusted Bayesian (SABIC)       1454.772
## 
## 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             5000
##   Number of successful bootstrap draws            5000
## 
## Regressions:
##                    Estimate  Std.Err  z-value  P(>|z|) ci.lower ci.upper
##   sex.sat_1 ~                                                           
##     love_1    (a1)    0.623    0.179    3.474    0.001    0.256    0.960
##   sex.sat_2 ~                                                           
##     love_2    (a2)   -0.091    0.194   -0.472    0.637   -0.438    0.314
##   sex.sat_1 ~                                                           
##     love_2   (p12)   -0.181    0.185   -0.983    0.326   -0.538    0.181
##   sex.sat_2 ~                                                           
##     love_1   (p21)    0.323    0.183    1.765    0.078   -0.041    0.680
##    Std.lv  Std.all
##                   
##     0.623    0.305
##                   
##    -0.091   -0.044
##                   
##    -0.181   -0.089
##                   
##     0.323    0.155
## 
## Covariances:
##                    Estimate  Std.Err  z-value  P(>|z|) ci.lower ci.upper
##   love_1 ~~                                                             
##     love_2    (cx)    0.214    0.062    3.457    0.001    0.101    0.340
##  .sex.sat_1 ~~                                                          
##    .sex.sat_2 (cy)    1.021    0.190    5.381    0.000    0.657    1.399
##    Std.lv  Std.all
##                   
##     0.214    0.465
##                   
##     1.021    0.547
## 
## Intercepts:
##                    Estimate  Std.Err  z-value  P(>|z|) ci.lower ci.upper
##     love_1   (mx1)    6.074    0.057  107.412    0.000    5.959    6.183
##     love_2   (mx2)    6.078    0.058  104.875    0.000    5.962    6.190
##    .sex.st_1 (my1)    2.069    1.137    1.820    0.069   -0.150    4.268
##    .sex.st_2 (my2)    3.441    1.211    2.843    0.004    0.864    5.607
##    Std.lv  Std.all
##     6.074    8.968
##     6.078    8.936
##     2.069    1.494
##     3.441    2.431
## 
## Variances:
##                    Estimate  Std.Err  z-value  P(>|z|) ci.lower ci.upper
##     love_1   (vx1)    0.459    0.063    7.240    0.000    0.340    0.588
##     love_2   (vx2)    0.463    0.077    5.998    0.000    0.321    0.621
##    .sex.st_1 (vy1)    1.775    0.189    9.386    0.000    1.393    2.132
##    .sex.st_2 (vy2)    1.964    0.240    8.186    0.000    1.474    2.400
##    Std.lv  Std.all
##     0.459    1.000
##     0.463    1.000
##     1.775    0.924
##     1.964    0.980
## 
## R-Square:
##                    Estimate
##     sex.sat_1         0.076
##     sex.sat_2         0.020
model2.stand <- standardizedSolution(model2.fit, type = "std.all", se = TRUE, pvalue = TRUE, ci = TRUE)

semPaths(model2.fit, 
            fade = F, "est", layout='tree2', rotation = 2, style = "ram",
            intercepts = F, residuals = F,  optimizeLatRes = T, curve = 3.1,  
          # labels and their sizes:
            nodeLabels=c("Gest. P: Sex Satisf.", "Non-Gest. P: Sex Satisf.", 
                                     "Gest. P: Love", "Non-Gest. P: Love"), sizeMan=20,  sizeMan2=18,
          # position and size of parameter estimates:
            edge.label.position = 0.45, edge.label.cex=1.2, label.cex = 1.25)

stargazer(model2.stand, summary=FALSE, type='html', rownames=TRUE, initial.zero=FALSE, digits=3,
          title='Standardized Coefficients', out = "model2.html")
## 
## <table style="text-align:center"><caption><strong>Standardized Coefficients</strong></caption>
## <tr><td colspan="11" style="border-bottom: 1px solid black"></td></tr><tr><td style="text-align:left"></td><td>lhs</td><td>op</td><td>rhs</td><td>label</td><td>est.std</td><td>se</td><td>z</td><td>pvalue</td><td>ci.lower</td><td>ci.upper</td></tr>
## <tr><td colspan="11" style="border-bottom: 1px solid black"></td></tr><tr><td style="text-align:left">1</td><td>sex.sat_1</td><td>~</td><td>love_1</td><td>a1</td><td>.305</td><td>.089</td><td>3.439</td><td>.001</td><td>.131</td><td>.479</td></tr>
## <tr><td style="text-align:left">2</td><td>sex.sat_2</td><td>~</td><td>love_2</td><td>a2</td><td>-.044</td><td>.094</td><td>-.467</td><td>.640</td><td>-.228</td><td>.140</td></tr>
## <tr><td style="text-align:left">3</td><td>sex.sat_1</td><td>~</td><td>love_2</td><td>p12</td><td>-.089</td><td>.090</td><td>-.989</td><td>.322</td><td>-.266</td><td>.087</td></tr>
## <tr><td style="text-align:left">4</td><td>sex.sat_2</td><td>~</td><td>love_1</td><td>p21</td><td>.155</td><td>.088</td><td>1.751</td><td>.080</td><td>-.018</td><td>.328</td></tr>
## <tr><td style="text-align:left">5</td><td>love_1</td><td></td><td></td><td>mx1</td><td>8.968</td><td>.669</td><td>13.405</td><td>0</td><td>7.657</td><td>10.279</td></tr>
## <tr><td style="text-align:left">6</td><td>love_2</td><td></td><td></td><td>mx2</td><td>8.936</td><td>.794</td><td>11.248</td><td>0</td><td>7.379</td><td>10.493</td></tr>
## <tr><td style="text-align:left">7</td><td>sex.sat_1</td><td></td><td></td><td>my1</td><td>1.494</td><td>.834</td><td>1.791</td><td>.073</td><td>-.141</td><td>3.128</td></tr>
## <tr><td style="text-align:left">8</td><td>sex.sat_2</td><td></td><td></td><td>my2</td><td>2.431</td><td>.873</td><td>2.784</td><td>.005</td><td>.720</td><td>4.143</td></tr>
## <tr><td style="text-align:left">9</td><td>love_1</td><td>~~</td><td>love_1</td><td>vx1</td><td>1</td><td>0</td><td></td><td></td><td>1</td><td>1</td></tr>
## <tr><td style="text-align:left">10</td><td>love_2</td><td>~~</td><td>love_2</td><td>vx2</td><td>1</td><td>0</td><td></td><td></td><td>1</td><td>1</td></tr>
## <tr><td style="text-align:left">11</td><td>sex.sat_1</td><td>~~</td><td>sex.sat_1</td><td>vy1</td><td>.924</td><td>.044</td><td>21.145</td><td>0</td><td>.839</td><td>1.010</td></tr>
## <tr><td style="text-align:left">12</td><td>sex.sat_2</td><td>~~</td><td>sex.sat_2</td><td>vy2</td><td>.980</td><td>.022</td><td>44.507</td><td>0</td><td>.937</td><td>1.024</td></tr>
## <tr><td style="text-align:left">13</td><td>love_1</td><td>~~</td><td>love_2</td><td>cx</td><td>.465</td><td>.088</td><td>5.295</td><td>0.00000</td><td>.293</td><td>.638</td></tr>
## <tr><td style="text-align:left">14</td><td>sex.sat_1</td><td>~~</td><td>sex.sat_2</td><td>cy</td><td>.547</td><td>.061</td><td>9.013</td><td>0</td><td>.428</td><td>.666</td></tr>
## <tr><td colspan="11" style="border-bottom: 1px solid black"></td></tr></table>
#non-gestational partner actor effect (a1): sexual satisfaction is predicted by compassionate love
#MODEL 3: self compassion and sexual satisfaction


model3 <- '
 sex.sat_1  ~ a1*self.comp_1
 sex.sat_2  ~ a2*self.comp_2
 sex.sat_1  ~ p12*self.comp_2
 sex.sat_2  ~ p21*self.comp_1
 self.comp_1 ~ mx1*1
 self.comp_2 ~ mx2*1
 sex.sat_1 ~ my1*1
 sex.sat_2 ~ my2*1
 self.comp_1 ~~ vx1*self.comp_1
 self.comp_2 ~~ vx2*self.comp_2
 sex.sat_1 ~~ vy1*sex.sat_1
 sex.sat_2 ~~ vy2*sex.sat_2
 self.comp_2 ~~ cx*self.comp_1
 sex.sat_2 ~~ cy*sex.sat_1'
 

model3.fit <- lavaan::sem(model3,fixed.x=FALSE,  se = "bootstrap", bootstrap = 5000, data = mydata.wide, missing="fiml")
summary(model3.fit, fit.measures=TRUE, standardize=TRUE, rsquare=TRUE,estimates = TRUE, ci = TRUE)
## lavaan 0.6.15 ended normally after 34 iterations
## 
##   Estimator                                         ML
##   Optimization method                           NLMINB
##   Number of model parameters                        14
## 
##   Number of observations                           139
##   Number of missing patterns                         6
## 
## Model Test User Model:
##                                                       
##   Test statistic                                 0.000
##   Degrees of freedom                                 0
## 
## Model Test Baseline Model:
## 
##   Test statistic                                58.538
##   Degrees of freedom                                 6
##   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)               -733.024
##   Loglikelihood unrestricted model (H1)       -733.024
##                                                       
##   Akaike (AIC)                                1494.048
##   Bayesian (BIC)                              1535.131
##   Sample-size adjusted Bayesian (SABIC)       1490.838
## 
## 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             5000
##   Number of successful bootstrap draws            5000
## 
## Regressions:
##                    Estimate  Std.Err  z-value  P(>|z|) ci.lower ci.upper
##   sex.sat_1 ~                                                           
##     slf.cm_1  (a1)    0.094    0.172    0.546    0.585   -0.258    0.430
##   sex.sat_2 ~                                                           
##     slf.cm_2  (a2)    0.397    0.181    2.193    0.028    0.050    0.766
##   sex.sat_1 ~                                                           
##     slf.cm_2 (p12)   -0.015    0.191   -0.078    0.938   -0.390    0.355
##   sex.sat_2 ~                                                           
##     slf.cm_1 (p21)    0.071    0.200    0.355    0.723   -0.326    0.458
##    Std.lv  Std.all
##                   
##     0.094    0.046
##                   
##     0.397    0.191
##                   
##    -0.015   -0.007
##                   
##     0.071    0.034
## 
## Covariances:
##                    Estimate  Std.Err  z-value  P(>|z|) ci.lower ci.upper
##   self.comp_1 ~~                                                        
##     slf.cmp_2 (cx)    0.057    0.043    1.340    0.180   -0.029    0.140
##  .sex.sat_1 ~~                                                          
##    .sex.sat_2 (cy)    1.089    0.184    5.932    0.000    0.715    1.439
##    Std.lv  Std.all
##                   
##     0.057    0.124
##                   
##     1.089    0.568
## 
## Intercepts:
##                    Estimate  Std.Err  z-value  P(>|z|) ci.lower ci.upper
##     slf.cm_1 (mx1)    2.864    0.059   48.391    0.000    2.749    2.979
##     slf.cm_2 (mx2)    3.200    0.058   55.150    0.000    3.086    3.314
##    .sex.st_1 (my1)    4.535    0.826    5.492    0.000    2.913    6.162
##    .sex.st_2 (my2)    3.373    0.782    4.314    0.000    1.814    4.881
##    Std.lv  Std.all
##     2.864    4.197
##     3.200    4.694
##     4.535    3.277
##     3.373    2.384
## 
## Variances:
##                    Estimate  Std.Err  z-value  P(>|z|) ci.lower ci.upper
##     slf.cm_1 (vx1)    0.466    0.048    9.776    0.000    0.373    0.558
##     slf.cm_2 (vx2)    0.465    0.046   10.000    0.000    0.370    0.554
##    .sex.st_1 (vy1)    1.911    0.203    9.411    0.000    1.481    2.285
##    .sex.st_2 (vy2)    1.923    0.223    8.618    0.000    1.450    2.326
##    Std.lv  Std.all
##     0.466    1.000
##     0.465    1.000
##     1.911    0.998
##     1.923    0.961
## 
## R-Square:
##                    Estimate
##     sex.sat_1         0.002
##     sex.sat_2         0.039
model3.stand <- standardizedSolution(model3.fit, type = "std.all", se = TRUE, pvalue = TRUE, ci = TRUE)

# gestational partner - actor effect (a2): sexual satisfaction is predicted by self-compassion

semPaths(model3.fit, 
           fade = F, "est", layout='tree2', rotation = 2, style = "ram",
           intercepts = F, residuals = F,  optimizeLatRes = T, curve = 3.1,  
         # labels and their sizes:
           nodeLabels=c("Gest. P: Sex Satisf.", "Non-Gest. P: Sex Satisf.", 
                                 "Gest. P: Self. Comp.", "Non-Gest. P: Self. Comp"), sizeMan=20,  sizeMan2=18,
         # position and size of parameter estimates:
           edge.label.position = 0.45, edge.label.cex=1.2, label.cex = 1.25)

stargazer(model3.stand, summary=FALSE, type='html', rownames=TRUE, initial.zero=FALSE, digits=3,
          title='Standardized Coefficients', out = "model3.html")
## 
## <table style="text-align:center"><caption><strong>Standardized Coefficients</strong></caption>
## <tr><td colspan="11" style="border-bottom: 1px solid black"></td></tr><tr><td style="text-align:left"></td><td>lhs</td><td>op</td><td>rhs</td><td>label</td><td>est.std</td><td>se</td><td>z</td><td>pvalue</td><td>ci.lower</td><td>ci.upper</td></tr>
## <tr><td colspan="11" style="border-bottom: 1px solid black"></td></tr><tr><td style="text-align:left">1</td><td>sex.sat_1</td><td>~</td><td>self.comp_1</td><td>a1</td><td>.046</td><td>.085</td><td>.546</td><td>.585</td><td>-.120</td><td>.212</td></tr>
## <tr><td style="text-align:left">2</td><td>sex.sat_2</td><td>~</td><td>self.comp_2</td><td>a2</td><td>.191</td><td>.084</td><td>2.266</td><td>.023</td><td>.026</td><td>.356</td></tr>
## <tr><td style="text-align:left">3</td><td>sex.sat_1</td><td>~</td><td>self.comp_2</td><td>p12</td><td>-.007</td><td>.094</td><td>-.078</td><td>.938</td><td>-.192</td><td>.177</td></tr>
## <tr><td style="text-align:left">4</td><td>sex.sat_2</td><td>~</td><td>self.comp_1</td><td>p21</td><td>.034</td><td>.097</td><td>.355</td><td>.723</td><td>-.155</td><td>.224</td></tr>
## <tr><td style="text-align:left">5</td><td>self.comp_1</td><td></td><td></td><td>mx1</td><td>4.197</td><td>.228</td><td>18.423</td><td>0</td><td>3.750</td><td>4.643</td></tr>
## <tr><td style="text-align:left">6</td><td>self.comp_2</td><td></td><td></td><td>mx2</td><td>4.694</td><td>.246</td><td>19.096</td><td>0</td><td>4.212</td><td>5.176</td></tr>
## <tr><td style="text-align:left">7</td><td>sex.sat_1</td><td></td><td></td><td>my1</td><td>3.277</td><td>.632</td><td>5.184</td><td>0.00000</td><td>2.038</td><td>4.516</td></tr>
## <tr><td style="text-align:left">8</td><td>sex.sat_2</td><td></td><td></td><td>my2</td><td>2.384</td><td>.611</td><td>3.902</td><td>.0001</td><td>1.187</td><td>3.581</td></tr>
## <tr><td style="text-align:left">9</td><td>self.comp_1</td><td>~~</td><td>self.comp_1</td><td>vx1</td><td>1</td><td>0</td><td></td><td></td><td>1</td><td>1</td></tr>
## <tr><td style="text-align:left">10</td><td>self.comp_2</td><td>~~</td><td>self.comp_2</td><td>vx2</td><td>1</td><td>0</td><td></td><td></td><td>1</td><td>1</td></tr>
## <tr><td style="text-align:left">11</td><td>sex.sat_1</td><td>~~</td><td>sex.sat_1</td><td>vy1</td><td>.998</td><td>.008</td><td>130.027</td><td>0</td><td>.983</td><td>1.013</td></tr>
## <tr><td style="text-align:left">12</td><td>sex.sat_2</td><td>~~</td><td>sex.sat_2</td><td>vy2</td><td>.961</td><td>.034</td><td>28.626</td><td>0</td><td>.895</td><td>1.026</td></tr>
## <tr><td style="text-align:left">13</td><td>self.comp_1</td><td>~~</td><td>self.comp_2</td><td>cx</td><td>.124</td><td>.090</td><td>1.373</td><td>.170</td><td>-.053</td><td>.300</td></tr>
## <tr><td style="text-align:left">14</td><td>sex.sat_1</td><td>~~</td><td>sex.sat_2</td><td>cy</td><td>.568</td><td>.057</td><td>9.982</td><td>0</td><td>.457</td><td>.680</td></tr>
## <tr><td colspan="11" style="border-bottom: 1px solid black"></td></tr></table>
#MODEL 4: compassionate love and relationship satisfaction

model4 <- '
 rel.sat_1  ~ a1*love_1
 rel.sat_2  ~ a2*love_2
 rel.sat_1  ~ p12*love_2
 rel.sat_2  ~ p21*love_1
 love_1 ~ mx1*1
 love_2 ~ mx2*1
 rel.sat_1 ~ my1*1
 rel.sat_2 ~ my2*1
 love_1 ~~ vx1*love_1
 love_2 ~~ vx2*love_2
 rel.sat_1 ~~ vy1*rel.sat_1
 rel.sat_2 ~~ vy2*rel.sat_2
 love_2 ~~ cx*love_1
 rel.sat_2 ~~ cy*rel.sat_1'
 

model4.fit <- lavaan::sem(model4,fixed.x=FALSE,  se = "bootstrap", bootstrap = 5000, data = mydata.wide, missing="fiml")
summary(model4.fit, fit.measures=TRUE, standardize=TRUE, rsquare=TRUE,estimates = TRUE, ci = TRUE)
## lavaan 0.6.15 ended normally after 40 iterations
## 
##   Estimator                                         ML
##   Optimization method                           NLMINB
##   Number of model parameters                        14
## 
##   Number of observations                           139
##   Number of missing patterns                         4
## 
## Model Test User Model:
##                                                       
##   Test statistic                                 0.000
##   Degrees of freedom                                 0
## 
## Model Test Baseline Model:
## 
##   Test statistic                               140.387
##   Degrees of freedom                                 6
##   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)               -579.509
##   Loglikelihood unrestricted model (H1)       -579.509
##                                                       
##   Akaike (AIC)                                1187.018
##   Bayesian (BIC)                              1228.101
##   Sample-size adjusted Bayesian (SABIC)       1183.808
## 
## 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             5000
##   Number of successful bootstrap draws            5000
## 
## Regressions:
##                    Estimate  Std.Err  z-value  P(>|z|) ci.lower ci.upper
##   rel.sat_1 ~                                                           
##     love_1    (a1)    0.558    0.118    4.730    0.000    0.323    0.789
##   rel.sat_2 ~                                                           
##     love_2    (a2)    0.363    0.147    2.462    0.014    0.089    0.669
##   rel.sat_1 ~                                                           
##     love_2   (p12)    0.219    0.139    1.579    0.114   -0.048    0.502
##   rel.sat_2 ~                                                           
##     love_1   (p21)    0.398    0.115    3.463    0.001    0.171    0.620
##    Std.lv  Std.all
##                   
##     0.558    0.410
##                   
##     0.363    0.263
##                   
##     0.219    0.162
##                   
##     0.398    0.287
## 
## Covariances:
##                    Estimate  Std.Err  z-value  P(>|z|) ci.lower ci.upper
##   love_1 ~~                                                             
##     love_2    (cx)    0.212    0.062    3.423    0.001    0.100    0.340
##  .rel.sat_1 ~~                                                          
##    .rel.sat_2 (cy)    0.306    0.065    4.747    0.000    0.179    0.429
##    Std.lv  Std.all
##                   
##     0.212    0.462
##                   
##     0.306    0.467
## 
## Intercepts:
##                    Estimate  Std.Err  z-value  P(>|z|) ci.lower ci.upper
##     love_1   (mx1)    6.074    0.057  106.280    0.000    5.960    6.184
##     love_2   (mx2)    6.076    0.058  105.091    0.000    5.961    6.188
##    .rel.st_1 (my1)   -0.611    0.951   -0.643    0.520   -2.481    1.230
##    .rel.st_2 (my2)   -0.686    1.044   -0.657    0.511   -2.793    1.264
##    Std.lv  Std.all
##     6.074    8.977
##     6.076    8.946
##    -0.611   -0.665
##    -0.686   -0.733
## 
## Variances:
##                    Estimate  Std.Err  z-value  P(>|z|) ci.lower ci.upper
##     love_1   (vx1)    0.458    0.063    7.217    0.000    0.340    0.589
##     love_2   (vx2)    0.461    0.076    6.037    0.000    0.321    0.618
##    .rel.st_1 (vy1)    0.630    0.089    7.084    0.000    0.446    0.792
##    .rel.st_2 (vy2)    0.683    0.077    8.904    0.000    0.525    0.823
##    Std.lv  Std.all
##     0.458    1.000
##     0.461    1.000
##     0.630    0.744
##     0.683    0.778
## 
## R-Square:
##                    Estimate
##     rel.sat_1         0.256
##     rel.sat_2         0.222
model4.stand <- standardizedSolution(model4.fit, type = "std.all", se = TRUE, pvalue = TRUE, ci = TRUE)

semPaths(model4.fit, 
           fade = F, "est", layout='tree2', rotation = 2, style = "ram",
           intercepts = F, residuals = F,  optimizeLatRes = T, curve = 3.1,  
         # labels and their sizes:
           nodeLabels=c("Gest. P: Rel. Satisf.", "Non-Gest. P: Rel. Satisf.", 
                                 "Gest. P: Love", "Non-Gest. P: Love"), sizeMan=20,  sizeMan2=18,
         # position and size of parameter estimates:
           edge.label.position = 0.45, edge.label.cex=1.2, label.cex = 1.25)

#non-gestational partner - actor effect (a1): relationship satisfaction is predicted by compassionate love
#gestational partner - actor effect (a2): relationship satisfaction is predicted by compassionate love
#partner effect (p21): gestational partner's relationship satisfaction is predicted by non-gest partner's love

stargazer(model4.stand, summary=FALSE, type='html', rownames=TRUE, initial.zero=FALSE, digits=3,
          title='Standardized Coefficients', out = "model4.html")
## 
## <table style="text-align:center"><caption><strong>Standardized Coefficients</strong></caption>
## <tr><td colspan="11" style="border-bottom: 1px solid black"></td></tr><tr><td style="text-align:left"></td><td>lhs</td><td>op</td><td>rhs</td><td>label</td><td>est.std</td><td>se</td><td>z</td><td>pvalue</td><td>ci.lower</td><td>ci.upper</td></tr>
## <tr><td colspan="11" style="border-bottom: 1px solid black"></td></tr><tr><td style="text-align:left">1</td><td>rel.sat_1</td><td>~</td><td>love_1</td><td>a1</td><td>.410</td><td>.085</td><td>4.817</td><td>0.00000</td><td>.243</td><td>.577</td></tr>
## <tr><td style="text-align:left">2</td><td>rel.sat_2</td><td>~</td><td>love_2</td><td>a2</td><td>.263</td><td>.096</td><td>2.755</td><td>.006</td><td>.076</td><td>.451</td></tr>
## <tr><td style="text-align:left">3</td><td>rel.sat_1</td><td>~</td><td>love_2</td><td>p12</td><td>.162</td><td>.099</td><td>1.640</td><td>.101</td><td>-.032</td><td>.356</td></tr>
## <tr><td style="text-align:left">4</td><td>rel.sat_2</td><td>~</td><td>love_1</td><td>p21</td><td>.287</td><td>.082</td><td>3.524</td><td>.0004</td><td>.128</td><td>.447</td></tr>
## <tr><td style="text-align:left">5</td><td>love_1</td><td></td><td></td><td>mx1</td><td>8.977</td><td>.673</td><td>13.346</td><td>0</td><td>7.658</td><td>10.295</td></tr>
## <tr><td style="text-align:left">6</td><td>love_2</td><td></td><td></td><td>mx2</td><td>8.946</td><td>.790</td><td>11.320</td><td>0</td><td>7.397</td><td>10.495</td></tr>
## <tr><td style="text-align:left">7</td><td>rel.sat_1</td><td></td><td></td><td>my1</td><td>-.665</td><td>1.013</td><td>-.656</td><td>.512</td><td>-2.650</td><td>1.320</td></tr>
## <tr><td style="text-align:left">8</td><td>rel.sat_2</td><td></td><td></td><td>my2</td><td>-.733</td><td>1.087</td><td>-.674</td><td>.500</td><td>-2.863</td><td>1.398</td></tr>
## <tr><td style="text-align:left">9</td><td>love_1</td><td>~~</td><td>love_1</td><td>vx1</td><td>1</td><td>0</td><td></td><td></td><td>1</td><td>1</td></tr>
## <tr><td style="text-align:left">10</td><td>love_2</td><td>~~</td><td>love_2</td><td>vx2</td><td>1</td><td>0</td><td></td><td></td><td>1</td><td>1</td></tr>
## <tr><td style="text-align:left">11</td><td>rel.sat_1</td><td>~~</td><td>rel.sat_1</td><td>vy1</td><td>.744</td><td>.085</td><td>8.713</td><td>0</td><td>.577</td><td>.912</td></tr>
## <tr><td style="text-align:left">12</td><td>rel.sat_2</td><td>~~</td><td>rel.sat_2</td><td>vy2</td><td>.778</td><td>.078</td><td>9.999</td><td>0</td><td>.626</td><td>.931</td></tr>
## <tr><td style="text-align:left">13</td><td>love_1</td><td>~~</td><td>love_2</td><td>cx</td><td>.462</td><td>.088</td><td>5.227</td><td>0.00000</td><td>.289</td><td>.635</td></tr>
## <tr><td style="text-align:left">14</td><td>rel.sat_1</td><td>~~</td><td>rel.sat_2</td><td>cy</td><td>.467</td><td>.072</td><td>6.471</td><td>0</td><td>.326</td><td>.609</td></tr>
## <tr><td colspan="11" style="border-bottom: 1px solid black"></td></tr></table>