############################################################################# # # # Copyright: Florian Schuberth # # Contact: f.schuberth@utwente.nl # # # ############################################################################# # load packages library(cSEM) # Specify model without gender. # gender will be used as grouping variable. model_Bergami=" # Measurement models OrgPres <~ cei1 + cei2 + cei3 + cei4 + cei5 + cei6 + cei7 + cei8 OrgIden =~ ma1 + ma2 + ma3 + ma4 + ma5 + ma6 AffJoy =~ orgcmt1 + orgcmt2 + orgcmt3 + orgcmt7 AffLove =~ orgcmt5 + orgcmt6 + orgcmt8 # Structural model OrgIden ~ OrgPres AffLove ~ OrgPres+OrgIden AffJoy ~ OrgPres+OrgIden" # Estimate the model for both gender groups, i.e., gender = 1 and gender = 2, using the .id argument. # In fact, in the background the dataset is split with regard to gender and # the model is estimated twice. outBergami <- csem(.data = BergamiBagozzi2000,.model = model_Bergami, .disattenuate = T, .PLS_weight_scheme_inner = 'factorial', .tolerance = 1e-6, .resample_method = 'bootstrap', .id='gender') # Get a summary of the estimation results summarize(outBergami) # Conduct MICOM # Note, configural invariance need to be ensured by the researcher. # Moreover, MICOM is not suited for testing measurement invariance of latent variables. outMICOM=testMICOM(outBergami) # See the MICOM results outMICOM # Multigroup analysis using the testMGD function # By default all parameters are compared across groups outoverall=testMGD(.object = outBergami, .type_vcv='construct' # which correlation matrix should be compared across groups in the test of Klesel et al. ) # See the summary results of the MGA. outoverall # Get more detailed insights print(outoverall,.approach_mgd = 'Klesel') print(outoverall,.approach_mgd = 'Chin') # If you compare several parameters across groups ensure a sufficient number of permutation runs. # Moreover, it is recommended to apply a correction for multiple comparison, e.g., Bonferroni outoverall1=testMGD(.object = outBergami, .type_vcv='construct', # which correlation matrix should be compared across groups using the test of Klesel et al. .R_permutation = 999, .approach_p_adjust = 'bonferroni') print(outoverall1,.approach_mgd = 'Chin') # Test only specific effects, e.g., OrgPres -> OrgIden using the permutation-test of Chin & Dibbern. # For that purpose you can specify the model and thus the path coefficients in lavaan syntax. outMGA=testMGD(.object = outBergami, .parameters_to_compare = 'OrgIden~OrgPres', .approach_mgd = 'Chin') # See results outMGA