Learn R Programming

fungible (version 2.2.2)

faSort: Sort a factor loadings matrix

Description

faSort takes an unsorted factor pattern or structure matrix and returns a sorted matrix with (possibly) reflected columns. Sorting is done such that variables that load on a common factor are grouped together for ease of interpretation.

Usage

faSort(fmat, phi = NULL, BiFactor = FALSE, salient = 0.25, reflect = TRUE)

Value

loadings

sorted factor loadings matrix.

phi

reflected factor correlation matrix when phi is given as an argument.

markers

A list of factor specific markers with loadings >= abs(salient). Markers are sorted by the absolute value of the salient factor loadings.

sortOrder

sorted row numbers.

SEmat

The SEmat is a so-called Start-End matrix that lists the first (start) and last (end) row for each factor in the sorted pattern matrix.

Arguments

fmat

factor loadings (pattern or structure) matrix.

phi

factor correlation matrix. Default = NULL. If reflect = TRUE then phi will be corrected to match the new factor orientations.

BiFactor

(logical) Is the solution a bifactor model?

salient

factor markers with loadings >= abs(salient) will be saved in the markers list. Note that a variable can be a marker of more than one factor.

reflect

(logical) if reflect = TRUE then the factors will be reflected such that salient loadings are mostly positive.

Author

Niels Waller

See Also

fals

Other Factor Analysis Routines: BiFAD(), Box26, GenerateBoxData(), Ledermann(), SLi(), SchmidLeiman(), faAlign(), faEKC(), faIB(), faLocalMin(), faMB(), faMain(), faScores(), faStandardize(), faX(), fals(), fapa(), fareg(), fsIndeterminacy(), orderFactors(), print.faMB(), print.faMain(), promaxQ(), summary.faMB(), summary.faMain()

Examples

Run this code

set.seed(123)
F <- matrix( c( .5,  0, 
                .6,  0,
                 0, .6,
                .6,  0,
                 0, .5,
                .7,  0,
                 0, .7,
                 0, .6), nrow = 8, ncol = 2, byrow=TRUE)

Rex1 <- F %*% t(F); diag(Rex1) <- 1

Items <- c("1. I am often tense.\n",
           "2. I feel anxious much of the time.\n",
           "3. I am a naturally curious individual.\n",
           "4. I have many fears.\n",
           "5. I read many books each year.\n",
           "6. My hands perspire easily.\n",
           "7. I have many interests.\n",
           "8. I enjoy learning new words.\n")

exampleOut <- fals(R = Rex1, nfactors = 2)

# Varimax rotation
Fload <- varimax(exampleOut$loadings)$loadings[]

# Add some row labels
rownames(Fload) <- paste0("V", 1:nrow(Fload))

cat("\nUnsorted fator loadings\n")
print(round( Fload, 2) )

# Sort items and reflect factors
out1 <- faSort(fmat = Fload, 
               salient = .25, 
               reflect = TRUE)
               
FloadSorted <- out1$loadings

cat("\nSorted fator loadings\n")
print(round( FloadSorted, 2) )

# Print sorted items
cat("\n Items sorted by Factor\n")
cat("\n",Items[out1$sortOrder])

Run the code above in your browser using DataLab