rk.efa: Exploratory Factor Analysis in RKWard
An RKWard GUI Plugin for Psychometrics and Exploratory Factor Analysis (EFA)
rk.efa brings the gold-standard psychometric capabilities of the psych package directly into the RKWard graphical interface. Designed for psychologists, social scientists, and data analysts, this plugin allows users to seamlessly test assumptions, extract latent factors, apply advanced rotations, and visualize factor structures without writing complex R code.
The suite is divided into three logical components that mirror the professional workflow of an Exploratory Factor Analysis.
🌟 Key Features
-
Zero-Code EFA Workflow: Perform robust Exploratory Factor Analysis with a point-and-click interface, from assumption checking to final visualizations.
-
Polychoric Support: Seamlessly compute polychoric correlation matrices (ideal for ordinal/Likert scale items) alongside standard Pearson correlations.
-
"Focus Magic" UX: The user interface features smart variable selectors. When you select a dataframe, the available variables list instantly filters to show only the columns within that specific dataframe.
-
Memory-Optimized Graphics: Implements aggressive structural memory cleanup (
emptyenv() and rm()). Heavy plots (like correlation heatmaps using ggcorrplot) are pruned of captured data environments, resulting in ultra-lightweight saved plot objects (~15 KB) instead of dragging massive raw datasets into your .RData workspace.
-
Multilingual Ready: Fully prepared for translation into English, Spanish, French, German, and Portuguese (Brazil).
What's New in Version 0.0.3
📊 Non-Parametric Support & UI Consistency
-
Expanded Correlation Methods: Added support for Spearman (Ranked) and Kendall (Tau-b) correlations. You can now robustly evaluate the factorability of non-parametric and strictly ordinal data before extraction.
-
Color Scale Control: Added a toggle to invert the correlation heatmap's color scale (Red for -1, Blue for 1), allowing you to maintain visual consistency with other standard statistical software (like JASP or SPSS).
-
Robust Object Saving: Refactored the backend to strictly adhere to RKWard's native assignment engine. You can now seamlessly rename and independently save both the raw mathematical Correlation Matrix and the Plot Object directly to your Global Environment for further downstream analysis (e.g., exporting them with
rk.flextable or using "Plots -> Factor analysis -> Correlation plot" from RKWard's rk.FactorAnalysis plug-in.
What's New in Version 0.0.2
📈 Visual Diagnostics & Rotation Comparison
-
New Component - Compare Rotations: Added a dedicated 4th module to visually diagnose and compare how different rotation methods (Varimax, Quartimax, Promax, Oblimin, etc.) affect the factor structure.
-
Smart Grid Layouts: You can now select multiple rotations simultaneously via checkboxes. The plugin automatically calculates the optimal plotting grid (
par(mfrow)) to display all selected Biplots side-by-side on a single canvas, making it fully compatible with RKWard's live Preview window.
-
Continued UX & i18n Polish: Extended the "Focus Magic" (dynamic variable filtering) to the new component and fully updated the internationalization dictionaries (Spanish, Portuguese, French, and German) to cover the latest UI additions.
🛠️ Usage Workflow
This plugin adds a dedicated Exploratory Factor Analysis (EFA) submenu under Analysis -> Factor analysis in RKWard.
1. Assumptions & Correlation
Check if your data is factorable before building a model.
-
Data & Options: Select your dataframe and the specific items (variables) to analyze. Choose between Pearson or Polychoric correlations.
-
Outputs: Automatically computes Kaiser-Meyer-Olkin (KMO) measure of sampling adequacy and Bartlett’s Test of Sphericity (dynamically calculating sample size based on complete cases).
-
Graphics: Renders a gorgeous correlation heatmap (
ggcorrplot) with optional Hierarchical Clustering to visually identify item groupings.
2. Factor Extraction
Build and rotate your EFA model.
-
Extraction Methods: Choose between Minimum Residual (
minres), Maximum Likelihood (ml), or Principal Axis (pa) factoring.
-
Rotations: Supports orthogonal (
varimax, quartimax) and oblique (promax, oblimin) rotations powered by GPArotation.
-
Output: Generates and saves a formal
psych::fa model object to your Global Environment, printing standard factor loadings and model fit indices to the RKWard output window.
3. Factor Plots (Visualizations)
Visualize the latent structure of the model created in Step 2.
-
Factor Tree Diagram: Generate a hierarchical tree (
fa.diagram) showing the strongest loadings of items onto their respective factors.
-
Factor Biplot: Project individuals and variables into the factor space.
-
Grouping: Optionally provide the original dataframe and a grouping factor to color-code individuals in the Biplot (e.g., color dots by Gender or Treatment Group).
4. Compare Rotations (Visual Diagnostics)
Visually diagnose and compare how different rotation methods affect your factor structure before deciding on a final model.
-
Data & Parameters: Select your dataframe and items, define the number of factors to extract, and choose your base factoring method (e.g.,
minres or ml).
-
Rotations: Use the checkboxes to select any combination of orthogonal (Varimax, Quartimax) and oblique (Promax, Oblimin) rotations you want to test simultaneously.
-
Output: The plugin automatically calculates a smart grid layout and generates side-by-side Biplots on a single canvas. You can also add a grouping variable to color-code individuals across all plots at once. This is extremely useful to evaluate in the live Preview window which rotation best achieves a simple structure for your data.
⚙️ Prerequisites
You must have RKWard installed along with the following R packages. The plugin will automatically load them when required:
install.packages(c("psych", "GPArotation", "ggcorrplot"))
🚀 Installation
You can install this plugin directly from GitHub using remotes or devtools directly in your RKWard console:
require(remotes)
install.packages("rk.efa", repos = c('https://alfcano.r-universe.dev', 'https://cloud.r-project.org'))
Once installed, restart RKWard or refresh your plugin maps, navigate to Settings -> Configure RKWard -> Plugins, and ensure rk.efa is activated.
🌍 Internationalization (i18n)
The graphical interface automatically adapts to your RKWard language settings. Supported languages include:
- 🇺🇸 English (Default)
- 🇪🇸 Spanish (Español)
- 🇫🇷 French (Français)
- 🇩🇪 German (Deutsch)
- 🇧🇷 Portuguese (Português do Brasil)
📝 License and Author
Author: Alfonso Cano (@AlfCano)
Email: alfonso.cano@correo.buap.mx
-
Assisted by: Gemini, a large language model from Google.
-
License: GPL (>= 3)
This project is licensed under the GPL (>= 3) License.