Appendix

##########

#Analysis

##########

 

#Clear workspace (run if desired) 

rm(list = ls())

 

#List of project directories

dirs <- list(

  data = "...",

  analysis = "...")

 

#Load required packages

if (!require(psych))  { install.packages("psych") } ;  library(psych)

if (!require(lavaan)) { install.packages("lavaan") } ; library(lavaan)

if (!require(semTools)) { install.packages("semTools") } ; library(semTools)

if (!require(MplusAutomation)) { install.packages("MplusAutomation") } ; library(MplusAutomation)

 

#Load dataset

load(paste0(dirs$data, "KSA3.Rda"))

 

#########################################################################

 

###########################

#Step 1: Measurement model

###########################

 

#Split dataset between countries

KSA3_D <- subset(KSA3, subset=(COUN=="1"))

KSA3_UK <- subset(KSA3, subset=(COUN=="2"))

 

#Test model

KSA3_MM <- 'AAGG =~ AAGG1 + AAGG2 + AAGG3

            ASUB =~ ASUB1 + ASUB2 + ASUB3

            CONV =~ CONV1 + CONV2 + CONV3

            KSA =~ AAGG + ASUB + CONV'

 

KSA3_MM.fit <- sem(KSA3_MM, data = KSA3_D, estimator = "mlr", missing = "fiml", std.lv = TRUE)

summary(KSA3_MM.fit, standardized = TRUE, fit.measures = TRUE)

 

KSA3_MM.fit <- sem(KSA3_MM, data = KSA3_UK, estimator = "mlr", missing = "fiml", std.lv = TRUE)

summary(KSA3_MM.fit, standardized = TRUE, fit.measures = TRUE)

 

#EFA in Mplus

prepareMplusData(df = KSA3_D, filename = "EFA_D.dat", inpfile = TRUE,

                 keepCols = c("AAGG1", "AAGG2", "AAGG3","ASUB1", "ASUB2", "ASUB3", "CONV1", "CONV2", "CONV3"))

prepareMplusData(df = KSA3_UK, filename = "EFA_UK.dat", inpfile = TRUE,

                 keepCols = c("AAGG1", "AAGG2", "AAGG3","ASUB1", "ASUB2", "ASUB3", "CONV1", "CONV2", "CONV3"))

# #Mplus code

# TITLE:

#   EFA (oblique);

#

# DATA:

#   FILE = "EFA_D.dat";

#

# VARIABLE:

#   NAMES = AAGG1 AAGG2 AAGG3 ASUB1 ASUB2 ASUB3 CONV1 CONV2 CONV3;

#   USEVARIABLES = AAGG1-CONV3;

#

# ANALYSIS:

#   ESTIMATOR = MLR;

#   TYPE = EFA 1 3;

#

# OUTPUT:

#   MODINDICES;

 

#Final model

KSA3_MM <- 'AAGG =~ AAGG1 + AAGG2 + AAGG3 + ASUB1

            ASUB =~ ASUB2 + ASUB3

            CONV =~ CONV1 + CONV2 + CONV3

            KSA =~ AAGG + ASUB + CONV'

 

KSA3_MM.fit <- sem(KSA3_MM, data = KSA3_D, estimator = "mlr", missing = "fiml", std.lv = TRUE)

summary(KSA3_MM.fit, standardized = TRUE, fit.measures = TRUE)

 

KSA3_MM.fit <- sem(KSA3_MM, data = KSA3_UK, estimator = "mlr", missing = "fiml", std.lv = TRUE)

summary(KSA3_MM.fit, standardized = TRUE, fit.measures = TRUE)

 

KSA3_MM.fit <- sem(KSA3_MM, data = KSA3, group = "COUN", estimator = "mlr", missing = "fiml", std.lv = TRUE)

summary(KSA3_MM.fit, standardized = TRUE, fit.measures = TRUE)

 

#########################################################################

 

#######################################

#Step 2: Scale values and correlations

#######################################

 

##Germany

 

attach(KSA3_D)

 

describe((AAGG1+AAGG2+AAGG3+ASUB1)/4)

describe((ASUB2+ASUB3)/2)

describe((CONV1+CONV2+CONV3)/3)

describe((((AAGG1+AAGG2+AAGG3+ASUB1)/4)+((ASUB2+ASUB3)/2)+((CONV1+CONV2+CONV3)/3))/3)

describe(AAGG1)

describe(AAGG2)

describe(AAGG3)

describe(ASUB1)

describe(ASUB2)

describe(ASUB3)

describe(CONV1)

describe(CONV2)

describe(CONV3)

 

AAGG <- AAGG1+AAGG2+AAGG3+ASUB1

ASUB <- ASUB2+ASUB3

CONV <- CONV1+CONV2+CONV3

 

cor.test(AAGG, ASUB, use = "pairwise.complete.obs")

cor.test(AAGG, CONV, use = "pairwise.complete.obs")

cor.test(ASUB, CONV, use = "pairwise.complete.obs")

 

cor.test(AAGG1, AAGG2, use = "pairwise.complete.obs")

cor.test(AAGG1, AAGG3, use = "pairwise.complete.obs")

cor.test(AAGG2, AAGG3, use = "pairwise.complete.obs")

 

cor.test(ASUB1, ASUB2, use = "pairwise.complete.obs")

cor.test(ASUB1, ASUB3, use = "pairwise.complete.obs")

cor.test(ASUB2, ASUB3, use = "pairwise.complete.obs")

 

cor.test(CONV1, CONV2, use = "pairwise.complete.obs")

cor.test(CONV1, CONV3, use = "pairwise.complete.obs")

