Data cleaning and recoding

data_all <- read.csv ("ssei_working_RSQupdate.csv", header=TRUE)
data_all$id<-1:421

Here are our notes on the variables treatment: (just for our record). The data were recoded previously using codes in ssei_SEM.R. The data were then saved as "ssei_recodedclean.csv" and used here for further analysis.

Amy: I've done only the CTQ and SSEI. The only differences is that I got more usable scores with my method. I used the (statistical: mean) method, which takes the average of available items. The original scoring did not compute a mean if any component items had missing data. The method I use simply takes the average of what is available.

SESr is the categorical "levels of victimzation variable" where 0 = no victimization, 1 = unwanted contact, 2 = verbal coercion, 3 = attempted rape, and 4 = rape. SESr_di is dichotomized to reflect the presence or absence of any victimization.

I ran correlations between MSQ and SSEI factors and found that all three MSQ factors were pretty strongly correlated (rs between .47 and .67) with two of the SSEI subscales (skills and experience and adaptiveness; these two subscales were also pretty strongly correlated with each other). Which suggests that the MSQ doesn't provide a ton of unique variance beyond that provided by the SSEI, so maybe we don't need to include it.

For SCS, PositiveAttitude and AwareDiscuss are indeed pro-consent variables. LackControl is anti-consent. The other two are less clear. Indirect is about using non-verbal strategies to establish consent. It doesn't strike me as necessarily good or bad. In a psychometric evaluation of the measure (Humphreys and Brousseau, 2010), the Indirect subscale was positively correlated with sexual assertiveness (a positive indicator of sexual health) but also positively correlated with a measure of sexual sensation seeking (which measures tendencies toward taking sexual risks, which seems like a more negative indicator of sexual health). Sexual consent norms is about the perception that establishing consent is more important in new relationships and/or the beginning of a sexual encounter than in later on. Which seems kind of neutral in terms of sexual health. It was unrelated to the two other things they measured. If they aren't fitting well, we could remove Indirect and Norms from the model, as they are less clearly indicative of sexual health? And for the SSEI, yes, higher scores mean a more positive attitude toward one's sexual behavior. For sexual victimization (SES), the SESr is ordinal data based on victimization severity. Not sure about the assumptions of SEM whether ordinal data can be modeled as continuous, or if it is better to use the dichotomous variable. Amy

I think if we can statistically and conceptually justify creating an overall efficacy score, that should be fine. The original measure included more subscales than we used in this study anyway, so we are already deviating from how the measure was originally intended.

Hung-Chu: Please note that MSQ has been recoded to be on the 0-4 scale. I suggested that we do not use the categorical approach to scoring attachment working models but dimensional approach (greater statistical power and much more supported by the literature). Thus, RSQself and RSQother were scored.

But I looked at the correlation of the two RSQ subscales (attachment anxiety and avoidance), the correlation was high (.56, p <.0001). I think we can enter both into the measurement model of cognitive-emotional functioning. This makes sense theoretically because these two are two distinct aspects of attachment insecurity.

Column AL: ACE Sum (the higher the score, the more ACEs) Column OX: derssum (we may want to try this summed score for the measurement model first) (the higher the score, the greater difficulty in emotional regulation) (if you would like to look into the subscales, the higher the scores, the greater difficulty in ER) Column OJ: RSQself (the higher the score, the higher levels of attachment insecurity/the more negative views about the self) Column OK: RSQother(the higher the score, the higher levels of attachment insecurity/the more negative views about others) Thus, for cognitive-emotional functioning, all RSQself, RSQother, and derssum (as well as all the subscales of ders) are reversely related to positive functioning.

Manyu: I further conducted a factor analysis and I found the results most supportive of 1 factor (eigenvalues for 2nd and 3rd factors are 1.4 and 1.0). The three subscales are also highly correlated (rs > .62). But a disadvantage of using the overall score is that it is against the original design of the scale. We can still put the three subscales in the SEM model and then account for the inter-correlations among the three subscales.

Meeting notes: Hung-Chu: For the cognitive emotional functioning latent variable, make sure DERS and internal working model goes in the same direction.

CTQ/ACE issues Amy: Do not use CTQ_min. What can ACEs tell us that CTQ can't? CTQ sum score + ACEs in the model?

data <- dplyr::select(data_all, id, ACE.Sum, CTQ_PA, CTQ_EA, CTQ_SA, CTQ_PN, CTQ_EN, CTQ_min, CTQtotal
                      , RSQself, RSQother, derssum
                      , dersnonaccept, dersgoals, dersawareness, dersstrategies, dersclarity
                      , SCS_LackControl, SCS_PosAttitude, SCS_Indirect, SCS_Norms, 
                      SCS_AwareDiscuss
                      , SSEI_SnE, SSEI_Att, SSEI_Con, SSEI_Adapt, SSEI_Mor
                      , ProtectionEfficacy, STIEfficacy, SexCommEfficacy, OverallEfficacy
                      , SES, dersmean
                      ,gender, year, age, single, sexor, race
                      ,ACE1:ACE10, finance
                      )


#reverse so that higher score = higher control; recoding doesn't affect model performance or estimates. It just makes interpretation easier. 
data$SCS_LackControl_r<- 8 -(data$SCS_LackControl) 

#dichotomizing the SES variable into 0=no assault; 1=any assault experiences, i.e., should negatively relate to Sexual WB
data$SES_di[data$SES==0]<-0
data$SES_di[data$SES>0]<-1
data$SES_di<-as.factor(data$SES_di)
data$sex[data$gender==1]<-1
data$sex[data$gender==2]<-0
data$sex[data$gender==6]<-NA
#include only complete cases of the final sem model
finalsemvar<-dplyr::select(data, RSQself,RSQother,dersmean, SCS_LackControl_r, SCS_PosAttitude, SSEI_SnE , SSEI_Att , SSEI_Con,SSEI_Adapt,SSEI_Mor, OverallEfficacy, sex , ACE.Sum)
finalsemvar_screened<-finalsemvar[complete.cases(finalsemvar), ]

data<-data[complete.cases(finalsemvar), ]

checking outliers and normality SEM is not very sensitive to normality, so we may get away with the few nomality issues we have. We can note them in the paper if we want.

I only examined multivariate outliers using Mahalanobis Distance and a cutoff score a chi-square with k degrees of freedom (k = number of variables) and .001 alpha probability. A score above the cutoff is identified as potential outliers. 5 outliers were identified, but they didn't really change the model results. We may include this outlier analysis at the end of the result section.

For missing data, as mentioned above, I just removed them altogether. We may consider substitution with mean/median or other imputation methods.

averaging across items and ignore missing cells

out<-outlier(finalsemvar_screened, print=F)
## Warning in plot.window(...): "print" is not a graphical parameter
## Warning in plot.xy(xy, type, ...): "print" is not a graphical parameter
## Warning in axis(side = side, at = at, labels = labels, ...): "print" is not a
## graphical parameter

## Warning in axis(side = side, at = at, labels = labels, ...): "print" is not a
## graphical parameter
## Warning in box(...): "print" is not a graphical parameter
## Warning in title(...): "print" is not a graphical parameter
## Warning in text.default(Chi2[n.obs:(n.obs - bad + 1)], D2[worst[1:bad]], :
## "print" is not a graphical parameter

