The method agreement procedure

When running factor analysis, one often needs to know how many components to retain. Fortunately, many methods exist to statistically answer this issue. Unfortunately, there is no consensus on which method is the best. Therefore, the n_factors() function, available in the psycho package, performs a method agreement procedure. In other words, it runs all the routines and returns the number of factors with the higher consensus.

# devtools::install_github("neuropsychology/psycho.R")  # Install the last psycho version if needed

library(tidyverse)
library(psycho)

results <- attitude %>%
  psycho::n_factors()

print(results)

We can have an overview of all values by using the summary method.

summary(results)
knitr::kable(summary(results), digits=2)

And, of course, plot it :)

plot(results)

The plot shows the number of methods (in yellow), the Eigenvalues (red line) and the cumulative proportion of explained variance (blue line).

For more details, we can also extract the final result (the optimal number of factors) for each method:

psycho::values(results)$methods
knitr::kable(psycho::values(results)$methods)

Tweaking

We can also provide a correlation matrix, as well as changing the rotation and the factoring method.

df <- psycho::affective

cor_mat <- psycho::correlation(df)
cor_mat <- cor_mat$values$r

results <- cor_mat %>%
  psycho::n_factors(rotate = "oblimin", fm = "mle", n=nrow(df))

print(results)

plot(results)

Credits

This package helped you? Don't forget to cite the various packages you used :)

You can cite psycho as follows:



neuropsychology/psycho.R documentation built on Jan. 25, 2021, 7:59 a.m.