# --------------------------------------------------------
# Example 1: Basic use without diagnostics
# --------------------------------------------------------
factorLoadings <- matrix(
c(
0.05, 0.20, 0.70,
0.10, 0.05, 0.80,
0.05, 0.15, 0.85,
0.20, 0.85, 0.15,
0.05, 0.85, 0.10,
0.10, 0.90, 0.05,
0.90, 0.15, 0.05,
0.80, 0.10, 0.10
),
nrow = 8, ncol = 3, byrow = TRUE
)
rownames(factorLoadings) <- paste0("Q", 1:8)
colnames(factorLoadings) <- c("Factor1", "Factor2", "Factor3")
factorCor <- matrix(
c(
1.0, 0.7, 0.6,
0.7, 1.0, 0.4,
0.6, 0.4, 1.0
),
nrow = 3, byrow = TRUE
)
itemCor <- makeCorrLoadings(factorLoadings, factorCor)
round(itemCor, 3)
# --------------------------------------------------------
# Example 2: Diagnostics with factor correlations (Adjusted Omega)
# --------------------------------------------------------
result_adj <- makeCorrLoadings(
loadings = factorLoadings,
factorCor = factorCor,
diagnostics = TRUE
)
# View outputs
round(result_adj$R, 3) # correlation matrix
round(result_adj$Omega, 3) # adjusted Omega
round(result_adj$OmegaTotal, 3) # total Omega
print(result_adj$Diagnostics) # communality and uniqueness per item
# --------------------------------------------------------
# Example 3: Diagnostics assuming orthogonal factors (Per-Factor Omega)
# --------------------------------------------------------
result_orth <- makeCorrLoadings(
loadings = factorLoadings,
diagnostics = TRUE
)
round(result_orth$Omega, 3) # per-factor Omega
round(result_orth$OmegaTotal, 3) # total Omega
print(result_orth$Diagnostics)
Run the code above in your browser using DataLab