#finalsemvarout <- data.frame(finalsemvar,out)
alpha <- .001
cutoff <- (qchisq(p = 1 - alpha, df = ncol(finalsemvar_screened)))
names_outliers_MH <- which(out > cutoff)
excluded_mh <- names_outliers_MH
#finalsemvar_cleaned <- finalsemvar_screened[-excluded_mh, ]
data_clean_mh <- data[-excluded_mh, ]

#we only have 5 multivariate outliers. Removing them or not doesn't really matter to the final results. We may include this in the result report if we want. 

#normality is violated in the following scales, but then SEM is quite tolerance of normality so it probably doesn't matter. 
#shapiro.test(data_clean_mh$ACE.Sum)
#shapiro.test(data_clean_mh$dersmean)
#shapiro.test(data_clean_mh$SCS_LackControl_r)
#shapiro.test(data_clean_mh$SCS_PosAttitude)
#shapiro.test(data_clean_mh$SSEI_SnE)
#shapiro.test(data_clean_mh$SSEI_Att)
#shapiro.test(data_clean_mh$SSEI_Con)
#shapiro.test(data_clean_mh$SSEI_Adapt)
#shapiro.test(data_clean_mh$SSEI_Mor)
#shapiro.test(data_clean_mh$OverallEfficacy)

Descriptive stats and Pearson correlations among the chosen variables

Please do not worry about the format of the tables too much at this point. We can finalize how we present the tables at the end of the manuscript writing problems. Point out, though, if you see any numbers that are off.

Sample Characteristics

samplechar<-dplyr::select(data, gender, year, age, single, sexor, race)

samplechar %>%
  mutate(
    gender=factor(gender, levels=c(1,2,6), labels=c("Male","Female","Non-binary")),
    single=factor(single, levels=c(1,0), labels=c("Single","In a relationship")),
    sexor=factor(sexor, levels=c(1,2,3,4,5), labels=c("Heterosexual","Homosexual","Bisexual", "Asexual","No Responses")),
    race=factor(race, levels=c(1,2,3,4,5,7), labels=c("Asians","Black","White","Hispanic","Native Americans","Multiracial/ethnic"))
  ) %>%
  tbl_summary(label=list(year~"Year in College", age~"Age", single~"Relationship Status", 
                       sexor~"Sexual Orientation", race~"Race/Ethnicity"),
            statistic = list(age ~ "{mean} ({sd})"),
            digits=list(age~c(1,2)),
            missing_text = "No Responses"
            )
Characteristic N = 3291
gender
Male 96 (29%)
Female 233 (71%)
Non-binary 0 (0%)
Year in College
1 173 (53%)
2 89 (27%)
3 36 (11%)
4 30 (9.1%)
6 1 (0.3%)
Age 19.3 (2.41)
Relationship Status
Single 167 (51%)
In a relationship 161 (49%)
No Responses 1
Sexual Orientation
Heterosexual 276 (84%)
Homosexual 14 (4.3%)
Bisexual 24 (7.3%)
Asexual 7 (2.1%)
No Responses 8 (2.4%)
Race/Ethnicity
Asians 3 (0.9%)
Black 73 (22%)
White 223 (68%)
Hispanic 8 (2.5%)
Native Americans 0 (0%)
Multiracial/ethnic 19 (5.8%)
No Responses 3
1 n (%); Mean (SD)

Descriptive Statistics of Tested Variables The list may be adjusted after we determine what variables we are including in the model.

var<-dplyr::select(data, ACE.Sum, CTQ_PA,CTQ_EA,CTQ_SA,CTQ_PN,CTQ_EN,CTQ_min, CTQtotal, RSQself,RSQother,derssum,dersmean, SCS_LackControl_r, SCS_PosAttitude, SCS_AwareDiscuss
              ,SSEI_SnE , SSEI_Att , SSEI_Con,SSEI_Adapt,SSEI_Mor
              ,OverallEfficacy
            ,SES_di)

tbl_summary(var
            ,statistic = list(all_continuous()~ "{mean} ({sd}; {min}-{max})")
            ,missing_text = "Missing"
            ,            digits=list(all_continuous()~c(1,2))
)
Characteristic N = 3291
ACE.Sum
0 166 (50%)
1 88 (27%)
4 31 (9.4%)
5 16 (4.9%)
6 12 (3.6%)
7 11 (3.3%)
8 5 (1.5%)
CTQ_PA 1.4 (0.60; 1.0-4.80)
CTQ_EA 1.7 (0.96; 1.0-5.00)
CTQ_SA 1.1 (0.48; 1.0-4.40)
CTQ_PN 1.3 (0.50; 1.0-3.80)
CTQ_EN 1.7 (0.81; 1.0-4.40)
CTQ_min 2.8 (1.17; 1.0-5.00)
CTQtotal 1.4 (0.49; 1.0-4.16)
Missing 35
RSQself 0.1 (2.67; -5.7-6.30)
RSQother -0.5 (1.78; -5.5-5.00)
derssum 98.1 (21.89; 51.0-166.00)
Missing 46
dersmean 2.5 (0.70; 1.1-4.74)
SCS_LackControl_r 5.9 (1.23; 1.3-7.00)
SCS_PosAttitude 5.5 (1.40; 1.0-7.00)
SCS_AwareDiscuss 4.0 (1.58; 1.0-7.00)
Missing 4
SSEI_SnE 4.3 (1.09; 1.0-6.00)
SSEI_Att 3.8 (1.37; 1.0-6.00)
SSEI_Con 4.5 (1.07; 1.1-6.00)
SSEI_Adapt 4.0 (0.81; 1.0-5.71)
SSEI_Mor 4.2 (1.12; 1.0-6.00)
OverallEfficacy 4.1 (0.85; 1.0-5.00)
SES_di
0 108 (41%)
1 153 (59%)
Missing 68
1 n (%); Mean (SD; Minimum-Maximum)

Note: ACE was formed by summing items (i.e., range = 0-10). RSQ self (i.e., Positive Model of Self) was computed by (Secure + Dismissing) - (Preoccupied + Fearful), and RSQ other (i.e., Positive Model of Others) was computed by (Secure + Preoccupied) - (Dismissing + Fearful). The possible range of RSQ self is -30 to 40, and RSQ other is -36 to +36. Difficulties in Emotion Regulation (DERS) was computed by summing scores of 36 items rated on a 5-point Likert scale (i.e., range = 36-180). Sexual Experience Survey (SES) was dichotomized as experience of sexual assault (1) and no experience of sexual assualt (0).

Other variables were simple average of all items in the subscales/scale. The ranges are 1-5 for CTQ, 1-5 for DERS, 1-7 for SCS, 1-6 for SSEI, and 1-5 for Sexuxl self-efficacy.

Correlations among tested variables

