# Find number of factors for factor analyses

13 views (last 30 days)
Johanna on 30 Jan 2023
Answered: Jeff Miller on 31 Jan 2023
Hi all,
I have a dataset compiled in a 532*8 Matrix (532 participants; 8 variables) and I am trying to perform a factor analysis.Hoewever, I want to do an explanatory factor analysis and not determine the number of factors a priori. However, the function factoran(x) requires the input of the number of factors. I've read that performing a Horn Parallel Analysis on the data can help to determine the optimal number of factors and I found a function through FileExchange able to conduct this analysis on my data (HornParallelAnalysis(data, K) - File Exchange - MATLAB Central (mathworks.com)).
Would it make sense to implement both functions as I did in the code snippet shared below?
data_matrix = 532*8 matrix as explained above
data_matrix_standardized = normalize(data_matrix) % normalized input data (as required for HornParallelAnalysis.m)
[sMEV, ciEV, cumE, resL2, nBasis] = HornParallelAnalysis(data_matrix_standardized,1000) % perform Horn Parallel Analysis to obtain number of factors
Thanks, any help would be appreciated!
Johanna

Jeff Miller on 31 Jan 2023
My \$0.02 worth:
I would suggest running facan with nBasis=8 and checking the resulting scree plot (plot of eigenvalue as a function of component number) to see how many components you need. If the first component or two explain substantial percentages of the variance and the third only explains another few percent, you might learn more by focusing your attention on the 2D solution even if the parallel analysis tells you the third dimension explains more than a chance amount.
After you look at the scree plot and decide how many components to keep, rerun facan with nBasis set to that number of components.

### Categories

Find more on k-Means and k-Medoids Clustering in Help Center and File Exchange

### Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!