cor.test(CONV2, CONV3, use = "pairwise.complete.obs")

 

cor.test(AAGG1, ASUB1, use = "pairwise.complete.obs")

cor.test(AAGG1, ASUB2, use = "pairwise.complete.obs")

cor.test(AAGG1, ASUB3, use = "pairwise.complete.obs")

cor.test(AAGG1, CONV1, use = "pairwise.complete.obs")

cor.test(AAGG1, CONV2, use = "pairwise.complete.obs")

cor.test(AAGG1, CONV3, use = "pairwise.complete.obs")

 

cor.test(AAGG2, ASUB1, use = "pairwise.complete.obs")

cor.test(AAGG2, ASUB2, use = "pairwise.complete.obs")

cor.test(AAGG2, ASUB3, use = "pairwise.complete.obs")

cor.test(AAGG2, CONV1, use = "pairwise.complete.obs")

cor.test(AAGG2, CONV2, use = "pairwise.complete.obs")

cor.test(AAGG2, CONV3, use = "pairwise.complete.obs")

 

cor.test(AAGG3, ASUB1, use = "pairwise.complete.obs")

cor.test(AAGG3, ASUB2, use = "pairwise.complete.obs")

cor.test(AAGG3, ASUB3, use = "pairwise.complete.obs")

cor.test(AAGG3, CONV1, use = "pairwise.complete.obs")

cor.test(AAGG3, CONV2, use = "pairwise.complete.obs")

cor.test(AAGG3, CONV3, use = "pairwise.complete.obs")

 

cor.test(ASUB1, CONV1, use = "pairwise.complete.obs")

cor.test(ASUB1, CONV2, use = "pairwise.complete.obs")

cor.test(ASUB1, CONV3, use = "pairwise.complete.obs")

 

cor.test(ASUB2, CONV1, use = "pairwise.complete.obs")

cor.test(ASUB2, CONV2, use = "pairwise.complete.obs")

cor.test(ASUB2, CONV3, use = "pairwise.complete.obs")

 

cor.test(ASUB3, CONV1, use = "pairwise.complete.obs")

cor.test(ASUB3, CONV2, use = "pairwise.complete.obs")

cor.test(ASUB3, CONV3, use = "pairwise.complete.obs")

 

detach(KSA3_D)

 

#########################################################################

 

##UK

 

attach(KSA3_UK)

 

describe((AAGG1+AAGG2+AAGG3+ASUB1)/4)

describe((ASUB2+ASUB3)/2)

describe((CONV1+CONV2+CONV3)/3)

describe((((AAGG1+AAGG2+AAGG3+ASUB1)/4)+((ASUB2+ASUB3)/2)+((CONV1+CONV2+CONV3)/3))/3)

describe(AAGG1)

describe(AAGG2)

describe(AAGG3)

describe(ASUB1)

describe(ASUB2)

describe(ASUB3)

describe(CONV1)

describe(CONV2)

describe(CONV3)

 

AAGG <- AAGG1+AAGG2+AAGG3+ASUB1

ASUB <- ASUB2+ASUB3

CONV <- CONV1+CONV2+CONV3

 

cor.test(AAGG, ASUB, use = "pairwise.complete.obs")

cor.test(AAGG, CONV, use = "pairwise.complete.obs")

cor.test(ASUB, CONV, use = "pairwise.complete.obs")

 

cor.test(AAGG1, AAGG2, use = "pairwise.complete.obs")

cor.test(AAGG1, AAGG3, use = "pairwise.complete.obs")

cor.test(AAGG2, AAGG3, use = "pairwise.complete.obs")

 

cor.test(ASUB1, ASUB2, use = "pairwise.complete.obs")

cor.test(ASUB1, ASUB3, use = "pairwise.complete.obs")

cor.test(ASUB2, ASUB3, use = "pairwise.complete.obs")

 

cor.test(CONV1, CONV2, use = "pairwise.complete.obs")

cor.test(CONV1, CONV3, use = "pairwise.complete.obs")

cor.test(CONV2, CONV3, use = "pairwise.complete.obs")

 

cor.test(AAGG1, ASUB1, use = "pairwise.complete.obs")

cor.test(AAGG1, ASUB2, use = "pairwise.complete.obs")

cor.test(AAGG1, ASUB3, use = "pairwise.complete.obs")

cor.test(AAGG1, CONV1, use = "pairwise.complete.obs")

cor.test(AAGG1, CONV2, use = "pairwise.complete.obs")

cor.test(AAGG1, CONV3, use = "pairwise.complete.obs")

 

cor.test(AAGG2, ASUB1, use = "pairwise.complete.obs")

cor.test(AAGG2, ASUB2, use = "pairwise.complete.obs")

cor.test(AAGG2, ASUB3, use = "pairwise.complete.obs")

cor.test(AAGG2, CONV1, use = "pairwise.complete.obs")

cor.test(AAGG2, CONV2, use = "pairwise.complete.obs")

cor.test(AAGG2, CONV3, use = "pairwise.complete.obs")

 

cor.test(AAGG3, ASUB1, use = "pairwise.complete.obs")

cor.test(AAGG3, ASUB2, use = "pairwise.complete.obs")

cor.test(AAGG3, ASUB3, use = "pairwise.complete.obs")

cor.test(AAGG3, CONV1, use = "pairwise.complete.obs")

cor.test(AAGG3, CONV2, use = "pairwise.complete.obs")

cor.test(AAGG3, CONV3, use = "pairwise.complete.obs")

 

cor.test(ASUB1, CONV1, use = "pairwise.complete.obs")