rcorr(as.matrix(var))
##                   ACE.Sum CTQ_PA CTQ_EA CTQ_SA CTQ_PN CTQ_EN CTQ_min CTQtotal
## ACE.Sum              1.00   0.52   0.65   0.40   0.60   0.62    0.57     0.72
## CTQ_PA               0.52   1.00   0.60   0.32   0.45   0.51    0.45     0.75
## CTQ_EA               0.65   0.60   1.00   0.25   0.56   0.74    0.66     0.88
## CTQ_SA               0.40   0.32   0.25   1.00   0.27   0.23    0.24     0.40
## CTQ_PN               0.60   0.45   0.56   0.27   1.00   0.65    0.48     0.75
## CTQ_EN               0.62   0.51   0.74   0.23   0.65   1.00    0.72     0.86
## CTQ_min              0.57   0.45   0.66   0.24   0.48   0.72    1.00     0.70
## CTQtotal             0.72   0.75   0.88   0.40   0.75   0.86    0.70     1.00
## RSQself             -0.25  -0.20  -0.38  -0.09  -0.26  -0.31   -0.33    -0.36
## RSQother            -0.23  -0.13  -0.34  -0.18  -0.18  -0.31   -0.35    -0.32
## derssum              0.21   0.08   0.36   0.06   0.22   0.23    0.24     0.31
## dersmean             0.22   0.11   0.35   0.11   0.25   0.28    0.26     0.31
## SCS_LackControl_r    0.06   0.05   0.04   0.01  -0.08   0.00   -0.01     0.03
## SCS_PosAttitude      0.09  -0.02   0.08   0.02  -0.07   0.00    0.03     0.04
## SCS_AwareDiscuss     0.16   0.02   0.13  -0.03   0.13   0.07    0.15     0.09
## SSEI_SnE            -0.01   0.07  -0.06   0.11  -0.12  -0.10   -0.10    -0.08
## SSEI_Att            -0.18  -0.11  -0.31  -0.08  -0.20  -0.30   -0.30    -0.29
## SSEI_Con            -0.07  -0.07  -0.20  -0.02  -0.20  -0.18   -0.17    -0.22
## SSEI_Adapt          -0.01   0.01  -0.07   0.06  -0.14  -0.14   -0.09    -0.08
## SSEI_Mor            -0.01  -0.05  -0.03   0.03  -0.09  -0.04   -0.03    -0.06
## OverallEfficacy      0.08   0.05   0.00   0.11  -0.03  -0.05   -0.04     0.02
## SES_di               0.15   0.21   0.14   0.11   0.26   0.17    0.09     0.23
##                   RSQself RSQother derssum dersmean SCS_LackControl_r
## ACE.Sum             -0.25    -0.23    0.21     0.22              0.06
## CTQ_PA              -0.20    -0.13    0.08     0.11              0.05
## CTQ_EA              -0.38    -0.34    0.36     0.35              0.04
## CTQ_SA              -0.09    -0.18    0.06     0.11              0.01
## CTQ_PN              -0.26    -0.18    0.22     0.25             -0.08
## CTQ_EN              -0.31    -0.31    0.23     0.28              0.00
## CTQ_min             -0.33    -0.35    0.24     0.26             -0.01
## CTQtotal            -0.36    -0.32    0.31     0.31              0.03
## RSQself              1.00     0.54   -0.63    -0.62              0.11
## RSQother             0.54     1.00   -0.38    -0.36              0.08
## derssum             -0.63    -0.38    1.00     0.77             -0.06
## dersmean            -0.62    -0.36    0.77     1.00             -0.15
## SCS_LackControl_r    0.11     0.08   -0.06    -0.15              1.00
## SCS_PosAttitude     -0.08    -0.10    0.07    -0.03              0.52
## SCS_AwareDiscuss    -0.12    -0.08    0.20     0.11              0.23
## SSEI_SnE             0.28     0.21   -0.15    -0.25              0.25
## SSEI_Att             0.48     0.30   -0.39    -0.47              0.07
## SSEI_Con             0.40     0.30   -0.32    -0.37              0.26
## SSEI_Adapt           0.27     0.13   -0.18    -0.31              0.21
## SSEI_Mor             0.25     0.08   -0.25    -0.32              0.18
## OverallEfficacy      0.07    -0.02   -0.03    -0.17              0.36
## SES_di              -0.16    -0.10    0.16     0.16             -0.11
##                   SCS_PosAttitude SCS_AwareDiscuss SSEI_SnE SSEI_Att SSEI_Con
## ACE.Sum                      0.09             0.16    -0.01    -0.18    -0.07
## CTQ_PA                      -0.02             0.02     0.07    -0.11    -0.07
## CTQ_EA                       0.08             0.13    -0.06    -0.31    -0.20
## CTQ_SA                       0.02            -0.03     0.11    -0.08    -0.02
## CTQ_PN                      -0.07             0.13    -0.12    -0.20    -0.20
## CTQ_EN                       0.00             0.07    -0.10    -0.30    -0.18
## CTQ_min                      0.03             0.15    -0.10    -0.30    -0.17
## CTQtotal                     0.04             0.09    -0.08    -0.29    -0.22
## RSQself                     -0.08            -0.12     0.28     0.48     0.40
## RSQother                    -0.10            -0.08     0.21     0.30     0.30
## derssum                      0.07             0.20    -0.15    -0.39    -0.32
## dersmean                    -0.03             0.11    -0.25    -0.47    -0.37
## SCS_LackControl_r            0.52             0.23     0.25     0.07     0.26
## SCS_PosAttitude              1.00             0.35     0.08    -0.01     0.04
## SCS_AwareDiscuss             0.35             1.00     0.00    -0.11    -0.12
## SSEI_SnE                     0.08             0.00     1.00     0.41     0.54
## SSEI_Att                    -0.01            -0.11     0.41     1.00     0.45
## SSEI_Con                     0.04            -0.12     0.54     0.45     1.00
## SSEI_Adapt                   0.10             0.08     0.66     0.30     0.41
## SSEI_Mor                     0.12             0.17     0.33     0.26     0.38
## OverallEfficacy              0.42             0.22     0.27     0.16     0.21
## SES_di                       0.00             0.11     0.02    -0.15    -0.23
##                   SSEI_Adapt SSEI_Mor OverallEfficacy SES_di
## ACE.Sum                -0.01    -0.01            0.08   0.15
## CTQ_PA                  0.01    -0.05            0.05   0.21
## CTQ_EA                 -0.07    -0.03            0.00   0.14
## CTQ_SA                  0.06     0.03            0.11   0.11
## CTQ_PN                 -0.14    -0.09           -0.03   0.26
## CTQ_EN                 -0.14    -0.04           -0.05   0.17
## CTQ_min                -0.09    -0.03           -0.04   0.09
## CTQtotal               -0.08    -0.06            0.02   0.23
## RSQself                 0.27     0.25            0.07  -0.16
## RSQother                0.13     0.08           -0.02  -0.10
## derssum                -0.18    -0.25           -0.03   0.16
## dersmean               -0.31    -0.32           -0.17   0.16
## SCS_LackControl_r       0.21     0.18            0.36  -0.11
## SCS_PosAttitude         0.10     0.12            0.42   0.00
## SCS_AwareDiscuss        0.08     0.17            0.22   0.11
## SSEI_SnE                0.66     0.33            0.27   0.02
## SSEI_Att                0.30     0.26            0.16  -0.15
## SSEI_Con                0.41     0.38            0.21  -0.23
## SSEI_Adapt              1.00     0.52            0.29   0.03
## SSEI_Mor                0.52     1.00            0.35  -0.07
## OverallEfficacy         0.29     0.35            1.00  -0.01
## SES_di                  0.03    -0.07           -0.01   1.00
## 
## n
##                   ACE.Sum CTQ_PA CTQ_EA CTQ_SA CTQ_PN CTQ_EN CTQ_min CTQtotal
## ACE.Sum               329    329    329    329    329    329     329      294
## CTQ_PA                329    329    329    329    329    329     329      294
## CTQ_EA                329    329    329    329    329    329     329      294
## CTQ_SA                329    329    329    329    329    329     329      294
## CTQ_PN                329    329    329    329    329    329     329      294
## CTQ_EN                329    329    329    329    329    329     329      294
## CTQ_min               329    329    329    329    329    329     329      294
## CTQtotal              294    294    294    294    294    294     294      294
## RSQself               329    329    329    329    329    329     329      294
## RSQother              329    329    329    329    329    329     329      294
## derssum               283    283    283    283    283    283     283      260
## dersmean              329    329    329    329    329    329     329      294
## SCS_LackControl_r     329    329    329    329    329    329     329      294
## SCS_PosAttitude       329    329    329    329    329    329     329      294
## SCS_AwareDiscuss      325    325    325    325    325    325     325      291
## SSEI_SnE              329    329    329    329    329    329     329      294
## SSEI_Att              329    329    329    329    329    329     329      294
## SSEI_Con              329    329    329    329    329    329     329      294
## SSEI_Adapt            329    329    329    329    329    329     329      294
## SSEI_Mor              329    329    329    329    329    329     329      294
## OverallEfficacy       329    329    329    329    329    329     329      294
## SES_di                261    261    261    261    261    261     261      232
##                   RSQself RSQother derssum dersmean SCS_LackControl_r
## ACE.Sum               329      329     283      329               329
## CTQ_PA                329      329     283      329               329
## CTQ_EA                329      329     283      329               329
## CTQ_SA                329      329     283      329               329
## CTQ_PN                329      329     283      329               329
## CTQ_EN                329      329     283      329               329
## CTQ_min               329      329     283      329               329
## CTQtotal              294      294     260      294               294
## RSQself               329      329     283      329               329
## RSQother              329      329     283      329               329
## derssum               283      283     283      283               283
## dersmean              329      329     283      329               329
## SCS_LackControl_r     329      329     283      329               329
## SCS_PosAttitude       329      329     283      329               329
## SCS_AwareDiscuss      325      325     281      325               325
## SSEI_SnE              329      329     283      329               329
## SSEI_Att              329      329     283      329               329
## SSEI_Con              329      329     283      329               329
## SSEI_Adapt            329      329     283      329               329
## SSEI_Mor              329      329     283      329               329
## OverallEfficacy       329      329     283      329               329
## SES_di                261      261     221      261               261
##                   SCS_PosAttitude SCS_AwareDiscuss SSEI_SnE SSEI_Att SSEI_Con
## ACE.Sum                       329              325      329      329      329
## CTQ_PA                        329              325      329      329      329
## CTQ_EA                        329              325      329      329      329
## CTQ_SA                        329              325      329      329      329
## CTQ_PN                        329              325      329      329      329
## CTQ_EN                        329              325      329      329      329
## CTQ_min                       329              325      329      329      329
## CTQtotal                      294              291      294      294      294
## RSQself                       329              325      329      329      329
## RSQother                      329              325      329      329      329
## derssum                       283              281      283      283      283
## dersmean                      329              325      329      329      329
## SCS_LackControl_r             329              325      329      329      329
## SCS_PosAttitude               329              325      329      329      329
## SCS_AwareDiscuss              325              325      325      325      325
## SSEI_SnE                      329              325      329      329      329
## SSEI_Att                      329              325      329      329      329
## SSEI_Con                      329              325      329      329      329
## SSEI_Adapt                    329              325      329      329      329
## SSEI_Mor                      329              325      329      329      329
## OverallEfficacy               329              325      329      329      329
## SES_di                        261              257      261      261      261
##                   SSEI_Adapt SSEI_Mor OverallEfficacy SES_di
## ACE.Sum                  329      329             329    261
## CTQ_PA                   329      329             329    261
## CTQ_EA                   329      329             329    261
## CTQ_SA                   329      329             329    261
## CTQ_PN                   329      329             329    261
## CTQ_EN                   329      329             329    261
## CTQ_min                  329      329             329    261
## CTQtotal                 294      294             294    232
## RSQself                  329      329             329    261
## RSQother                 329      329             329    261
## derssum                  283      283             283    221
## dersmean                 329      329             329    261
## SCS_LackControl_r        329      329             329    261
## SCS_PosAttitude          329      329             329    261
## SCS_AwareDiscuss         325      325             325    257
## SSEI_SnE                 329      329             329    261
## SSEI_Att                 329      329             329    261
## SSEI_Con                 329      329             329    261
## SSEI_Adapt               329      329             329    261
## SSEI_Mor                 329      329             329    261
## OverallEfficacy          329      329             329    261
## SES_di                   261      261             261    261
## 
## P
##                   ACE.Sum CTQ_PA CTQ_EA CTQ_SA CTQ_PN CTQ_EN CTQ_min CTQtotal
## ACE.Sum                   0.0000 0.0000 0.0000 0.0000 0.0000 0.0000  0.0000  
## CTQ_PA            0.0000         0.0000 0.0000 0.0000 0.0000 0.0000  0.0000  
## CTQ_EA            0.0000  0.0000        0.0000 0.0000 0.0000 0.0000  0.0000  
## CTQ_SA            0.0000  0.0000 0.0000        0.0000 0.0000 0.0000  0.0000  
## CTQ_PN            0.0000  0.0000 0.0000 0.0000        0.0000 0.0000  0.0000  
## CTQ_EN            0.0000  0.0000 0.0000 0.0000 0.0000        0.0000  0.0000  
## CTQ_min           0.0000  0.0000 0.0000 0.0000 0.0000 0.0000         0.0000  
## CTQtotal          0.0000  0.0000 0.0000 0.0000 0.0000 0.0000 0.0000          
## RSQself           0.0000  0.0004 0.0000 0.1089 0.0000 0.0000 0.0000  0.0000  
## RSQother          0.0000  0.0195 0.0000 0.0014 0.0010 0.0000 0.0000  0.0000  
## derssum           0.0004  0.1776 0.0000 0.3248 0.0002 0.0000 0.0000  0.0000  
## dersmean          0.0000  0.0435 0.0000 0.0520 0.0000 0.0000 0.0000  0.0000  
## SCS_LackControl_r 0.3035  0.3245 0.4428 0.9133 0.1717 0.9779 0.9266  0.6438  
## SCS_PosAttitude   0.0991  0.7655 0.1593 0.6959 0.2133 0.9305 0.5380  0.5073  
## SCS_AwareDiscuss  0.0034  0.6540 0.0217 0.5424 0.0179 0.2118 0.0066  0.1317  
## SSEI_SnE          0.8559  0.1796 0.2935 0.0428 0.0283 0.0706 0.0785  0.1565  
## SSEI_Att          0.0014  0.0428 0.0000 0.1489 0.0004 0.0000 0.0000  0.0000  
## SSEI_Con          0.1765  0.2099 0.0003 0.7197 0.0003 0.0008 0.0017  0.0002  
## SSEI_Adapt        0.8485  0.9013 0.2187 0.2803 0.0110 0.0133 0.1039  0.1737  
## SSEI_Mor          0.8919  0.4086 0.5873 0.6497 0.0936 0.4439 0.6251  0.3302  
## OverallEfficacy   0.1260  0.4074 0.9954 0.0410 0.5591 0.3281 0.4307  0.7253  
## SES_di            0.0132  0.0007 0.0197 0.0823 0.0000 0.0064 0.1613  0.0004  
##                   RSQself RSQother derssum dersmean SCS_LackControl_r
## ACE.Sum           0.0000  0.0000   0.0004  0.0000   0.3035           
## CTQ_PA            0.0004  0.0195   0.1776  0.0435   0.3245           
## CTQ_EA            0.0000  0.0000   0.0000  0.0000   0.4428           
## CTQ_SA            0.1089  0.0014   0.3248  0.0520   0.9133           
## CTQ_PN            0.0000  0.0010   0.0002  0.0000   0.1717           
## CTQ_EN            0.0000  0.0000   0.0000  0.0000   0.9779           
## CTQ_min           0.0000  0.0000   0.0000  0.0000   0.9266           
## CTQtotal          0.0000  0.0000   0.0000  0.0000   0.6438           
## RSQself                   0.0000   0.0000  0.0000   0.0413           
## RSQother          0.0000           0.0000  0.0000   0.1703           
## derssum           0.0000  0.0000           0.0000   0.3010           
## dersmean          0.0000  0.0000   0.0000           0.0078           
## SCS_LackControl_r 0.0413  0.1703   0.3010  0.0078                    
## SCS_PosAttitude   0.1442  0.0695   0.2429  0.6083   0.0000           
## SCS_AwareDiscuss  0.0250  0.1532   0.0008  0.0392   0.0000           
## SSEI_SnE          0.0000  0.0000   0.0136  0.0000   0.0000           
## SSEI_Att          0.0000  0.0000   0.0000  0.0000   0.2389           
## SSEI_Con          0.0000  0.0000   0.0000  0.0000   0.0000           
## SSEI_Adapt        0.0000  0.0225   0.0018  0.0000   0.0001           
## SSEI_Mor          0.0000  0.1332   0.0000  0.0000   0.0012           
## OverallEfficacy   0.1883  0.7144   0.6231  0.0016   0.0000           
## SES_di            0.0096  0.1054   0.0180  0.0092   0.0647           
##                   SCS_PosAttitude SCS_AwareDiscuss SSEI_SnE SSEI_Att SSEI_Con
## ACE.Sum           0.0991          0.0034           0.8559   0.0014   0.1765  
## CTQ_PA            0.7655          0.6540           0.1796   0.0428   0.2099  
## CTQ_EA            0.1593          0.0217           0.2935   0.0000   0.0003  
## CTQ_SA            0.6959          0.5424           0.0428   0.1489   0.7197  
## CTQ_PN            0.2133          0.0179           0.0283   0.0004   0.0003  
## CTQ_EN            0.9305          0.2118           0.0706   0.0000   0.0008  
## CTQ_min           0.5380          0.0066           0.0785   0.0000   0.0017  
## CTQtotal          0.5073          0.1317           0.1565   0.0000   0.0002  
## RSQself           0.1442          0.0250           0.0000   0.0000   0.0000  
## RSQother          0.0695          0.1532           0.0000   0.0000   0.0000  
## derssum           0.2429          0.0008           0.0136   0.0000   0.0000  
## dersmean          0.6083          0.0392           0.0000   0.0000   0.0000  
## SCS_LackControl_r 0.0000          0.0000           0.0000   0.2389   0.0000  
## SCS_PosAttitude                   0.0000           0.1443   0.8132   0.4690  
## SCS_AwareDiscuss  0.0000                           0.9939   0.0438   0.0284  
## SSEI_SnE          0.1443          0.9939                    0.0000   0.0000  
## SSEI_Att          0.8132          0.0438           0.0000            0.0000  
## SSEI_Con          0.4690          0.0284           0.0000   0.0000           
## SSEI_Adapt        0.0853          0.1280           0.0000   0.0000   0.0000  
## SSEI_Mor          0.0332          0.0019           0.0000   0.0000   0.0000  
## OverallEfficacy   0.0000          0.0000           0.0000   0.0032   0.0002  
## SES_di            0.9958          0.0682           0.7995   0.0138   0.0001  
##                   SSEI_Adapt SSEI_Mor OverallEfficacy SES_di
## ACE.Sum           0.8485     0.8919   0.1260          0.0132
## CTQ_PA            0.9013     0.4086   0.4074          0.0007
## CTQ_EA            0.2187     0.5873   0.9954          0.0197
## CTQ_SA            0.2803     0.6497   0.0410          0.0823
## CTQ_PN            0.0110     0.0936   0.5591          0.0000
## CTQ_EN            0.0133     0.4439   0.3281          0.0064
## CTQ_min           0.1039     0.6251   0.4307          0.1613
## CTQtotal          0.1737     0.3302   0.7253          0.0004
## RSQself           0.0000     0.0000   0.1883          0.0096
## RSQother          0.0225     0.1332   0.7144          0.1054
## derssum           0.0018     0.0000   0.6231          0.0180
## dersmean          0.0000     0.0000   0.0016          0.0092
## SCS_LackControl_r 0.0001     0.0012   0.0000          0.0647
## SCS_PosAttitude   0.0853     0.0332   0.0000          0.9958
## SCS_AwareDiscuss  0.1280     0.0019   0.0000          0.0682
## SSEI_SnE          0.0000     0.0000   0.0000          0.7995
## SSEI_Att          0.0000     0.0000   0.0032          0.0138
## SSEI_Con          0.0000     0.0000   0.0002          0.0001
## SSEI_Adapt                   0.0000   0.0000          0.6582
## SSEI_Mor          0.0000              0.0000          0.2282
## OverallEfficacy   0.0000     0.0000                   0.8233
## SES_di            0.6582     0.2282   0.8233

