*! version 1.1.0 23Oct2025

*! version 1.0.0 08Oct2025

Title

auto_factor -- automates data and method checks for factor analysis

Syntax

auto_factor
varlist [if] [in]
[weight]
[,
method(string)
compare
screeplot
predict
[factor_options] ]

method(string) specify the factor method to implement (pf, pcf, ipf, ml); default is to iterate through all methods

compare iterate through all methods; same as not specifying method()

screeplot produce a screeplot; available only when method() is specified

predict add predictions to dataset in memory; available only when method() is specified

[factor_options] specify all available options for factor

aweights and fweights are allowed with factor;
see weight.

Description

auto_factor automates all of the steps typically performed as part of a factor analysis, including (1) initial checks of the
data (Kaiser-Meyer-Olkin measure of sampling adequacy, testing that all variables have variance, testing that there are no perfect linear
dependencies among variables, Bartlett's test of sphericity, and the Doornik-Hansen omnibus test of multivariate normality for the ML method),
(2) determining the number of factors to retain (using Stata's default of all positive eigenvalues, Menger's maximum curvature, and
screeplot), (3) test for uniqueness of variables, and (4) generating predictions. While auto_factor is not a replacement for content
expertise, it can assist in determining whether the data are appropriate for factor analysis and which method (or methods) may be most
suitable.

Options

method(string) specifies which factor method to implement (pf, pcf, ipf, ml). When method() is not specified, auto_factor iterates
through all methods and produces a table showing the number of factors determined for each method using Stata's default
(the count of positive eigenvalues) and Menger's curvature.

compare iterates through all four methods. This is the same as not specifying method().

screeplot produces a screeplot. screeplot is only available when a specific method() is specified.

predict produces predictions for each factor. predict is only available when a specific method() is specified.

factor_options specify all available options for factor.

Examples

Setup

. use "https://www.stata-press.com/data/r19/sp2.dta", clear

implement auto_factor for all four methods

. auto_factor ghp31- ghp05

implement auto_factor for a specific method (ipf) and specify the optional screeplot and add predictions to dataset

. auto_factor ghp31- ghp05, meth(ipf) scree predict

Stored results

auto_factor stores the following in r():

Matrix

r(results) matrix containing the table results (only when method() is not specified or when compare is specified)

Citation of auto_factor

auto_factor is not an official Stata command. It is a free contribution
to the research community, like a paper. Please cite it as such:

Linden A. (2025). AUTO_FACTOR: Stata module to automate data and method checks for factor analysis

Authors

Ariel Linden

President, Linden Consulting Group, LLC

alinden@lindenconsulting.org

Also see

Help: factor, factor_postestimation, menger (if installed)