% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/EFAtools-superseded.R
\name{EFA}
\alias{EFA}
\title{Exploratory factor analysis (EFA)}
\usage{
EFA(
  x,
  n_factors,
  N = NA,
  method = c("PAF", "ML", "ULS", "MINRES", "DWLS"),
  rotation = c("none", "varimax", "equamax", "quartimax", "geominT", "bentlerT",
    "bifactorT", "promax", "oblimin", "quartimin", "simplimax", "bentlerQ", "geominQ",
    "bifactorQ"),
  se = c("none", "information", "sandwich", "np-boot"),
  type = c("EFAtools", "psych", "SPSS", "none"),
  max_iter = NA,
  init_comm = NA,
  criterion = NA,
  criterion_type = NA,
  abs_eigen = NA,
  use = c("pairwise.complete.obs", "all.obs", "complete.obs", "everything",
    "na.or.complete"),
  varimax_type = NA,
  k = NA,
  normalize = TRUE,
  p_type = NA,
  precision = 1e-05,
  order_type = NA,
  start_method = "psych",
  cor_method = c("pearson", "spearman", "kendall", "poly", "tetra", "fiml"),
  b_boot = 1000,
  ci = 0.95,
  random_starts = 100,
  seed = NULL,
  P_type = lifecycle::deprecated(),
  randomStarts = lifecycle::deprecated(),
  ...
)
}
\arguments{
\item{x}{data.frame or matrix. Dataframe or matrix of raw data or matrix with
correlations. If raw data is entered, the correlation matrix is found from the
data.}

\item{n_factors}{numeric. Number of factors to extract. Must be at least 1 and
smaller than the number of variables (the common factor model is not identified
otherwise). Use \code{\link[=efa_retain]{efa_retain()}} to decide on a value.}

\item{N}{numeric. The number of observations. Needs only be specified if a
correlation matrix is used; with raw data, \code{N} is found from the data instead.
\itemize{
\item With \code{N = NA}, not all fit indices can be computed; a positive \code{N} that is very
small relative to the number of variables leaves the chi-square-derived indices
unavailable as well, with a warning.
\item With raw data, \code{N} is the number of cases the correlation matrix was actually
computed from -- see \code{use} for the general rule and how missing values change it.
Under \code{cor_method = "fiml"}, \code{use} is ignored and \code{N} is instead the number of
cases carrying at least one observed value.
}}

\item{method}{character. The estimator used to fit the EFA; passed to \code{\link[=efa_fit]{efa_fit()}}
as its \code{estimator} argument. One of "PAF", "ML", "ULS", "MINRES" (an accepted
alias of "ULS"), or "DWLS"; see the \code{\link[=efa_fit]{efa_fit()}} documentation for their
properties and data requirements.}

\item{rotation}{character. Either perform no rotation ("none"; default),
an orthogonal rotation ("varimax", "equamax", "quartimax", "geominT",
"bentlerT", or "bifactorT"), or an oblique rotation ("promax", "oblimin",
"quartimin", "simplimax", "bentlerQ", "geominQ", or "bifactorQ"). See the
\emph{Rotations} section in Details for their properties and known issues.}

\item{se}{character. Whether and how to compute standard errors (and matching
confidence intervals): "none" (default), "information" (analytic
standard errors from the expected Fisher information of the ML solution), "sandwich"
(robust "sandwich" standard errors from raw data, which stay reliable under
non-normality or a misspecified estimator weight), or "np-boot" (non-parametric
bootstrap). The
methods differ in their assumptions, their data requirements, and which estimator,
rotation, and \code{cor_method} combinations they support; see the \emph{Standard errors}
section in Details.}

\item{type}{character. If one of "EFAtools" (default), "psych", or "SPSS" is
used, and the following arguments with default NA are left with
NA, these implementations are executed according to the respective program
("psych" and "SPSS") or according to the best solution found in Grieder &
Steiner (2022; "EFAtools"). Individual properties can be adapted using one of
the three types and specifying some of the following arguments. If set to
"none" additional arguments must be specified depending on the \code{method}
and \code{rotation} used (see details).}

\item{max_iter}{numeric. The maximum number of iterations to perform after which
the iterative PAF procedure is halted with a warning. If \code{type} is one of
"EFAtools", "SPSS", or "psych", this is automatically specified if \code{max_iter} is
left to be \code{NA}, but can be overridden by entering a number. Default is
\code{NA}.}

\item{init_comm}{character. The method to estimate the initial communalities
in \code{PAF}. "smc" will use squared multiple correlations, "mac" will use
maximum absolute correlations, "unity" will use 1s (see details).
Default is \code{NA}.}

\item{criterion}{numeric. The convergence criterion used for PAF.
If the change in communalities from one iteration to the next is smaller than
this criterion the solution is accepted and the procedure ends.
Default is \code{NA}.}

\item{criterion_type}{character. Type of convergence criterion used for
PAF. "max_individual" selects the maximum change in any of the
communalities from one iteration to the next and tests it against the
specified criterion. This is also used by SPSS. "sum" takes the difference of
the sum of all communalities in one iteration and the sum of all communalities
in the next iteration and tests this against the criterion. This procedure is
used by the \code{\link[psych:fa]{psych::fa()}} function. Default is \code{NA}.}

\item{abs_eigen}{logical. Which algorithm to use in the PAF
iterations. If FALSE, the loadings are computed from the eigenvalues. This is
also used by the \code{\link[psych:fa]{psych::fa()}} function. If TRUE the
loadings are computed with the absolute eigenvalues as done by SPSS.
Default is \code{NA}.}

\item{use}{character. Passed to \code{\link[stats:cor]{stats::cor()}} if raw data
is given as input. Default is "pairwise.complete.obs". It is ignored when
\code{cor_method = "fiml"} (which handles the missingness itself, so every case
contributes), and it is overridden to listwise deletion whenever an asymptotic
covariance is required (the "DWLS" estimator, or \code{se = "sandwich"}), because the
covariance must describe the same cases as the correlation matrix.}

\item{varimax_type}{character. The type of the varimax rotation performed.
If "svd", singular value decomposition is used, as \code{\link[stats:varimax]{stats::varimax()}} does. If
"kaiser", the varimax procedure performed in SPSS is used, following the original
procedure from Kaiser (1958) (see details). Default is \code{NA}.}

\item{k}{numeric. Either the power used for computing the target matrix P in
the promax rotation or the number of 'close to zero loadings' for the simplimax
rotation. If left to \code{NA} (default), the value for promax depends on the specified type.
For simplimax, \code{nrow(L)}, where L is the matrix of unrotated loadings,
is used by default.}

\item{normalize}{logical. If \code{TRUE}, a kaiser normalization is
performed before the specified rotation. Default is \code{TRUE}.}

\item{p_type}{character. This specifies how the target
matrix P is computed in promax rotation. If "unnorm" it will use the
unnormalized target matrix as originally done in Hendrickson and White (1964).
This is also used in the psych and stats packages. If "norm" it will use the
normalized target matrix as used in SPSS. Default is \code{NA}.}

\item{precision}{numeric. The tolerance for stopping in the rotation
procedure. Default is 10^-5 for all rotation methods.}

\item{order_type}{character. How to order the factors. "eigen" reorders the
factors by descending explained variance; "ss_factors" reorders the factors by
descending (unweighted) sum of squared factor loadings per factor. Default is \code{NA}.}

\item{start_method}{character. How to specify the starting values for the
optimization procedure for ML. Default is "psych" which takes the
starting values specified in \code{\link[psych:fa]{psych::fa()}}. "factanal" takes the
starting values specified in the \code{\link[stats:factanal]{stats::factanal()}} function.}

\item{cor_method}{character. How the correlation is computed from raw data:
\code{"pearson"}, \code{"spearman"}, or \code{"kendall"} (passed to \code{\link[stats:cor]{stats::cor()}}); \code{"poly"} /
\code{"tetra"} for polychoric / tetrachoric correlations of ordinal / binary data; or
\code{"fiml"} for a two-stage full-information maximum-likelihood correlation from raw data
with missing values. See the \emph{Correlation methods} section in Details for their
properties and the combinations they support. Default is "pearson".}

\item{b_boot}{numeric. The number of bootstrap samples to draw. Default is 1000.
Must be at least 2, the smallest number from which a standard error is defined.
Under \code{cor_method = "fiml"} each bootstrap sample re-runs the EM moment
estimation, so a smaller value may be advisable.}

\item{ci}{numeric. The level of the confidence intervals: the percentile intervals from
the bootstrap samples under \code{se = "np-boot"}, and the analytic Wald intervals under
\code{se = "information"} and \code{se = "sandwich"}, the corrected two-stage intervals of
\code{cor_method = "fiml"} included. Must be greater than 0 and smaller than 1. Default is
.95 for 95\% CIs.}

\item{random_starts}{numeric. The number of random starts to use in the
rotation to guard against local minima. Default is 100.}

\item{seed}{numeric. An optional seed for the random-number generator.}

\item{P_type, randomStarts}{\ifelse{html}{\href{https://lifecycle.r-lib.org/articles/stages.html#superseded}{\figure{lifecycle-superseded.svg}{options: alt='[Superseded]'}}}{\strong{[Superseded]}} Former names of
\code{p_type} and \code{random_starts}. Still accepted (silently) for backwards
compatibility; please use the new names.}

\item{...}{Additional arguments passed to the rotation procedure (e.g., \code{maxit} for
the maximum number of iterations).}
}
\value{
The value of \code{\link[=efa_fit]{efa_fit()}}, a list of class \code{c("efa", "EFA")}; see there for the
components.
}
\description{
\ifelse{html}{\href{https://lifecycle.r-lib.org/articles/stages.html#superseded}{\figure{lifecycle-superseded.svg}{options: alt='[Superseded]'}}}{\strong{[Superseded]}}

\code{EFA()} has been superseded by \code{\link[=efa_fit]{efa_fit()}}, which is the recommended interface going
forward. \code{efa_fit()} keeps the primary choices (data, factors, estimator, rotation,
standard errors) as top-level arguments and collects the estimation and rotation tuning
knobs into two control objects, \code{\link[=estimate_control]{estimate_control()}} and \code{\link[=rotate_control]{rotate_control()}}. \code{EFA()}
remains available and unchanged -- its full flat argument list still works exactly as
before -- so existing code keeps running.
}
\seealso{
\code{\link[=efa_fit]{efa_fit()}}, \code{\link[=estimate_control]{estimate_control()}}, \code{\link[=rotate_control]{rotate_control()}}
}