Checking measurement model

data$SES_di<-as.numeric(data$SES_di)

#model 1 doesn't work with SEM even though it shows good measurement fit. This is because, for some unknown reasons (likely power issues), the SSEI subscales have negative covariances in the SEM model. 

model1<-'
   childhood=~ ACE.Sum+CTQtotal
  cogemo=~RSQself+RSQother+dersmean
  sexwb=~OverallEfficacy+
              SCS_LackControl_r
               + SCS_PosAttitude 
              +SSEI_SnE + SSEI_Att + SSEI_Con+SSEI_Adapt+SSEI_Mor
             #+SES_di 
  SSEI_SnE ~~SSEI_Att + SSEI_Con+SSEI_Adapt+SSEI_Mor+SCS_LackControl_r 
  SSEI_Att ~~SSEI_Con+SSEI_Adapt+SSEI_Mor 
  SSEI_Con~~SSEI_Adapt+SSEI_Mor+SCS_LackControl_r  
  SSEI_Adapt~~SSEI_Mor  
  SCS_LackControl_r~~SCS_PosAttitude 
  OverallEfficacy~~ SCS_PosAttitude
        '

#Model 2 has acceptable measurement properties and fit in the SEM
model2<-'
  childhood=~ACE.Sum
  cogemo=~RSQself+RSQother+dersmean
  sexwb=~OverallEfficacy+
              SCS_LackControl_r
               + SCS_PosAttitude 
              +SSEI_SnE + SSEI_Att + SSEI_Con+SSEI_Adapt+SSEI_Mor
              +SES_di 
  SSEI_SnE ~~SSEI_Att + SSEI_Con+SSEI_Adapt+SCS_LackControl_r 
  SSEI_Adapt~~SSEI_Mor  
   SCS_LackControl_r~~SCS_PosAttitude 
   OverallEfficacy~~ SCS_PosAttitude+SCS_LackControl_r 
        '
   
