# \donttest{
library(lavaan)
library(dplyr)
library(semfindr)
library(R.utils)
# Import data
df <- PoliticalDemocracy
# Build Model
model <- '
# measurement model
ind60 =~ x1 + x2 + x3
dem60 =~ y1 + y2 + y3 + y4
dem65 =~ y5 + y6 + y7 + y8
# regressions
dem60 ~ ind60
dem65 ~ ind60 + dem60
# residual correlations
y1 ~~ y5
y2 ~~ y4 + y6
y3 ~~ y7
y4 ~~ y8
y6 ~~ y8
'
threshold <- 10
# Fit SEM model
fit <- lavaan::sem(model, data = df)
summary(fit)
# Compute max number of points to be dropped
max_final <- ceiling(threshold * nrow(df) / 100)
N <- nrow(df)
Test61_result <- Test61(df, model, threshold, fit, max_final, N,
measureTest = "cfi", fitThreshold = 0.9, highGood = TRUE)
summary(Test61_result)
# }
Run the code above in your browser using DataLab