cor.test(ASUB1, CONV2, use = "pairwise.complete.obs")

cor.test(ASUB1, CONV3, use = "pairwise.complete.obs")

 

cor.test(ASUB2, CONV1, use = "pairwise.complete.obs")

cor.test(ASUB2, CONV2, use = "pairwise.complete.obs")

cor.test(ASUB2, CONV3, use = "pairwise.complete.obs")

 

cor.test(ASUB3, CONV1, use = "pairwise.complete.obs")

cor.test(ASUB3, CONV2, use = "pairwise.complete.obs")

cor.test(ASUB3, CONV3, use = "pairwise.complete.obs")

 

detach(KSA3_UK)

 

#########################################################################

 

#####################

#Step 4: Reliability

#####################

 

##McDonald's omega

 

KSA3_MM.fit_D <- sem(KSA3_MM, data = KSA3_D, estimator = "mlr", missing = "fiml", std.lv = TRUE)

semTools::reliability(KSA3_MM.fit_D)

semTools::reliabilityL2(KSA3_MM.fit_D, "KSA")

 

KSA3_MM.fit_UK <- sem(KSA3_MM, data = KSA3_UK, estimator = "mlr", missing = "fiml", std.lv = TRUE)

semTools::reliability(KSA3_MM.fit_UK)

semTools::reliabilityL2(KSA3_MM.fit_UK, "KSA")

 

#########################################################################

 

##Retest reliability for Germany

 

attach(KSA3_D)

 

AAGG <- AAGG1+AAGG2+AAGG3+ASUB1

ASUB <- ASUB2+ASUB3

CONV <- CONV1+CONV2+CONV3

KSA <- AAGG+ASUB+CONV

AAGGrt <- AAGG1rt+AAGG2rt+AAGG3rt+ASUB1rt

ASUBrt <- ASUB2rt+ASUB3rt

CONVrt <- CONV1rt+CONV2rt+CONV3rt

KSArt <- AAGGrt+ASUBrt+CONVrt

cor.test(AAGG, AAGGrt, use = "pairwise.complete.obs")

cor.test(ASUB, ASUBrt, use = "pairwise.complete.obs")

cor.test(CONV, CONVrt, use = "pairwise.complete.obs")

cor.test(KSA, KSArt, use = "pairwise.complete.obs")

 

detach(KSA3_D)

 

#########################################################################

 

##Retest reliability for the UK

 

attach(KSA3_UK)

 

AAGG <- AAGG1+AAGG2+AAGG3+ASUB1

ASUB <- ASUB2+ASUB3

CONV <- CONV1+CONV2+CONV3

KSA <- AAGG+ASUB+CONV

AAGGrt <- AAGG1rt+AAGG2rt+AAGG3rt+ASUB1rt

ASUBrt <- ASUB2rt+ASUB3rt

CONVrt <- CONV1rt+CONV2rt+CONV3rt

KSArt <- AAGGrt+ASUBrt+CONVrt

cor.test(AAGG, AAGGrt, use = "pairwise.complete.obs")

cor.test(ASUB, ASUBrt, use = "pairwise.complete.obs")

cor.test(CONV, CONVrt, use = "pairwise.complete.obs")

cor.test(KSA, KSArt, use = "pairwise.complete.obs")

 

detach(KSA3_UK)

 

#########################################################################

 

##########################################

#Step 5: Construct and criterion validity

##########################################

 

##Germany

 

attach(KSA3_D)

 

#BFI-2-XS

EXTR <- EXTR1R+EXTR2+EXTR3

AGRE <- AGRE1+AGRE2R+AGRE3

CONS <- CONS1R+CONS2R+CONS3

NEGA <- NEGA1+NEGA2+NEGA3R

OPEN <- OPEN1+OPEN2R+OPEN3

 

AAGG <- (AAGG1+AAGG2+AAGG3+ASUB1)/4

ASUB <- (ASUB2+ASUB3)/2

CONV <- (CONV1+CONV2+CONV3)/3

KSA <- AAGG+ASUB+CONV

 

cor.test(AAGG, EXTR, use = "pairwise.complete.obs")

cor.test(ASUB, EXTR, use = "pairwise.complete.obs")

cor.test(CONV, EXTR, use = "pairwise.complete.obs")

cor.test(KSA, EXTR, use = "pairwise.complete.obs")

cor.test(AAGG, AGRE, use = "pairwise.complete.obs")

cor.test(ASUB, AGRE, use = "pairwise.complete.obs")

cor.test(CONV, AGRE, use = "pairwise.complete.obs")

cor.test(KSA, AGRE, use = "pairwise.complete.obs")

cor.test(AAGG, CONS, use = "pairwise.complete.obs")

cor.test(ASUB, CONS, use = "pairwise.complete.obs")

cor.test(CONV, CONS, use = "pairwise.complete.obs")

cor.test(KSA, CONS, use = "pairwise.complete.obs")

cor.test(AAGG, NEGA, use = "pairwise.complete.obs")

cor.test(ASUB, NEGA, use = "pairwise.complete.obs")

cor.test(CONV, NEGA, use = "pairwise.complete.obs")

cor.test(KSA, NEGA, use = "pairwise.complete.obs")

cor.test(AAGG, OPEN, use = "pairwise.complete.obs")

cor.test(ASUB, OPEN, use = "pairwise.complete.obs")

cor.test(CONV, OPEN, use = "pairwise.complete.obs")

cor.test(KSA, OPEN, use = "pairwise.complete.obs")

 

#Left-Right Placement

cor.test(AAGG, LRPL1, use = "pairwise.complete.obs")