fit <- cfa(model2, data=data
            
           
          #           , se="bootstrap"
           # , bootstrap=1000, check.gradient = FALSE
           )
summary(fit, standardized=T, fit.measures=T)
## lavaan 0.6-11 ended normally after 77 iterations
## 
##   Estimator                                         ML
##   Optimization method                           NLMINB
##   Number of model parameters                        36
##                                                       
##                                                   Used       Total
##   Number of observations                           261         329
##                                                                   
## Model Test User Model:
##                                                       
##   Test statistic                               125.290
##   Degrees of freedom                                55
##   P-value (Chi-square)                           0.000
## 
## Model Test Baseline Model:
## 
##   Test statistic                              1027.353
##   Degrees of freedom                                78
##   P-value                                        0.000
## 
## User Model versus Baseline Model:
## 
##   Comparative Fit Index (CFI)                    0.926
##   Tucker-Lewis Index (TLI)                       0.895
## 
## Loglikelihood and Information Criteria:
## 
##   Loglikelihood user model (H0)              -4896.546
##   Loglikelihood unrestricted model (H1)      -4833.901
##                                                       
##   Akaike (AIC)                                9865.092
##   Bayesian (BIC)                              9993.415
##   Sample-size adjusted Bayesian (BIC)         9879.279
## 
## Root Mean Square Error of Approximation:
## 
##   RMSEA                                          0.070
##   90 Percent confidence interval - lower         0.054
##   90 Percent confidence interval - upper         0.086
##   P-value RMSEA <= 0.05                          0.023
## 
## Standardized Root Mean Square Residual:
## 
##   SRMR                                           0.069
## 
## Parameter Estimates:
## 
##   Standard errors                             Standard
##   Information                                 Expected
##   Information saturated (h1) model          Structured
## 
## Latent Variables:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##   childhood =~                                                          
##     ACE.Sum           1.000                               2.325    1.000
##   cogemo =~                                                             
##     RSQself           1.000                               2.204    0.864
##     RSQother          0.464    0.054    8.662    0.000    1.022    0.569
##     dersmean         -0.235    0.021  -10.953    0.000   -0.517   -0.736
##   sexwb =~                                                              
##     OverallEfficcy    1.000                               0.282    0.340
##     SCS_LckCntrl_r    1.266    0.330    3.841    0.000    0.357    0.287
##     SCS_PosAttitud   -0.229    0.382   -0.601    0.548   -0.065   -0.046
##     SSEI_SnE          2.019    0.482    4.190    0.000    0.569    0.537
##     SSEI_Att          2.911    0.656    4.439    0.000    0.820    0.607
##     SSEI_Con          2.609    0.574    4.547    0.000    0.735    0.680
##     SSEI_Adapt        1.447    0.344    4.212    0.000    0.408    0.509
##     SSEI_Mor          2.066    0.492    4.195    0.000    0.582    0.505
##     SES_di           -0.398    0.146   -2.723    0.006   -0.112   -0.227
## 
## Covariances:
##                        Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##  .SSEI_SnE ~~                                                               
##    .SSEI_Att              0.120    0.061    1.971    0.049    0.120    0.125
##    .SSEI_Con              0.169    0.053    3.219    0.001    0.169    0.239
##    .SSEI_Adapt            0.309    0.043    7.228    0.000    0.309    0.501
##  .SCS_LackControl_r ~~                                                      
##    .SSEI_SnE              0.000    0.047    0.003    0.997    0.000    0.000
##  .SSEI_Adapt ~~                                                             
##    .SSEI_Mor              0.228    0.045    5.016    0.000    0.228    0.332
##  .SCS_LackControl_r ~~                                                      
##    .SCS_PosAttitud        0.904    0.119    7.625    0.000    0.904    0.543
##  .OverallEfficacy ~~                                                        
##    .SCS_PosAttitud        0.483    0.075    6.431    0.000    0.483    0.443
##    .SCS_LckCntrl_r        0.295    0.063    4.661    0.000    0.295    0.317
##   childhood ~~                                                              
##     cogemo               -1.355    0.362   -3.741    0.000   -0.264   -0.264
##     sexwb                -0.038    0.049   -0.782    0.434   -0.059   -0.059
##   cogemo ~~                                                                 
##     sexwb                 0.435    0.104    4.192    0.000    0.700    0.700
## 
## Variances:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##    .ACE.Sum           0.000                               0.000    0.000
##    .RSQself           1.647    0.360    4.574    0.000    1.647    0.253
##    .RSQother          2.185    0.212   10.303    0.000    2.185    0.677
##    .dersmean          0.226    0.027    8.234    0.000    0.226    0.458
##    .OverallEfficcy    0.608    0.056   10.899    0.000    0.608    0.885
##    .SCS_LckCntrl_r    1.419    0.128   11.058    0.000    1.419    0.918
##    .SCS_PosAttitud    1.956    0.171   11.415    0.000    1.956    0.998
##    .SSEI_SnE          0.800    0.084    9.572    0.000    0.800    0.712
##    .SSEI_Att          1.152    0.126    9.148    0.000    1.152    0.631
##    .SSEI_Con          0.628    0.078    8.058    0.000    0.628    0.538
##    .SSEI_Adapt        0.475    0.045   10.487    0.000    0.475    0.741
##    .SSEI_Mor          0.989    0.098   10.069    0.000    0.989    0.745
##    .SES_di            0.230    0.021   11.218    0.000    0.230    0.948
##     childhood         5.407    0.473   11.424    0.000    1.000    1.000
##     cogemo            4.858    0.642    7.565    0.000    1.000    1.000
##     sexwb             0.079    0.033    2.430    0.015    1.000    1.000

