# \donttest{
library(lavaan)
library(dplyr)
library(semfindr)
# Import data
df <- PoliticalDemocracy
# Build SEM model
model <- '
ind60 =~ x1 + x2 + x3
dem60 =~ y1 + y2 + y3 + y4
dem65 =~ y5 + y6 + y7 + y8
dem60 ~ ind60
dem65 ~ ind60 + dem60
'
fit <- lavaan::sem(model, data = df)
max_final <- ceiling(10 * nrow(df) / 100) # dropping 10% of the data points
N <- nrow(df)
Test10_result <- Test10(df, model, fit, max_final, N,
measureTest = "cfi", fitThreshold = 0.9, highGood = TRUE)
summary(Test10_result)
# }
Run the code above in your browser using DataLab