cor.test(ASUB, LRPL1, use = "pairwise.complete.obs")

cor.test(CONV, LRPL1, use = "pairwise.complete.obs")

cor.test(KSA, LRPL1, use = "pairwise.complete.obs")

 

#Employment status

cor.test(AAGG, EMPL, use = "pairwise.complete.obs")

cor.test(ASUB, EMPL, use = "pairwise.complete.obs")

cor.test(CONV, EMPL, use = "pairwise.complete.obs")

cor.test(KSA, EMPL, use = "pairwise.complete.obs")

 

#Income

cor.test(AAGG, INCO, use = "pairwise.complete.obs")

cor.test(ASUB, INCO, use = "pairwise.complete.obs")

cor.test(CONV, INCO, use = "pairwise.complete.obs")

cor.test(KSA, INCO, use = "pairwise.complete.obs")

 

#Education

cor.test(AAGG, SCHO, use = "pairwise.complete.obs")

cor.test(ASUB, SCHO, use = "pairwise.complete.obs")

cor.test(CONV, SCHO, use = "pairwise.complete.obs")

cor.test(KSA, SCHO, use = "pairwise.complete.obs")

 

#Age

cor.test(AAGG, AGE, use = "pairwise.complete.obs")

cor.test(ASUB, AGE, use = "pairwise.complete.obs")

cor.test(CONV, AGE, use = "pairwise.complete.obs")

cor.test(KSA, AGE, use = "pairwise.complete.obs")

 

#Gender

cor.test(AAGG, SEX, use = "pairwise.complete.obs")

cor.test(ASUB, SEX, use = "pairwise.complete.obs")

cor.test(CONV, SEX, use = "pairwise.complete.obs")

cor.test(KSA, SEX, use = "pairwise.complete.obs")

 

#PEKS

IPEF <- IPEF1+IPEF2

EPEF <- EPEF1+EPEF2

 

cor.test(AAGG, IPEF, use = "pairwise.complete.obs")

cor.test(ASUB, IPEF, use = "pairwise.complete.obs")

cor.test(CONV, IPEF, use = "pairwise.complete.obs")

cor.test(KSA, IPEF, use = "pairwise.complete.obs")

cor.test(AAGG, EPEF, use = "pairwise.complete.obs")

cor.test(ASUB, EPEF, use = "pairwise.complete.obs")

cor.test(CONV, EPEF, use = "pairwise.complete.obs")

cor.test(KSA, EPEF, use = "pairwise.complete.obs")

 

#KSE-G

SDPQ <- SDPQ1+SDPQ2+SDPQ3

SDNQ <- SDNQ1+SDNQ2+SDNQ3

 

cor.test(AAGG, SDPQ, use = "pairwise.complete.obs")

cor.test(ASUB, SDPQ, use = "pairwise.complete.obs")

cor.test(CONV, SDPQ, use = "pairwise.complete.obs")

cor.test(KSA, SDPQ, use = "pairwise.complete.obs")

cor.test(AAGG, SDNQ, use = "pairwise.complete.obs")

cor.test(ASUB, SDNQ, use = "pairwise.complete.obs")

cor.test(CONV, SDNQ, use = "pairwise.complete.obs")

cor.test(KSA, SDNQ, use = "pairwise.complete.obs")

 

detach(KSA3_D)

 

#########################################################################

 

##UK

 

attach(KSA3_UK)

 

#BFI-2-XS

EXTR <- EXTR1R+EXTR2+EXTR3

AGRE <- AGRE1+AGRE2R+AGRE3

CONS <- CONS1R+CONS2R+CONS3

NEGA <- NEGA1+NEGA2+NEGA3R

OPEN <- OPEN1+OPEN2R+OPEN3

 

AAGG <- (AAGG1+AAGG2+AAGG3+ASUB1)/4

ASUB <- (ASUB2+ASUB3)/2

CONV <- (CONV1+CONV2+CONV3)/3

KSA <- AAGG+ASUB+CONV

 

cor.test(AAGG, EXTR, use = "pairwise.complete.obs")

cor.test(ASUB, EXTR, use = "pairwise.complete.obs")

cor.test(CONV, EXTR, use = "pairwise.complete.obs")

cor.test(KSA, EXTR, use = "pairwise.complete.obs")

cor.test(AAGG, AGRE, use = "pairwise.complete.obs")

cor.test(ASUB, AGRE, use = "pairwise.complete.obs")

cor.test(CONV, AGRE, use = "pairwise.complete.obs")

cor.test(KSA, AGRE, use = "pairwise.complete.obs")

cor.test(AAGG, CONS, use = "pairwise.complete.obs")

cor.test(ASUB, CONS, use = "pairwise.complete.obs")

cor.test(CONV, CONS, use = "pairwise.complete.obs")

cor.test(KSA, CONS, use = "pairwise.complete.obs")

cor.test(AAGG, NEGA, use = "pairwise.complete.obs")

cor.test(ASUB, NEGA, use = "pairwise.complete.obs")

cor.test(CONV, NEGA, use = "pairwise.complete.obs")

cor.test(KSA, NEGA, use = "pairwise.complete.obs")

cor.test(AAGG, OPEN, use = "pairwise.complete.obs")

cor.test(ASUB, OPEN, use = "pairwise.complete.obs")

cor.test(CONV, OPEN, use = "pairwise.complete.obs")

cor.test(KSA, OPEN, use = "pairwise.complete.obs")

 

#Left-Right Placement

cor.test(AAGG, LRPL1, use = "pairwise.complete.obs")

cor.test(ASUB, LRPL1, use = "pairwise.complete.obs")