Structural equation model

Here is the model. As we can see above, most correlations were significant. However, it is not good to include all correlations in our model. We should only add correlation for residuals if we believe that theoretically they are related or if we believe that the latent model cannot account for those correlations. In this analysis, I only included subscales as residual correlates and significant, large correlations. (And actually, technically speaking, including residual correlations of subscales are not ideal... because we assume they are accounted for in the measurement model, but things are usually not that perfect)

See more https://pdfs.semanticscholar.org/df3d/7d8f2a3177b1146ee155ccbb936330c68fe0.pdf

Model without SES as an indicator of sexual well-being

model<-'
  #measurement model
   childhood=~ ACE.Sum+CTQtotal
  #             +CTQ_PA+CTQ_EA
  #            +CTQ_SA
  #            +CTQ_PN+CTQ_EN
  #            +CTQ_min
  #childhood=~ACE1+ACE2+ACE3+ACE4+ACE5+ACE6+ACE7+ACE8+ACE9+ACE10
  cogemo=~RSQself+RSQother+dersmean
   sexwb=~OverallEfficacy+
              SCS_LackControl_r
               + SCS_PosAttitude 
              +SSEI_SnE + SSEI_Att + SSEI_Con+SSEI_Adapt+SSEI_Mor
             #+SES_di 





  #regression
  sexwb~c1*childhood+b1*cogemo+sex
  #+b2*SES_di
  cogemo~a*childhood+sex 
  #SES_di~a2*childhood+sex


  #residual correlations
  SSEI_SnE ~~SSEI_Att + SSEI_Con+SSEI_Adapt+SSEI_Mor+SCS_LackControl_r 
  SSEI_Att ~~SSEI_Con+SSEI_Adapt+SSEI_Mor 
  SSEI_Con~~SSEI_Adapt+SSEI_Mor+SCS_LackControl_r  
  SSEI_Adapt~~SSEI_Mor  
  SCS_LackControl_r~~SCS_PosAttitude 
  OverallEfficacy~~ SCS_PosAttitude

  #mediation
  indirect:=a*b1
  total:=c1+a*b1

        '


