model_RSE <- '
pos_items =~ Q1 + Q2 + Q4 + Q6 + Q7
neg_items =~ Q3_R + Q5_R + Q8_R + Q9_R + Q10_R '
# using LV_model
Factorial_Invariance(data = data_RSE_sex, group = 'gender', LV_model = model_RSE)
# \donttest{
# using LV_keys
Factorial_Invariance(data = data_RSE_sex, group = 'gender',
LV_keys = c(1, 1, 2, 1, 2, 1, 1, 2, 2, 2),
LV_names = c('pos', 'neg'))
# another way of using LV_keys
Factorial_Invariance(data = data_RSE_sex, group = 'gender',
LV_keys = c( Q1 = 1, Q2 = 1, Q3_R = 2, Q4 = 1, Q5_R = 2,
Q6 = 1, Q7 = 1, Q8_R = 2, Q9_R = 2, Q10_R = 2) )
# for an ESEM model
# first, use the ESEM function to obtain the esem_model_syntax (without the group variable, gender)
esem_output <- ESEM(data = subset(data_RSE_sex, select = -c(gender)), Nfactors = 2)
Factorial_Invariance(data = data_RSE_sex, group = 'gender',
LV_model = esem_output$esem_model_syntax)
# See this web page for additional Examples:
# https://oconnor-psych.ok.ubc.ca/vignettes/EXAMPLES_vignettes.html
# }
Run the code above in your browser using DataLab