data("WansbeekMeijer", package = "GPArotation")
fa.unrotated <- factanal(factors = 2, covmat = NetherlandsTV, rotation = "none")
options(warn = -1)
# Orthogonal rotation — single start
fa.lpT1 <- GPForth.lp(loadings(fa.unrotated), p = 1)
# Orthogonal rotation — 10 random starts
fa.lpT <- lpT(loadings(fa.unrotated), Tmat = Random.Start(2), p = 1,
randomStarts = 10)
print(fa.lpT, digits = 5, sortLoadings = FALSE, Table = TRUE, rotateMat = TRUE)
# Oblique rotation — single start
fa.lpQ1 <- GPFoblq.lp(loadings(fa.unrotated), p = 1)
# Oblique rotation — 10 random starts
fa.lpQ <- lpQ(loadings(fa.unrotated), p = 1, randomStarts = 10)
summary(fa.lpQ, Structure = TRUE)
# Compare Lp (p=1), Lp (p=0.5), and Geomin oblique rotations
set.seed(1020)
fa.lpQ1 <- lpQ(loadings(fa.unrotated), p = 1, randomStarts = 10)
fa.lpQ0.5 <- lpQ(loadings(fa.unrotated), p = 0.5, randomStarts = 10)
fa.geo <- geominQ(loadings(fa.unrotated), randomStarts = 10)
# With factor ordering using internal sortGPALoadings helper
res <- round(cbind(GPArotation:::.sortGPALoadings(fa.lpQ1)$loadings,
GPArotation:::.sortGPALoadings(fa.lpQ0.5)$loadings,
GPArotation:::.sortGPALoadings(fa.geo)$loadings), 3)
print(c("oblique -- Lp p=1 Lp p=0.5 Geomin"))
print(res)
# Without factor ordering
res <- round(cbind(fa.lpQ1$loadings, fa.lpQ0.5$loadings, fa.geo$loadings), 3)
print(c("oblique -- Lp p=1 Lp p=0.5 Geomin"))
print(res)
options(warn = 0)
Run the code above in your browser using DataLab