Learn R Programming

ShinyItemAnalysis (version 1.3.6)

fa_parallel: Conduct Parallel Analysis

Description

Computes the eigenvalues of the sample correlation matrix and the eigenvalues obtained from a random correlation matrix for which no factors are assumed. By default, the function utilizes a modified Horn's (1965) method, which -- instead of mean -- uses 95th percentile of each item eigenvalues sampling distribution as a threshold to find the optimal number of factors.

Usage

fa_parallel(
  Data,
  cor = "pearson",
  method = "quantile",
  p = 0.95,
  n_iter = 20,
  fm = "minres",
  use = "pairwise",
  ...
)

Arguments

Data

data.frame or matrix, dataset where rows are observations and columns items.

cor

character, how to calculate the correlation matrix of the real data. Can be either "pearson" (default), "tetrachoric" or "polychoric". Unambiguous abbreviations accepted.

method

character, whether to use traditionall Horn's method or more recent and well-performing quantile one. Either mean or quantile (default). Can be abbreviated.

p

numeric (0--1), probability for which the sample quantile is produced. Defaults to .95. Ignored if method = "mean".

n_iter

integer, number of iterations, i.e. the number of zero-factor multivariate normal distributions to sample. Defaults to 20.

fm

character, factoring method. See fa from the package psych.

use

an optional character string giving a method for computing covariances in the presence of missing values. This must be (an abbreviation of) one of the strings "everything", "all.obs", "complete.obs", "na.or.complete", or "pairwise.complete.obs".

...

Arguments passed on to psych::polychoric

correct

Correction value to use to correct for continuity in the case of zero entry cell for tetrachoric, polychoric, polybi, and mixed.cor. See the examples for the effect of correcting versus not correcting for continuity.

smooth

if TRUE and if the tetrachoric/polychoric matrix is not positive definite, then apply a simple smoothing algorithm using cor.smooth

global

When finding pairwise correlations, should we use the global values of the tau parameter (which is somewhat faster), or the local values (global=FALSE)? The local option is equivalent to the polycor solution, or to doing one correlation at a time. global=TRUE borrows information for one item pair from the other pairs using those item's frequencies. This will make a difference in the presence of lots of missing data. With very small sample sizes with global=FALSE and correct=TRUE, the function will fail (for as yet underdetermined reasons.

weight

A vector of length of the number of observations that specifies the weights to apply to each case. The NULL case is equivalent of weights of 1 for all cases.

progress

Show the progress bar (if not doing multicores)

ML

ML=FALSE do a quick two step procedure, ML=TRUE, do longer maximum likelihood --- very slow! Deprecated

delete

Cases with no variance are deleted with a warning before proceeding.

max.cat

The maximum number of categories to bother with for polychoric.

Value

An object of class sia_parallel. Can be coerced to data.frame or plotted with plot().

Details

Horn proposed a solution to the problem of optimal factor number identification using an approach based on a Monte Carlo simulation.

First, several (20 by default) zero-factor p-variate normal distributions (where p is the number of columns) are obtained, and p <U+00D7> p correlation matrices are computed for them. Eigenvalues of each matrix is then calculated in order to get an eigenvalues sampling distribution for each simulated variable.

Traditionally, Horn obtains an average of each sampling distribution and these averages are used as a threshold which is compared with eigenvalues of the original, real data. However, usage of the mean was later disputed by Buja & Eyuboglu (1992), and 95th percentile of eigenvalues sampling distribution was suggested as a more accurate threshold. This, more recent method is used by default in the function.

References

Horn, J. L. (1965). A rationale and test for the number of factors in factor analysis. Psychometrika, 30, 179--185. http://dx.doi.org/10.1007/BF02289447

Buja, A., & Eyuboglu, N. (1992). Remarks on parallel analysis. Multivariate Behavioral Research, 27, 509--540. http://dx.doi.org/10.1207/ s15327906mbr2704_2

Examples

Run this code
# NOT RUN {
data("bfi", package = "psych")
items <- bfi[, 1:25]

fa_parallel(items)
# }
# NOT RUN {
fa_parallel(items, method = "mean") # traditional Horn's method, emulates psych

fa_parallel(items) %>% plot()
fa_parallel(items) %>% as.data.frame()
# }
# NOT RUN {
# }

Run the code above in your browser using DataLab