Educational Assessment Psychometric Reliability and Factor Analysis Script
Build an R analysis script to validate psychometric survey instruments, internal consistency, and exploratory factor structures.
Use this template when evaluating survey or assessment scales in education, research, or organizational psychology. It generates an executable R script to compute Cronbach's alpha, McDonald's omega, and exploratory factor analysis.
Role: Senior Psychometrician and Quantitative Educational Measurement Specialist.
Context
- Survey instrument: {{survey_instrument}}
- Evaluated respondents: {{target_respondents}}
- Scale measurement format: {{likert_scale_levels}}
- Theoretical construct count: {{dimension_count}}
- Data file location: {{data_source_path}}
- Imputation protocol: {{missing_data_strategy}}
Task
Develop an R script that ingests response data from {{data_source_path}}, executes comprehensive item-level psychometric diagnostics, evaluates internal consistency, and fits an exploratory factor model for {{survey_instrument}} administered to {{target_respondents}}.
Method
- Load core psychometric packages (
psych,lavaan,GPArotation,tidyverse) with version checks. - Construct data intake pipeline reading {{data_source_path}} with automated data validation.
- Execute preprocessing and handle non-responses using {{missing_data_strategy}} appropriate for {{likert_scale_levels}} data.
- Compute item-level descriptive statistics, skewness, kurtosis, and item-rest correlations.
- Calculate internal consistency coefficients including Cronbach's alpha and McDonald's hierarchical omega.
- Perform Bartlett's test of sphericity and Kaiser-Meyer-Olkin (KMO) measure of sampling adequacy.
- Execute Exploratory Factor Analysis (EFA) targeting {{dimension_count}} factors with polychoric correlation matrices.
- Apply oblimin or varimax factor rotation, outputting standardized loadings, communalities, and model fit indices.
Constraints
- Code MUST execute successfully in base R / R 4.2+ using standard tidyverse and psych ecosystems.
- Script MUST handle ordinal Likert-scale properties via polychoric correlation matrix calculations.
- MUST NOT suppress or hide item loadings below standard retention thresholds without explicit log warnings.
- Provide exhaustive commentary explaining psychometric interpretative thresholds (e.g., KMO > 0.70, Alpha > 0.80).
Output format
Provide a standalone, fully runnable R script (.R) organized into:
- Global Constants & Parameter Setup utilizing {{dimension_count}} and {{missing_data_strategy}}.
- Data Ingestion & Sanitization Pipeline (min 20 lines).
- Scale Reliability & Internal Consistency Function Suite (min 30 lines).
- Factor Analytic Engine & Model Evaluation Routine (min 35 lines).
- Summary Output Dispatcher printing clear diagnostic tables.
Self-review
- Confirm polychoric matrix calculation is utilized when handling {{likert_scale_levels}}.
- Check that {{dimension_count}} correctly drives the factor extraction routine.
- Ensure clear error messaging if data rows contain complete column missingness.
Explicit role, a named task, and discrete steps the model can follow.
Background, inputs and variables the model needs before it starts.
Hard boundaries — what the model must and must not do.
A named, field-level shape for the response.
Ordered work items that force analysis before an answer.
Length and structure that travel across frontier models.
Signal density — instruction weight without padding.
Documented variables so the scaffold adapts to new inputs.
Quality bar, assumptions and behaviour when inputs are thin.
How much real usage the template has behind it.