# NOT RUN {
# }
# NOT RUN {
#run all GOF functions using multiple cores
setCluster()
#Exploratory
nfact <- 3
(GOFresult <- GOF(holzinger, nfact))
(GOFresult.outlier <- GOF(holzinger.outlier, nfact))
plot(GOFresult)
plot(GOFresult.outlier)
## include a progress bar
GOFresult <- GOF(holzinger, nfact, progress = TRUE)
#-------------------------------------------------------------------
#Confirmatory with sem
model <- sem::specifyModel()
F1 -> Remndrs, lam11
F1 -> SntComp, lam21
F1 -> WrdMean, lam31
F2 -> MissNum, lam42
F2 -> MxdArit, lam52
F2 -> OddWrds, lam62
F3 -> Boots, lam73
F3 -> Gloves, lam83
F3 -> Hatchts, lam93
F1 <-> F1, NA, 1
F2 <-> F2, NA, 1
F3 <-> F3, NA, 1
(GOFresult <- GOF(holzinger, model))
(GOFresult.outlier <- GOF(holzinger.outlier, model))
plot(GOFresult)
plot(GOFresult.outlier)
#-------------------------------------------------------------------
#Confirmatory with lavaan
model <- 'F1 =~ Remndrs + SntComp + WrdMean
F2 =~ MissNum + MxdArit + OddWrds
F3 =~ Boots + Gloves + Hatchts'
(GOFresult <- GOF(holzinger, model, orthogonal=TRUE))
(GOFresult.outlier <- GOF(holzinger.outlier, model, orthogonal=TRUE))
plot(GOFresult)
plot(GOFresult.outlier)
# categorical data with mirt
library(mirt)
data(LSAT7)
dat <- expand.table(LSAT7)
model <- mirt.model('F = 1-5')
result <- GOF(dat, model)
plot(result)
# }
Run the code above in your browser using DataLab