cor.test(CONV, LRPL1, use = "pairwise.complete.obs")

cor.test(KSA, LRPL1, use = "pairwise.complete.obs")

 

#Employment status

cor.test(AAGG, EMPL, use = "pairwise.complete.obs")

cor.test(ASUB, EMPL, use = "pairwise.complete.obs")

cor.test(CONV, EMPL, use = "pairwise.complete.obs")

cor.test(KSA, EMPL, use = "pairwise.complete.obs")

 

#Income

cor.test(AAGG, INCO, use = "pairwise.complete.obs")

cor.test(ASUB, INCO, use = "pairwise.complete.obs")

cor.test(CONV, INCO, use = "pairwise.complete.obs")

cor.test(KSA, INCO, use = "pairwise.complete.obs")

 

#Education

cor.test(AAGG, SCHO, use = "pairwise.complete.obs")

cor.test(ASUB, SCHO, use = "pairwise.complete.obs")

cor.test(CONV, SCHO, use = "pairwise.complete.obs")

cor.test(KSA, SCHO, use = "pairwise.complete.obs")

 

#Age

cor.test(AAGG, AGE, use = "pairwise.complete.obs")

cor.test(ASUB, AGE, use = "pairwise.complete.obs")

cor.test(CONV, AGE, use = "pairwise.complete.obs")

cor.test(KSA, AGE, use = "pairwise.complete.obs")

 

#Gender

cor.test(AAGG, SEX, use = "pairwise.complete.obs")

cor.test(ASUB, SEX, use = "pairwise.complete.obs")

cor.test(CONV, SEX, use = "pairwise.complete.obs")

cor.test(KSA, SEX, use = "pairwise.complete.obs")

 

#PEKS

IPEF <- IPEF1+IPEF2

EPEF <- EPEF1+EPEF2

 

cor.test(AAGG, IPEF, use = "pairwise.complete.obs")

cor.test(ASUB, IPEF, use = "pairwise.complete.obs")

cor.test(CONV, IPEF, use = "pairwise.complete.obs")

cor.test(KSA, IPEF, use = "pairwise.complete.obs")

cor.test(AAGG, EPEF, use = "pairwise.complete.obs")

cor.test(ASUB, EPEF, use = "pairwise.complete.obs")

cor.test(CONV, EPEF, use = "pairwise.complete.obs")

cor.test(KSA, EPEF, use = "pairwise.complete.obs")

 

#KSE-G

SDPQ <- SDPQ1+SDPQ2+SDPQ3

SDNQ <- SDNQ1+SDNQ2+SDNQ3

 

cor.test(AAGG, SDPQ, use = "pairwise.complete.obs")

cor.test(ASUB, SDPQ, use = "pairwise.complete.obs")

cor.test(CONV, SDPQ, use = "pairwise.complete.obs")

cor.test(KSA, SDPQ, use = "pairwise.complete.obs")

cor.test(AAGG, SDNQ, use = "pairwise.complete.obs")

cor.test(ASUB, SDNQ, use = "pairwise.complete.obs")

cor.test(CONV, SDNQ, use = "pairwise.complete.obs")

cor.test(KSA, SDNQ, use = "pairwise.complete.obs")

 

detach(KSA3_UK)

 

#########################################################################

 

################################

#Step 6: Measurement invariance

################################

 

##Option I

 

measurementInvariance(KSA3_MM, data = KSA3, group = "COUN", estimator = "mlr", missing = "fiml", std.lv = TRUE)

 

#########################################################################

 

##Option II

 

#Configural invariance

KSA3.fit1 <- cfa(KSA3_MM, data = KSA3, group = "COUN", estimator = "mlr", missing = "fiml", std.lv = TRUE)

summary(KSA3.fit1, standardized = T, fit.measures = T)

 

#Metric invariance

KSA3.fit2 <- cfa(KSA3_MM, data = KSA3, group = "COUN", estimator = "mlr", missing = "fiml", group.equal = "loadings")

summary(KSA3.fit2, standardized = T, fit.measures = T)

anova(KSA3.fit2, KSA3.fit1)

 

#Scalar invariance

KSA3.fit3 <- cfa(KSA3_MM, data = KSA3, group = "COUN", estimator = "mlr", missing = "fiml", group.equal = c("loadings", "intercepts"))

summary(KSA3.fit3, standardized = T, fit.measures = T)

anova(KSA3.fit3, KSA3.fit2)

 

#Partial scalar invariance

#AAGG1, ASUB1 and CONV2

KSA3.fit4 <- cfa(KSA3_MM, data = KSA3, group = "COUN", estimator = "mlr", missing = "fiml", group.equal = c("loadings", "intercepts"), group.partial = c("AAGG1 ~ 1", "ASUB1 ~ 1", "CONV2 ~ 1"))

summary(KSA3.fit4, standardized = T, fit.measures = T)

anova(KSA3.fit4, KSA3.fit2)

 

#########################################################################

 

##########################

#Step 7: Reference values

##########################

 

#Quote 1: male, lower education, 18-29

#Quote 2: male, lower education, 30-49

#Quote 3: male, lower education, 50-69

#Quote 4: male, middle education, 18-29

#Quote 5: male, middle education, 30-49

#Quote 6: male, middle education, 50-69

#Quote 7: male, upper education, 18-29

#Quote 8: male, upper education, 30-49

#Quote 9: male, upper education, 50-69

#Quote 10: female, lower education, 18-29

#Quote 11: female, lower education, 30-49

#Quote 12: female, lower education, 50-69

#Quote 13: female, middle education, 18-29

