# EFA: Principal Component Analysis (PCA) and Exploratory Factor... In bruceR: Broadly Useful Convenient and Efficient R Functions

 EFA R Documentation

## Principal Component Analysis (PCA) and Exploratory Factor analysis (EFA).

### Description

An extension of `psych::principal()` and `psych::fa()`, performing either Principal Component Analysis (PCA) or Exploratory Factor Analysis (EFA).

Three options to specify variables:

1. `var + items`: use the common and unique parts of variable names.

2. `vars`: directly define a character vector of variables.

3. `varrange`: use the starting and stopping positions of variables.

### Usage

```EFA(
data,
var,
items,
vars = NULL,
varrange = NULL,
rev = NULL,
method = c("pca", "pa", "ml", "minres", "uls", "ols", "wls", "gls", "alpha"),
rotation = c("none", "varimax", "oblimin", "promax", "quartimax", "equamax"),
nfactors = c("eigen", "parallel", "(any number >= 1)"),
sort.loadings = TRUE,
hide.loadings = 0,
plot.scree = TRUE,
kaiser = TRUE,
max.iter = 25,
min.eigen = 1,
digits = 3,
nsmall = digits,
file = NULL
)

PCA(..., method = "pca")
```

### Arguments

 `data` Data frame. `var` [Option 1] The common part across the variables. e.g., `"RSES"` `items` [Option 1] The unique part across the variables. e.g., `1:10` `vars` [Option 2] A character vector specifying the variables. e.g., `c("X1", "X2", "X3", "X4", "X5")` `varrange` [Option 3] A character string specifying the positions ("starting:stopping") of variables. e.g., `"A1:E5"` `rev` [Optional] Variables that need to be reversed. It can be (1) a character vector specifying the reverse-scoring variables (recommended), or (2) a numeric vector specifying the item number of reverse-scoring variables (not recommended). `method` Extraction method. `"pca"` - Principal Component Analysis (default) `"pa"` - Principal Axis Factor Analysis `"ml"` - Maximum Likelihood Factor Analysis `"minres"` - Minimum Residual Factor Analysis `"uls"` - Unweighted Least Squares Factor Analysis `"ols"` - Ordinary Least Squares Factor Analysis `"wls"` - Weighted Least Squares Factor Analysis `"gls"` - Generalized Least Squares Factor Analysis `"alpha"` - Alpha Factor Analysis (Kaiser & Coffey, 1965) `rotation` Rotation method. `"none"` - None (not suggested) `"varimax"` - Varimax (default) `"oblimin"` - Direct Oblimin `"promax"` - Promax `"quartimax"` - Quartimax `"equamax"` - Equamax `nfactors` How to determine the number of factors/components? `"eigen"` - based on eigenvalue (> minimum eigenvalue) (default) `"parallel"` - based on parallel analysis (any number >= 1) - user-defined fixed number `sort.loadings` Sort factor/component loadings by size? Default is `TRUE`. `hide.loadings` A number (0~1) for hiding absolute factor/component loadings below this value. Default is `0` (does not hide any loading). `plot.scree` Display the scree plot? Default is `TRUE`. `kaiser` Do the Kaiser normalization (as in SPSS)? Default is `TRUE`. `max.iter` Maximum number of iterations for convergence. Default is `25` (the same as in SPSS). `min.eigen` Minimum eigenvalue (used if `nfactors="eigen"`). Default is `1`. `digits, nsmall` Number of decimal places of output. Default is `3`. `file` File name of MS Word (`.doc`). `...` Arguments passed from `PCA()` to `EFA()`.

### Value

A list of results:

`result`

The R object returned from `psych::principal()` or `psych::fa()`

`result.kaiser`

The R object returned from `psych::kaiser()` (if any)

`extraction.method`

Extraction method

`rotation.method`

Rotation method

`eigenvalues`

A `data.frame` of eigenvalues and sum of squared (SS) loadings

`loadings`

A `data.frame` of factor/component loadings and communalities

`scree.plot`

A `ggplot2` object of the scree plot

### Functions

• `EFA()`: Exploratory Factor Analysis

• `PCA()`: Principal Component Analysis - a wrapper of `EFA(..., method="pca")`

### Note

Results based on the `varimax` rotation method are identical to SPSS. The other rotation methods may produce results slightly different from SPSS.

### See Also

`MEAN`, `Alpha`, `CFA`

### Examples

```data = psych::bfi
EFA(data, "E", 1:5)              # var + items
EFA(data, "E", 1:5, nfactors=2)  # var + items

EFA(data, varrange="A1:O5",
nfactors="parallel",
hide.loadings=0.45)

# the same as above:
# using dplyr::select() and dplyr::matches()
# to select variables whose names end with numbers
# (regexp: \d matches all numbers, \$ matches the end of a string)
data %>% select(matches("\\d\$")) %>%
EFA(vars=names(.),       # all selected variables
method="pca",        # default
rotation="varimax",  # default
nfactors="parallel", # parallel analysis
hide.loadings=0.45)  # hide loadings < 0.45

```

bruceR documentation built on March 7, 2023, 5:41 p.m.