This function implements a voting method to determine the most appropriate number of factors in exploratory factor analysis (EFA). The function accepts a vector of votes, where each value represents the number of factors suggested by different EFA approaches. If there is a clear winner (a single number of factors with the most votes), that number is returned. In case of a tie, the function returns the first value among the tied results and outputs a message. The result is returned as an object of class vote, which can be printed and plotted.

EFAvote(votes, vis = TRUE, plot = TRUE)

Arguments

votes

A vector of integers, where each element corresponds to the number of factors suggested by an EFA method.

vis

Logical, whether to print the results of the voting. Defaults to TRUE.

plot

Logical, whether to display a pie chart of the voting results. Defaults to TRUE.

Value

An object of class EFAvote, which is a list containing:

nfact

The number of factors with the most votes. If there is a tie, the first one in the order is returned.

votes

The original vector of votes.

See also

Examples

library(EFAfactors)

nfacts <- c(5, 5, 5, 6, 6, 4)
names(nfacts) <- c("Hull", "CD", "PA", "EKC", "XGB", "DNN")

EFAvote.obj <- EFAvote(votes = nfacts)
#> The number of factors suggested by EFAvote is 5 .

# Visualize the voting results
plot(EFAvote.obj)