fit <- sem(model, data=data
           # , se="bootstrap"
          #  , bootstrap=1000, check.gradient = FALSE
           )
## Warning in lav_object_post_check(object): lavaan WARNING: some estimated ov
## variances are negative
summary(fit, standardized=T, fit.measures=T) 
## lavaan 0.6-11 ended normally after 105 iterations
## 
##   Estimator                                         ML
##   Optimization method                           NLMINB
##   Number of model parameters                        45
##                                                       
##                                                   Used       Total
##   Number of observations                           294         329
##                                                                   
## Model Test User Model:
##                                                       
##   Test statistic                               155.423
##   Degrees of freedom                                59
##   P-value (Chi-square)                           0.000
## 
## Model Test Baseline Model:
## 
##   Test statistic                              1433.823
##   Degrees of freedom                                91
##   P-value                                        0.000
## 
## User Model versus Baseline Model:
## 
##   Comparative Fit Index (CFI)                    0.928
##   Tucker-Lewis Index (TLI)                       0.889
## 
## Loglikelihood and Information Criteria:
## 
##   Loglikelihood user model (H0)              -5379.739
##   Loglikelihood unrestricted model (H1)      -5302.028
##                                                       
##   Akaike (AIC)                               10849.478
##   Bayesian (BIC)                             11015.239
##   Sample-size adjusted Bayesian (BIC)        10872.531
## 
## Root Mean Square Error of Approximation:
## 
##   RMSEA                                          0.075
##   90 Percent confidence interval - lower         0.060
##   90 Percent confidence interval - upper         0.089
##   P-value RMSEA <= 0.05                          0.003
## 
## Standardized Root Mean Square Residual:
## 
##   SRMR                                           0.072
## 
## Parameter Estimates:
## 
##   Standard errors                             Standard
##   Information                                 Expected
##   Information saturated (h1) model          Structured
## 
## Latent Variables:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##   childhood =~                                                          
##     ACE.Sum           1.000                               1.454    0.697
##     CTQtotal          0.347    0.054    6.433    0.000    0.504    1.030
##   cogemo =~                                                             
##     RSQself           1.000                               2.278    0.848
##     RSQother          0.447    0.048    9.394    0.000    1.018    0.574
##     dersmean         -0.229    0.019  -12.036    0.000   -0.521   -0.740
##   sexwb =~                                                              
##     OverallEfficcy    1.000                               0.254    0.293
##     SCS_LckCntrl_r    0.947    0.366    2.591    0.010    0.241    0.195
##     SCS_PosAttitud    0.042    0.337    0.124    0.901    0.011    0.008
##     SSEI_SnE          2.294    0.653    3.514    0.000    0.583    0.540
##     SSEI_Att          4.072    1.082    3.765    0.000    1.035    0.766
##     SSEI_Con          2.902    0.786    3.694    0.000    0.738    0.689
##     SSEI_Adapt        1.836    0.518    3.545    0.000    0.467    0.581
##     SSEI_Mor          2.414    0.693    3.483    0.000    0.613    0.546
## 
## Regressions:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##   sexwb ~                                                               
##     childhood (c1)    0.002    0.010    0.188    0.851    0.011    0.011
##     cogemo    (b1)    0.077    0.021    3.632    0.000    0.694    0.694
##     sex               0.055    0.033    1.671    0.095    0.216    0.098
##   cogemo ~                                                              
##     childhood  (a)   -0.642    0.100   -6.424    0.000   -0.409   -0.409
##     sex               0.810    0.298    2.723    0.006    0.356    0.162
## 
## Covariances:
##                        Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##  .SSEI_SnE ~~                                                               
##    .SSEI_Att              0.043    0.125    0.346    0.729    0.043    0.055
##    .SSEI_Con              0.232    0.099    2.350    0.019    0.232    0.330
##    .SSEI_Adapt            0.279    0.071    3.939    0.000    0.279    0.470
##    .SSEI_Mor              0.033    0.089    0.375    0.708    0.033    0.039
##  .SCS_LackControl_r ~~                                                      
##    .SSEI_SnE              0.145    0.052    2.781    0.005    0.145    0.132
##  .SSEI_Att ~~                                                               
##    .SSEI_Con             -0.134    0.143   -0.934    0.350   -0.134   -0.199
##    .SSEI_Adapt           -0.153    0.098   -1.569    0.117   -0.153   -0.270
##    .SSEI_Mor             -0.240    0.132   -1.825    0.068   -0.240   -0.294
##  .SSEI_Con ~~                                                               
##    .SSEI_Adapt            0.012    0.074    0.168    0.867    0.012    0.024
##    .SSEI_Mor             -0.003    0.099   -0.034    0.973   -0.003   -0.005
##  .SCS_LackControl_r ~~                                                      
##    .SSEI_Con              0.119    0.061    1.949    0.051    0.119    0.127
##  .SSEI_Adapt ~~                                                             
##    .SSEI_Mor              0.187    0.074    2.534    0.011    0.187    0.304
##  .SCS_LackControl_r ~~                                                      
##    .SCS_PosAttitud        0.699    0.099    7.054    0.000    0.699    0.422
##  .OverallEfficacy ~~                                                        
##    .SCS_PosAttitud        0.369    0.064    5.748    0.000    0.369    0.325
## 
## Variances:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##    .ACE.Sum           2.243    0.355    6.319    0.000    2.243    0.515
##    .CTQtotal         -0.014    0.036   -0.396    0.692   -0.014   -0.060
##    .RSQself           2.034    0.352    5.776    0.000    2.034    0.281
##    .RSQother          2.102    0.192   10.925    0.000    2.102    0.670
##    .dersmean          0.225    0.025    8.917    0.000    0.225    0.453
##    .OverallEfficcy    0.686    0.058   11.803    0.000    0.686    0.914
##    .SCS_LckCntrl_r    1.462    0.121   12.076    0.000    1.462    0.962
##    .SCS_PosAttitud    1.879    0.152   12.356    0.000    1.879    1.000
##    .SSEI_SnE          0.827    0.107    7.732    0.000    0.827    0.709
##    .SSEI_Att          0.754    0.220    3.427    0.001    0.754    0.413
##    .SSEI_Con          0.601    0.126    4.772    0.000    0.601    0.525
##    .SSEI_Adapt        0.427    0.063    6.765    0.000    0.427    0.662
##    .SSEI_Mor          0.888    0.120    7.396    0.000    0.888    0.702
##     childhood         2.114    0.432    4.892    0.000    1.000    1.000
##    .cogemo            4.185    0.563    7.430    0.000    0.806    0.806
##    .sexwb             0.032    0.014    2.317    0.020    0.493    0.493
## 
## Defined Parameters:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##     indirect         -0.050    0.015   -3.204    0.001   -0.284   -0.284
##     total            -0.048    0.016   -2.969    0.003   -0.273   -0.273