#Quote 14: female, middle education, 30-49

#Quote 15: female, middle education, 50-69

#Quote 16: female, upper education, 18-29

#Quote 17: female, upper education, 30-49

#Quote 18: female, upper education, 50-69

 

##Germany

 

attach(KSA3_D)

 

AAGG <- (AAGG1+AAGG2+AAGG3+ASUB1)/4

ASUB <- (ASUB2+ASUB3)/2

CONV <- (CONV1+CONV2+CONV3)/3

KSA <- (AAGG+ASUB+CONV)/3

 

describe(KSA)

describe(AAGG)

describe(ASUB)

describe(CONV)

 

#KSA-3

tapply(KSA, SEX, describe)

AGE1 <- subset(KSA3_D, AGE == 18 | AGE == 19 | AGE == 20 | AGE == 21 | AGE == 22 | AGE == 23 | AGE == 24 | AGE == 25 | AGE == 26

               | AGE == 27 | AGE == 28 | AGE == 29)

AGE2 <- subset(KSA3_D, AGE == 30 | AGE == 31 | AGE == 32 | AGE == 33 | AGE == 34 | AGE == 35 | AGE == 36 | AGE == 37 | AGE == 38

               | AGE == 39 | AGE == 40 | AGE == 41 | AGE == 42 | AGE == 43 | AGE == 44 | AGE == 45 | AGE == 46 | AGE == 47

               | AGE == 48 | AGE == 49)

AGE3 <- subset(KSA3_D, AGE == 50 | AGE == 51 | AGE == 52 | AGE == 53 | AGE == 54 | AGE == 55 | AGE == 56 | AGE == 57 | AGE == 58

               | AGE == 59 | AGE == 60 | AGE == 61 | AGE == 62 | AGE == 63 | AGE == 64 | AGE == 65 | AGE == 66 | AGE == 67

               | AGE == 68 | AGE == 69)

detach(KSA3_D)

attach(AGE1)

AAGG <- (AAGG1+AAGG2+AAGG3+ASUB1)/4

ASUB <- (ASUB2+ASUB3)/2

CONV <- (CONV1+CONV2+CONV3)/3

KSA <- (AAGG+ASUB+CONV)/3

describe(KSA)

detach(AGE1)

attach(AGE2)

AAGG <- (AAGG1+AAGG2+AAGG3+ASUB1)/4

ASUB <- (ASUB2+ASUB3)/2

CONV <- (CONV1+CONV2+CONV3)/3

KSA <- (AAGG+ASUB+CONV)/3

describe(KSA)

detach(AGE2)

attach(AGE3)

AAGG <- (AAGG1+AAGG2+AAGG3+ASUB1)/4

ASUB <- (ASUB2+ASUB3)/2

CONV <- (CONV1+CONV2+CONV3)/3

KSA <- (AAGG+ASUB+CONV)/3

describe(KSA)

detach(AGE3)

 

#Aggression

attach(KSA3_D)

AAGG <- (AAGG1+AAGG2+AAGG3+ASUB1)/4

tapply(AAGG, SEX, describe)

AGE1 <- subset(KSA3_D, AGE == 18 | AGE == 19 | AGE == 20 | AGE == 21 | AGE == 22 | AGE == 23 | AGE == 24 | AGE == 25 | AGE == 26

               | AGE == 27 | AGE == 28 | AGE == 29)

AGE2 <- subset(KSA3_D, AGE == 30 | AGE == 31 | AGE == 32 | AGE == 33 | AGE == 34 | AGE == 35 | AGE == 36 | AGE == 37 | AGE == 38

               | AGE == 39 | AGE == 40 | AGE == 41 | AGE == 42 | AGE == 43 | AGE == 44 | AGE == 45 | AGE == 46 | AGE == 47

               | AGE == 48 | AGE == 49)

AGE3 <- subset(KSA3_D, AGE == 50 | AGE == 51 | AGE == 52 | AGE == 53 | AGE == 54 | AGE == 55 | AGE == 56 | AGE == 57 | AGE == 58

               | AGE == 59 | AGE == 60 | AGE == 61 | AGE == 62 | AGE == 63 | AGE == 64 | AGE == 65 | AGE == 66 | AGE == 67

               | AGE == 68 | AGE == 69)

detach(KSA3_D)

attach(AGE1)

AAGG <- (AAGG1+AAGG2+AAGG3+ASUB1)/4

describe(AAGG)

detach(AGE1)

attach(AGE2)

AAGG <- (AAGG1+AAGG2+AAGG3+ASUB1)/4

describe(AAGG)

detach(AGE2)

attach(AGE3)

AAGG <- (AAGG1+AAGG2+AAGG3+ASUB1)/4

describe(AAGG)

detach(AGE3)

 

#Submissiveness

attach(KSA3_D)

ASUB <- (ASUB2+ASUB3)/2

tapply(ASUB, SEX, describe)

AGE1 <- subset(KSA3_D, AGE == 18 | AGE == 19 | AGE == 20 | AGE == 21 | AGE == 22 | AGE == 23 | AGE == 24 | AGE == 25 | AGE == 26

               | AGE == 27 | AGE == 28 | AGE == 29)

AGE2 <- subset(KSA3_D, AGE == 30 | AGE == 31 | AGE == 32 | AGE == 33 | AGE == 34 | AGE == 35 | AGE == 36 | AGE == 37 | AGE == 38

               | AGE == 39 | AGE == 40 | AGE == 41 | AGE == 42 | AGE == 43 | AGE == 44 | AGE == 45 | AGE == 46 | AGE == 47

               | AGE == 48 | AGE == 49)

