knitr::opts_chunk$set(collapse=TRUE, comment="##", fig.retina=2, fig.path = "README_figs/README-")
EFAshiny
is an user-friendly application for exploratory factor analysis (EFA; Bartholomew, Knott, & Moustaki, 2011). The graphical user interface in shiny (Chang, Cheng, Allaire, Xie, & McPherson, 2017) is designed to free users from scripting in R by wrapping together various packages for data management, factor analysis, and graphics. Easy-to-follow analysis flow and reasonable default settings avoiding common errors (Henson & Roberts, 2006) are provided. Results of analysis in tables and graphs are presented on-line and can be exported.
Key features include:
The EFAshiny
application is primarily aimed at behavioral researchers who want to perform EFA on a set of associated variables (e.g., item-level scale dataset). Note that it can also be used to explore FA-based connectivity analyses (McLaughlin et al., 1992) in instrument data, such as event related potentials (ERPs) and functional near-infrared spectroscopy (fNIRS) data. Though the major focus of EFAshiny
is to perform EFA, it is worth noting that confirmatory factor analysis (CFA) is an useful future direction for shiny
APP.
To run EFAshiny
on your R, devtools
and shiny
are required.
install.packages("devtools") install.packages("shiny")
Install and launch EFAshiny
:
devtools::install_github("PsyChiLin/EFAshiny") EFAshiny::EFAshiny()
If you want to use the standard version of EFAshiny
, installation is not required. The application is deployed on shinyapps.io server. This standard version has all the function except for the Editor
tab (which is only useful for users who want to code online). Users can easily explore and analyze their data with this online APP without worrying about installation.
Have fun with EFAshiny
: https://psychilin.shinyapps.io/EFAshiny/
EFAshiny
adopts exploratory factor analysis (EFA, Bartholomew, Knott, & Moustaki, 2011), a widely used method to investigate the underlying factor structure that can be used to explain the correlations in a set of observed indicators, as the major procedure in the application. EFA can be useful in lots of situations. For example, it can be used to conceptualize new constructs, to develop instruments, to select items as a short form scale, or to organize observed variables into meaningful subgroups. Major procedures of EFA included correlation coefficients calculation, number of factors determination, factor extraction, and factor rotation. In addition to the aforementioned steps of EFA, data explorations should be conducted before using EFA, and interpreting the results after using EFA is also an important step. Since that EFA is helpful to account for the relationship between numerous variables, its use has permeated fields from psychology to business, education and clinical domain.
When you open EFAshiny
, the interface will be shown.
In the Introduction
tab, you can see the main features for EFAshiny
, a demo figure, and some key references.
The data sets that required the implementations of EFA are typically in a wide format, i.e., one observation per row.
They are composed of a set of responses in one or more psychometric tests in Likert scale.
In the Data Input
tab, users can upload the data.
If no data is uploaded, EFAshiny
will use the Rosenberg Self-Esteem Scale dataset to perform the default demostrations.
After uploading the data, the exploratory data analysis should be conducted.
In Data Summary
tab, three types of explorations are provided.
plotly
package. In other words, they can be played dynamically. Try it with some clicks !Correlation Matrix
tab using corrplot
package, we also provide a ggcorrplot
version. Have fun with those plots and further get some intuitions.Note that the provided correlation matrix is the basis of EFA, which is a procedure that aim to investigate the underlying structure from the correlations between variables, so either calculating or visualizing the correlation matrix will be really important.
One of the central idea of the EFA is to represent a set of observed variables by a smaller number of factors. Thus, selecting how many factors to retain is a critical decision.
In Factor Retention
tab, a set of indices to determine numbers of factor are provided.
In addition, Sample Size is another option for users to validate the results for factor retentions by randomly adjusting different Sample Size.
Although users still have to determine the number of factors upon their own decisions, EFAshiny
provides users several indices without worrying on methods implementations.
The major step of EFA is to extract and rotate the factors structure, further estimating the factor loadings.
In Extraction and Rotation
tab, several factor extraction and rotation methods are available, and the boostrapping for estimating confidence intervals of factor loadings is also provided to aide in interpretations.
By providing plenty of factor extraction methods, rotation methods, and useful interval estimations of factor loadings, EFAshiny
is not only helpful for EFA newbies, but also flexible for EFA users with many experiences.
For EFA results, the fundamental visualizations is plotting the relationship between factors and indicators.
In Diagram
tab, the path diagram representation is provided by using psych
R package (Revelle, 2017).
It has the structure that all factors and indicators are represented as a bigger or smaller node, and all loadings with absolute values greater than some thresholds (e.g. 0.3) are represented as a line.
Through the graphical representations with flexible plotting options, users can easily understand the factor structure.
In Factor Loadings
tab, EFAshiny provides useful visualization of factor loadings to facilitate proper interpretations of extracted factors.
In addition to providing a table of loadings for EFA results, users can automatically get the whole picture of the EFA results through these visualizations.
We summarize, in six concrete steps, our provided flow in EFAshiny
for performing EFA.
To see the tutorial in vignettes:
browseVignettes("EFAshiny")
By following this analysis flow in EFAshiny
, users without any knowledge of programming are able to perform EFA and obtain great understandings for their own studies.
In addition to the GUI, we also provide an Editor
tab with several code demonstrations in the Github version of EFAshiny
. In this Editor
mode (see figure below), we already present some quick examples allowing users to perform similar analyses in EFAshiny
GUI. Users can also write their own R code here. With this feature users might have the possibility to use EFAshiny
within a script pipeline. In general, this cool feature allow users to learn R, understand the code underlying analyses in EFAshiny
or automate the analyses in the future.
Note that this feature can also allow the use of lavaan
R package to perform confirmatory factor analysis (CFA), which is also a widely used method but not the main focus of EFAshiny
. Simply input require(lavaan)
should work (see lavaan package for details). Another useful tool is the showcase
version of shiny
when running the APP ( definitely, you can directly see the code in server.R
and ui.R
).
In summary, Users who want to further understand EFAshiny
or learn R
can (1) see the code in Editor
tab of github version EFAshiny
GUI (as shown in figure), (2) download the R markdown file similar to the code in editor mode here, (3) see the same R markdown file in this public link, (4) use showcase
function in shiny
, and (5) directly see the code in server.R
and ui.R
.
The dataset for demonstration is the 10-items Rosenberg Self-Esteem Scale (RSE; Rosenberg, 1965) via an online platform for psychological research. The RSE was recorded in 1 to 4 Likert scale, where higher scores indicated higher agreements for the items (1=strongly disagree, 2=disagree, 3=agree, and 4=strongly agree). Previous studies suggested that the RSE could be treat as a one factor un-dimensional scale, which simply assessed a positive self-evaluation construct, or a two factor bi-dimensional scale, where one factor is proposed to assess positive self-esteem (e.g. I feel that I have a number of good qualities) with another measuring negative self-esteem (e.g. At times I think I am no good at all). EFAshiny
already implements a 256 participants RSE data as a built-in dataset, but RSE.csv with codebook can also be directly downloaded.
bootnet
(Epskamp, 2017)corrplot
(Taiyun & Viliam, 2017)EFAutilities
(See Zhang, 2014 for detail)reshape2
(Wickham, 2014)EGA
(Golino & Epskamp, 2017)ggplot2
(Wickham, 2016)ggcorrplot
(Kassambara, 2016)gridExtra
(Auguie, 2017)igraph
(Csardi & Nepusz, 2006)moments
(Komsta & Novomestky, 2013)plotly
(Sievert, et al., 2017)psych
(Revelle, 2017)psycho
(Makowski, 2018)qgraph
(Epskamp, et al., 2012)shiny
(Chang, Cheng, Allaire, Xie, & McPherson, 2017)shinytheme
(Chang, 2016)Chi-Lin Yu : Department of Psychology, National Taiwan University, Taiwan
Ching-Fan Sheu : Institute of Education, National Cheng Kung University, Taiwan
If you have a question, comment, concern or code contribution about EFAshiny
, please send us an email at psychilinyu@gmail.com.
Please cite as:
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.