Model with SES as an indicator of sexual well-being

model3<-'
  #measurement model
   childhood=~ ACE.Sum+CTQtotal
  #             +CTQ_PA+CTQ_EA
  #            +CTQ_SA
  #            +CTQ_PN+CTQ_EN
  #            +CTQ_min
  #childhood=~ACE1+ACE2+ACE3+ACE4+ACE5+ACE6+ACE7+ACE8+ACE9+ACE10
  cogemo=~RSQself+RSQother+dersmean
  sexwb=~
              SCS_LackControl_r
               + SCS_PosAttitude 
              +SSEI_SnE + SSEI_Att + SSEI_Con+SSEI_Adapt+SSEI_Mor
              +OverallEfficacy
               +SES_di
  #regression
  sexwb~c1*childhood+b1*cogemo+sex
  cogemo~a*childhood+sex

  #residual correlations
  SSEI_SnE ~~SSEI_Att + SSEI_Con+SSEI_Adapt+SCS_LackControl_r 
  SSEI_Adapt~~SSEI_Mor  
   SCS_LackControl_r~~SCS_PosAttitude 
   OverallEfficacy~~ SCS_PosAttitude+SCS_LackControl_r 
  ACE.Sum~~CTQtotal
  
  #mediation
  indirect_consent:=a*b1
  total:=c1+a*b1

        '


fit2 <- sem(model3, data=data
          #  , se="bootstrap", bootstrap=1000, check.gradient = FALSE
           )
## Warning in lav_model_vcov(lavmodel = lavmodel, lavsamplestats = lavsamplestats, : lavaan WARNING:
##     Could not compute standard errors! The information matrix could
##     not be inverted. This may be a symptom that the model is not
##     identified.
summary(fit2, standardized=T, fit.measures=T) 
## lavaan 0.6-11 ended normally after 91 iterations
## 
##   Estimator                                         ML
##   Optimization method                           NLMINB
##   Number of model parameters                        42
##                                                       
##                                                   Used       Total
##   Number of observations                           232         329
##                                                                   
## Model Test User Model:
##                                                       
##   Test statistic                               171.806
##   Degrees of freedom                                77
##   P-value (Chi-square)                           0.000
## 
## Model Test Baseline Model:
## 
##   Test statistic                              1185.911
##   Degrees of freedom                               105
##   P-value                                        0.000
## 
## User Model versus Baseline Model:
## 
##   Comparative Fit Index (CFI)                    0.912
##   Tucker-Lewis Index (TLI)                       0.880
## 
## Loglikelihood and Information Criteria:
## 
##   Loglikelihood user model (H0)              -4432.453
##   Loglikelihood unrestricted model (H1)      -4346.551
##                                                       
##   Akaike (AIC)                                8948.907
##   Bayesian (BIC)                              9093.670
##   Sample-size adjusted Bayesian (BIC)         8960.552
## 
## Root Mean Square Error of Approximation:
## 
##   RMSEA                                          0.073
##   90 Percent confidence interval - lower         0.058
##   90 Percent confidence interval - upper         0.087
##   P-value RMSEA <= 0.05                          0.006
## 
## Standardized Root Mean Square Residual:
## 
##   SRMR                                           0.078
## 
## Parameter Estimates:
## 
##   Standard errors                             Standard
##   Information                                 Expected
##   Information saturated (h1) model          Structured
## 
## Latent Variables:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##   childhood =~                                                          
##     ACE.Sum           1.000                               0.911    0.409
##     CTQtotal          0.347       NA                      0.317    0.606
##   cogemo =~                                                             
##     RSQself           1.000                               2.237    0.859
##     RSQother          0.469       NA                      1.049    0.582
##     dersmean         -0.243       NA                     -0.544   -0.752
##   sexwb =~                                                              
##     SCS_LckCntrl_r    1.000                               0.313    0.251
##     SCS_PosAttitud   -0.464       NA                     -0.145   -0.102
##     SSEI_SnE          1.753       NA                      0.549    0.521
##     SSEI_Att          2.579       NA                      0.808    0.604
##     SSEI_Con          2.221       NA                      0.695    0.641
##     SSEI_Adapt        1.343       NA                      0.421    0.529
##     SSEI_Mor          1.851       NA                      0.580    0.499
##     OverallEfficcy    0.809       NA                      0.253    0.301
##     SES_di           -0.414       NA                     -0.130   -0.263
## 
## Regressions:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##   sexwb ~                                                               
##     childhood (c1)    0.041       NA                      0.120    0.120
##     cogemo    (b1)    0.118       NA                      0.840    0.840
##     sex              -0.074       NA                     -0.235   -0.075
##   cogemo ~                                                              
##     childhood  (a)   -1.736       NA                     -0.707   -0.707
##     sex               0.625       NA                      0.279    0.090
## 
## Covariances:
##                        Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##  .SSEI_SnE ~~                                                               
##    .SSEI_Att              0.165       NA                      0.165    0.172
##    .SSEI_Con              0.239       NA                      0.239    0.320
##    .SSEI_Adapt            0.282       NA                      0.282    0.465
##  .SCS_LackControl_r ~~                                                      
##    .SSEI_SnE              0.012       NA                      0.012    0.011
##  .SSEI_Adapt ~~                                                             
##    .SSEI_Mor              0.235       NA                      0.235    0.346
##  .SCS_LackControl_r ~~                                                      
##    .SCS_PosAttitud        0.891       NA                      0.891    0.521
##  .SCS_PosAttitude ~~                                                        
##    .OverallEfficcy        0.510       NA                      0.510    0.448
##  .SCS_LackControl_r ~~                                                      
##    .OverallEfficcy        0.294       NA                      0.294    0.303
##  .ACE.Sum ~~                                                                
##    .CTQtotal              0.567       NA                      0.567    0.671
## 
## Variances:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##    .ACE.Sum           4.138       NA                      4.138    0.833
##    .CTQtotal          0.172       NA                      0.172    0.632
##    .RSQself           1.778       NA                      1.778    0.262
##    .RSQother          2.147       NA                      2.147    0.661
##    .dersmean          0.227       NA                      0.227    0.434
##    .SCS_LckCntrl_r    1.457       NA                      1.457    0.937
##    .SCS_PosAttitud    2.013       NA                      2.013    0.990
##    .SSEI_SnE          0.808       NA                      0.808    0.728
##    .SSEI_Att          1.136       NA                      1.136    0.635
##    .SSEI_Con          0.692       NA                      0.692    0.589
##    .SSEI_Adapt        0.455       NA                      0.455    0.720
##    .SSEI_Mor          1.015       NA                      1.015    0.751
##    .OverallEfficcy    0.643       NA                      0.643    0.909
##    .SES_di            0.226       NA                      0.226    0.931
##     childhood         0.830       NA                      1.000    1.000
##    .cogemo            2.461       NA                      0.492    0.492
##    .sexwb             0.042       NA                      0.429    0.429
## 
## Defined Parameters:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##     indirect_cnsnt   -0.204                              -0.594   -0.594
##     total            -0.163                              -0.473   -0.473