AGE3 <- subset(KSA3_D, AGE == 50 | AGE == 51 | AGE == 52 | AGE == 53 | AGE == 54 | AGE == 55 | AGE == 56 | AGE == 57 | AGE == 58

               | AGE == 59 | AGE == 60 | AGE == 61 | AGE == 62 | AGE == 63 | AGE == 64 | AGE == 65 | AGE == 66 | AGE == 67

               | AGE == 68 | AGE == 69)

detach(KSA3_D)

attach(AGE1)

ASUB <- (ASUB2+ASUB3)/2

describe(ASUB)

detach(AGE1)

attach(AGE2)

ASUB <- (ASUB2+ASUB3)/2

describe(ASUB)

detach(AGE2)

attach(AGE3)

ASUB <- (ASUB2+ASUB3)/2

describe(ASUB)

detach(AGE3)

 

#Conventionalism

attach(KSA3_D)

CONV <- (CONV1+CONV2+CONV3)/3

tapply(CONV, SEX, describe)

AGE1 <- subset(KSA3_D, AGE == 18 | AGE == 19 | AGE == 20 | AGE == 21 | AGE == 22 | AGE == 23 | AGE == 24 | AGE == 25 | AGE == 26

               | AGE == 27 | AGE == 28 | AGE == 29)

AGE2 <- subset(KSA3_D, AGE == 30 | AGE == 31 | AGE == 32 | AGE == 33 | AGE == 34 | AGE == 35 | AGE == 36 | AGE == 37 | AGE == 38

               | AGE == 39 | AGE == 40 | AGE == 41 | AGE == 42 | AGE == 43 | AGE == 44 | AGE == 45 | AGE == 46 | AGE == 47

               | AGE == 48 | AGE == 49)

AGE3 <- subset(KSA3_D, AGE == 50 | AGE == 51 | AGE == 52 | AGE == 53 | AGE == 54 | AGE == 55 | AGE == 56 | AGE == 57 | AGE == 58

               | AGE == 59 | AGE == 60 | AGE == 61 | AGE == 62 | AGE == 63 | AGE == 64 | AGE == 65 | AGE == 66 | AGE == 67

               | AGE == 68 | AGE == 69)

detach(KSA3_D)

attach(AGE1)

CONV <- (CONV1+CONV2+CONV3)/3

describe(CONV)

detach(AGE1)

attach(AGE2)

CONV <- (CONV1+CONV2+CONV3)/3

describe(CONV)

detach(AGE2)

attach(AGE3)

CONV <- (CONV1+CONV2+CONV3)/3

describe(CONV)

detach(AGE3)

 

#########################################################################

 

##UK

 

attach(KSA3_UK)

 

AAGG <- (AAGG1+AAGG2+AAGG3+ASUB1)/4

ASUB <- (ASUB2+ASUB3)/2

CONV <- (CONV1+CONV2+CONV3)/3

KSA <- (AAGG+ASUB+CONV)/3

 

describe(KSA)

describe(AAGG)

describe(ASUB)

describe(CONV)

 

#KSA-3

tapply(KSA, SEX, describe)

AGE1 <- subset(KSA3_UK, AGE == 18 | AGE == 19 | AGE == 20 | AGE == 21 | AGE == 22 | AGE == 23 | AGE == 24 | AGE == 25 | AGE == 26

               | AGE == 27 | AGE == 28 | AGE == 29)

AGE2 <- subset(KSA3_UK, AGE == 30 | AGE == 31 | AGE == 32 | AGE == 33 | AGE == 34 | AGE == 35 | AGE == 36 | AGE == 37 | AGE == 38

               | AGE == 39 | AGE == 40 | AGE == 41 | AGE == 42 | AGE == 43 | AGE == 44 | AGE == 45 | AGE == 46 | AGE == 47

               | AGE == 48 | AGE == 49)

AGE3 <- subset(KSA3_UK, AGE == 50 | AGE == 51 | AGE == 52 | AGE == 53 | AGE == 54 | AGE == 55 | AGE == 56 | AGE == 57 | AGE == 58

               | AGE == 59 | AGE == 60 | AGE == 61 | AGE == 62 | AGE == 63 | AGE == 64 | AGE == 65 | AGE == 66 | AGE == 67

               | AGE == 68 | AGE == 69)

detach(KSA3_UK)

attach(AGE1)

AAGG <- (AAGG1+AAGG2+AAGG3+ASUB1)/4

ASUB <- (ASUB2+ASUB3)/2

CONV <- (CONV1+CONV2+CONV3)/3

KSA <- (AAGG+ASUB+CONV)/3

describe(KSA)

detach(AGE1)

attach(AGE2)

AAGG <- (AAGG1+AAGG2+AAGG3+ASUB1)/4

ASUB <- (ASUB2+ASUB3)/2

CONV <- (CONV1+CONV2+CONV3)/3

KSA <- (AAGG+ASUB+CONV)/3

describe(KSA)

detach(AGE2)

attach(AGE3)

AAGG <- (AAGG1+AAGG2+AAGG3+ASUB1)/4

ASUB <- (ASUB2+ASUB3)/2

CONV <- (CONV1+CONV2+CONV3)/3

KSA <- (AAGG+ASUB+CONV)/3

describe(KSA)

detach(AGE3)

 

#Aggression

attach(KSA3_UK)

AAGG <- (AAGG1+AAGG2+AAGG3+ASUB1)/4

tapply(AAGG, SEX, describe)

