This code depends on the tidyverse library for the str_glue
function
library(here) # import the file so we can use define_longitudinal_measurement_invariance_model source(here("R/longitudinal_measurement_invariance_model.r")) df = data.frame( cm01ec_lat= c("ec01_cmpar1", "ec01_cmpar2", "ec01_cmpar3", "ec01_cmpar4"), cm03ec_lat= c("ec03_cmpar1", "ec03_cmpar2", "ec03_cmpar3", "ec03_cmpar4"), cm05ec_lat= c("ec05_cmpar1", "ec05_cmpar2", "ec05_cmpar3", "ec05_cmpar4"), cm07ec_lat= c("ec07_cmpar1", "ec07_cmpar2", "ec07_cmpar3", "ec07_cmpar4") ) # You can generate CONFIGURAL, WEAK, STRONG, OR STRICT models ec_cm_configural <- define_longitudinal_measurement_invariance_model(df, "CONFIGURAL") ec_cm_weak <- define_longitudinal_measurement_invariance_model(df,"WEAK") ec_cm_partial_strong <- define_longitudinal_measurement_invariance_model( df, "PARTIAL_STRONG", c(2,3) ) ec_cm_strong <- define_longitudinal_measurement_invariance_model(df,"STRONG") ec_cm_strict <- define_longitudinal_measurement_invariance_model(df, "STRICT") # You could then plug it into your cool cfa function #fit_ec_cm_strong <- cfa(ec_cm_strict, data=dat, mimic = "mplus") #summary(fit_ec_cm_strong, fit.measures=TRUE)
writeLines(ec_cm_configural)
writeLines(ec_cm_partial_strong)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.