# Example 1:
# Example from: Browne, M. W. (1979).
#
# Data originally reported in:
# Thurstone, L. L. & Thurstone, T. G. (1941). Factorial studies
# of intelligence. Psychometric Monograph (2), Chicago: Univ.
# Chicago Press.
R.XY <- matrix(c(
1.00, .554, .227, .189, .461, .506, .408, .280, .241,
.554, 1.00, .296, .219, .479, .530, .425, .311, .311,
.227, .296, 1.00, .769, .237, .243, .304, .718, .730,
.189, .219, .769, 1.00, .212, .226, .291, .681, .661,
.461, .479, .237, .212, 1.00, .520, .514, .313, .245,
.506, .530, .243, .226, .520, 1.00, .473, .348, .290,
.408, .425, .304, .291, .514, .473, 1.00, .374, .306,
.280, .311, .718, .681, .313, .348, .374, 1.00, .672,
.241, .311, .730, .661, .245, .290, .306, .672, 1.00), 9, 9)
dimnames(R.XY) <- list(c( paste0("X", 1:4),
paste0("Y", 1:5)),
c( paste0("X", 1:4),
paste0("Y", 1:5)))
out <- faIB(R = R.XY,
n = 710,
NVarX = 4,
numFactors = 2,
itemSort = FALSE,
rotate = "oblimin",
rotateControl = list(standardize = "Kaiser",
numberStarts = 10),
Seed = 1)
# Compare with Browne 1979 Table 2.
print(round(out$loadings, 2))
cat("\n\n")
print(round(out$Phi,2))
cat("\n\n MAD = ", round(out$fit["MAD"], 2),"\n\n")
print( round(out$facIndeterminacy,2) )
# Example 2:
## Correlation values taken from Boruch et al.(1970) Table 2 (p. 838)
## See also, Cudeck (1982) Table 1 (p. 59)
corValues <- c(
1.0,
.11, 1.0,
.61, .47, 1.0,
.42, -.02, .18, 1.0,
.75, .33, .58, .44, 1.0,
.82, .01, .52, .33, .68, 1.0,
.77, .32, .64, .37, .80, .65, 1.0,
.15, -.02, .04, .08, .12, .11, .13, 1.0,
-.04, .22, .26, -.06, .07, -.10, .07, .09, 1.0,
.13, .21, .23, .05, .07, .06, .12, .64, .40, 1.0,
.01, .04, .01, .16, .05, .07, .05, .41, -.10, .29, 1.0,
.27, .13, .18, .17, .27, .27, .27, .68, .18, .47, .33, 1.0,
.24, .02, .12, .12, .16, .23, .18, .82, .08, .55, .35, .76, 1.0,
.20, .18, .16, .17, .22, .11, .29, .69, .20, .54, .34, .68, .68, 1.0)
## Generate empty correlation matrix
BoruchCorr <- matrix(0, nrow = 14, ncol = 14)
## Add upper-triangle correlations
BoruchCorr[upper.tri(BoruchCorr, diag = TRUE)] <- corValues
BoruchCorr <- BoruchCorr + t(BoruchCorr) - diag(14)
## Add variable names to the correlation matrix
varNames <- c("Consideration", "Structure", "Sup.Satisfaction",
"Job.Satisfaction", "Gen.Effectiveness", "Hum.Relations", "Leadership")
## Distinguish between rater X and rater Y
varNames <- paste0(c(rep("X.", 7), rep("Y.", 7)), varNames)
## Add row/col names to correlation matrix
dimnames(BoruchCorr) <- list(varNames, varNames)
## Estimate a model with one, two, and three factors
for (jFactors in 1:3) {
tempOutput <- faIB(R = BoruchCorr,
n = 111,
NVarX = 7,
numFactors = jFactors,
rotate = "oblimin",
rotateControl = list(standardize = "Kaiser",
numberStarts = 100))
cat("\nNumber of inter-battery factors:", jFactors,"\n")
print( round(tempOutput$fit,2) )
} # END for (jFactors in 1:3)
## Compare output with Cudeck (1982) Table 2 (p. 60)
BoruchOutput <-
faIB(R = BoruchCorr,
n = 111,
NVarX = 7,
numFactors = 2,
rotate = "oblimin",
rotateControl = list(standardize = "Kaiser"))
## Print the inter-battery factor loadings
print(round(BoruchOutput$loadings, 3))
print(round(BoruchOutput$Phi, 3))
Run the code above in your browser using DataLab