AGE1 <- subset(KSA3_UK, AGE == 18 | AGE == 19 | AGE == 20 | AGE == 21 | AGE == 22 | AGE == 23 | AGE == 24 | AGE == 25 | AGE == 26

               | AGE == 27 | AGE == 28 | AGE == 29)

AGE2 <- subset(KSA3_UK, AGE == 30 | AGE == 31 | AGE == 32 | AGE == 33 | AGE == 34 | AGE == 35 | AGE == 36 | AGE == 37 | AGE == 38

               | AGE == 39 | AGE == 40 | AGE == 41 | AGE == 42 | AGE == 43 | AGE == 44 | AGE == 45 | AGE == 46 | AGE == 47

               | AGE == 48 | AGE == 49)

AGE3 <- subset(KSA3_UK, AGE == 50 | AGE == 51 | AGE == 52 | AGE == 53 | AGE == 54 | AGE == 55 | AGE == 56 | AGE == 57 | AGE == 58

               | AGE == 59 | AGE == 60 | AGE == 61 | AGE == 62 | AGE == 63 | AGE == 64 | AGE == 65 | AGE == 66 | AGE == 67

               | AGE == 68 | AGE == 69)

detach(KSA3_UK)

attach(AGE1)

AAGG <- (AAGG1+AAGG2+AAGG3+ASUB1)/4

describe(AAGG)

detach(AGE1)

attach(AGE2)

AAGG <- (AAGG1+AAGG2+AAGG3+ASUB1)/4

describe(AAGG)

detach(AGE2)

attach(AGE3)

AAGG <- (AAGG1+AAGG2+AAGG3+ASUB1)/4

describe(AAGG)

detach(AGE3)

 

#Submissiveness

attach(KSA3_UK)

ASUB <- (ASUB2+ASUB3)/2

tapply(ASUB, SEX, describe)

AGE1 <- subset(KSA3_UK, AGE == 18 | AGE == 19 | AGE == 20 | AGE == 21 | AGE == 22 | AGE == 23 | AGE == 24 | AGE == 25 | AGE == 26

               | AGE == 27 | AGE == 28 | AGE == 29)

AGE2 <- subset(KSA3_UK, AGE == 30 | AGE == 31 | AGE == 32 | AGE == 33 | AGE == 34 | AGE == 35 | AGE == 36 | AGE == 37 | AGE == 38

               | AGE == 39 | AGE == 40 | AGE == 41 | AGE == 42 | AGE == 43 | AGE == 44 | AGE == 45 | AGE == 46 | AGE == 47

               | AGE == 48 | AGE == 49)

AGE3 <- subset(KSA3_UK, AGE == 50 | AGE == 51 | AGE == 52 | AGE == 53 | AGE == 54 | AGE == 55 | AGE == 56 | AGE == 57 | AGE == 58

               | AGE == 59 | AGE == 60 | AGE == 61 | AGE == 62 | AGE == 63 | AGE == 64 | AGE == 65 | AGE == 66 | AGE == 67

               | AGE == 68 | AGE == 69)

detach(KSA3_UK)

attach(AGE1)

ASUB <- (ASUB2+ASUB3)/2

describe(ASUB)

detach(AGE1)

attach(AGE2)

ASUB <- (ASUB2+ASUB3)/2

describe(ASUB)

detach(AGE2)

attach(AGE3)

ASUB <- (ASUB2+ASUB3)/2

describe(ASUB)

detach(AGE3)

 

#Conventionalism

attach(KSA3_UK)

CONV <- (CONV1+CONV2+CONV3)/3

tapply(CONV, SEX, describe)

AGE1 <- subset(KSA3_UK, AGE == 18 | AGE == 19 | AGE == 20 | AGE == 21 | AGE == 22 | AGE == 23 | AGE == 24 | AGE == 25 | AGE == 26

               | AGE == 27 | AGE == 28 | AGE == 29)

AGE2 <- subset(KSA3_UK, AGE == 30 | AGE == 31 | AGE == 32 | AGE == 33 | AGE == 34 | AGE == 35 | AGE == 36 | AGE == 37 | AGE == 38

               | AGE == 39 | AGE == 40 | AGE == 41 | AGE == 42 | AGE == 43 | AGE == 44 | AGE == 45 | AGE == 46 | AGE == 47

               | AGE == 48 | AGE == 49)

AGE3 <- subset(KSA3_UK, AGE == 50 | AGE == 51 | AGE == 52 | AGE == 53 | AGE == 54 | AGE == 55 | AGE == 56 | AGE == 57 | AGE == 58

               | AGE == 59 | AGE == 60 | AGE == 61 | AGE == 62 | AGE == 63 | AGE == 64 | AGE == 65 | AGE == 66 | AGE == 67

               | AGE == 68 | AGE == 69)

detach(KSA3_UK)

attach(AGE1)

CONV <- (CONV1+CONV2+CONV3)/3

describe(CONV)

detach(AGE1)

attach(AGE2)

CONV <- (CONV1+CONV2+CONV3)/3

describe(CONV)

detach(AGE2)

attach(AGE3)

CONV <- (CONV1+CONV2+CONV3)/3

describe(CONV)

detach(AGE3)

 

#########################################################################

 

################################

#Step 8: Descriptive statistics

################################

 

##Germany

 

attach(KSA3_D)

 

#Age

summary(AGE)

sd(AGE)

 

#Proportion women

table(SEX)

 

#Educational level

table(QUOT)

 

detach(KSA3_D)

 

#########################################################################

 

##UK

 

attach(KSA3_UK)

 

#Age

summary(AGE)

sd(AGE)

 

#Proportion women

table(SEX)

 

#Educational level

table(QUOT)

 

detach(KSA3_UK)