forked from mdsteiner/EFAtools
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathREADME.Rmd
More file actions
101 lines (72 loc) · 3.76 KB
/
README.Rmd
File metadata and controls
101 lines (72 loc) · 3.76 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
---
output: github_document
---
<!-- README.md is generated from README.Rmd. Please edit that file -->
```{r, include = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>",
fig.path = "man/figures/README-",
out.width = "100%"
)
```
# EFAtools
<!-- badges: start -->
[](https://CRAN.R-project.org/package=EFAtools)
[](https://doi.org/10.21105/joss.02521)
[](https://github.com/mdsteiner/EFAtools/actions)
<!-- badges: end -->
The EFAtools package provides functions to perform exploratory factor analysis (EFA) procedures and compare their solutions. The goal is to provide state-of-the-art factor retention methods and a high degree of flexibility in the EFA procedures. This way, implementations from R psych and SPSS can be compared. Moreover, functions for Schmid-Leiman transformation, and computation of omegas are provided. To speed up the analyses, some of the iterative procedures like principal axis factoring (PAF) are implemented in C++.
## Installation
You can install the release version from [CRAN](https://cran.r-project.org/) with:
```{r eval=FALSE}
install.packages("EFAtools")
```
You can install the development version from [GitHub](https://github.com/) with:
```{r eval=FALSE}
install.packages("devtools")
devtools::install_github("mdsteiner/EFAtools")
```
To also build the vignette when installing the development version, use:
```{r eval=FALSE}
install.packages("devtools")
devtools::install_github("mdsteiner/EFAtools", build_vignettes = TRUE)
```
## Example
Here are a few examples on how to perform the analyses with the different types and how to compare the results using the `COMPARE` function. For more details, see the vignette by running `vignette("EFAtools", package = "EFAtools")`. The vignette provides a high-level introduction into the functionalities of the package.
```{r fig.height=3}
# load the package
library(EFAtools)
# Run all possible factor retention methods
N_FACTORS(test_models$baseline$cormat, N = 500, method = "ML")
# A type SPSS EFA to mimick the SPSS implementation with
# promax rotation
EFA_SPSS <- EFA(test_models$baseline$cormat, n_factors = 3, type = "SPSS",
rotation = "promax")
# look at solution
EFA_SPSS
# A type psych EFA to mimick the psych::fa() implementation with
# promax rotation
EFA_psych <- EFA(test_models$baseline$cormat, n_factors = 3, type = "psych",
rotation = "promax")
# compare the type psych and type SPSS implementations
COMPARE(EFA_SPSS$rot_loadings, EFA_psych$rot_loadings,
x_labels = c("SPSS", "psych"))
# Average solution across many different EFAs with oblique rotations
EFA_AV <- EFA_AVERAGE(test_models$baseline$cormat, n_factors = 3, N = 500,
method = c("PAF", "ML", "ULS"), rotation = "oblique",
show_progress = FALSE)
# look at solution
EFA_AV
# Perform a Schmid-Leiman transformation
SL <- SL(EFA_psych)
# Based on a specific salience threshold for the loadings (here: .20):
factor_corres <- SL$sl[, c("F1", "F2", "F3")] >= .2
# Compute omegas from the Schmid-Leiman solution
OMEGA(SL, factor_corres = factor_corres)
```
## Citation
If you use this package in your research, please acknowledge it by citing:
Steiner, M.D., & Grieder, S.G. (2020). EFAtools: An R package with fast and flexible implementations of exploratory factor analysis tools. *Journal of Open Source Software*, *5*(53), 2521. https://doi.org/10.21105/joss.02521
## Contribute or Report Bugs
If you want to contribute or report bugs, please open an issue on GitHub or email us at markus.d.steiner@gmail.com or silvia.grieder@gmail.com.