How To Run Confirmatory Factor Analysis in R

Expert confirmatory factor analysis support in R with professional statistician and ready model validation services

Confirmatory factor analysis in R allows you to test whether your data fits a predefined factor structure. Instead of exploring how items cluster, you specify the measurement model first and then evaluate how well the model matches your observed covariance matrix.

Students often lose marks at this stage because they run CFA without checking model fit correctly, misread fit indices, or report loadings without theoretical justification. Therefore, you need a structured workflow that connects theory, code, diagnostics, and interpretation.

This guide walks you through confirmatory factor analysis in R from model specification to thesis-ready reporting, with practical code examples and common error corrections.


What Confirmatory Factor Analysis Actually Tests

Confirmatory factor analysis tests whether observed variables measure specific latent constructs exactly as your theory proposes. You define which items load on which factors, and then you evaluate model fit using statistical indices.

In other words, CFA answers a direct question: does this measurement model hold in my data?

You typically use CFA when:

  • you validate an existing scale
  • theory defines factor structure clearly
  • prior EFA suggests a stable model
  • you test construct validity
  • you prepare measurement models for SEM

Required R Package for Confirmatory Factor Analysis

You will use the lavaan package for confirmatory factor analysis in R.

install.packages("lavaan")
library(lavaan)

The lavaan package provides full CFA and SEM functionality.


Example Dataset Structure

Assume you measure three constructs:

  • Motivation → items M1 M2 M3
  • Confidence → items C1 C2 C3
  • Engagement → items E1 E2 E3

Your dataset should contain numeric item columns.

data <- read.csv("survey.csv")

Step 1 — Specify the CFA Model

First, write the measurement model using lavaan syntax.

Use =~ to define factor loadings.

model <- '
Motivation =~ M1 + M2 + M3
Confidence =~ C1 + C2 + C3
Engagement =~ E1 + E2 + E3
'

This step matters because theory drives CFA. Therefore, assign items based on conceptual meaning, not guesswork.


Step 2 — Run Confirmatory Factor Analysis in R

Next, run the CFA model.

fit <- cfa(model, data = data, std.lv = TRUE)

Then print the results.

summary(fit, fit.measures=TRUE, standardized=TRUE)

Now you can evaluate loadings and fit indices.


Step 3 — Check Factor Loadings

Standardized loadings show item strength.

Guidelines:

  • above .70 = strong
  • .50–.69 = acceptable
  • below .40 = weak

Example interpretation:

All Motivation items load strongly on the latent construct, with standardized loadings between .68 and .82. Therefore, the items represent the construct well.

Remove items with very low loadings unless theory strongly supports them.


Step 4 — Evaluate Model Fit Indices

Confirmatory factor analysis in R relies heavily on fit statistics. Therefore, you must report and interpret them correctly.

Key indices:

CFI (Comparative Fit Index)
Target: ≥ .90 acceptable, ≥ .95 strong

TLI (Tucker Lewis Index)
Target: ≥ .90 acceptable

RMSEA (Root Mean Square Error of Approximation)
Target: ≤ .08 acceptable, ≤ .05 strong

SRMR (Standardized Root Mean Square Residual)
Target: ≤ .08 acceptable

Extract directly:

fitMeasures(fit, c("cfi","tli","rmsea","srmr"))

Step 5 — Check Modification Indices Carefully

Modification indices suggest model improvements. However, you must use theory, not automation.

modindices(fit, sort.=TRUE, minimum.value=10)

Only add cross-loadings or correlated errors when theory supports them. Otherwise, you overfit the model.


Step 6 — Factor Reliability and Validity

Next, compute composite reliability and AVE if needed.

library(semTools)
reliability(fit)

You should confirm:

  • composite reliability above .70
  • AVE above .50 when possible

Sample CFA Interpretation Paragraph

A confirmatory factor analysis in R tested a three-factor measurement model covering Motivation, Confidence, and Engagement. The model showed acceptable fit with CFI = .94, TLI = .92, RMSEA = .052, and SRMR = .046. All standardized factor loadings exceeded .60 and reached statistical significance. Therefore, the measurement model supports the proposed construct structure.


How Confirmatory Factor Analysis Differs From Exploratory Factor Analysis

Exploratory and confirmatory factor analysis serve different goals; therefore, you should not treat them as interchangeable.

Exploratory factor analysis discovers structure. You allow all items to load freely, and then you interpret the pattern.

Confirmatory factor analysis tests structure. You assign item–factor relationships first, and then you evaluate fit.

EFA answers: what structure exists?
CFA answers: does this structure hold?

Researchers often run EFA first and CFA second. As a result, they avoid forcing weak theoretical models onto data.


When You Should Run CFA Instead of EFA

Choose confirmatory factor analysis in R when theory defines your structure, prior studies validate the scale, or earlier EFA supports a stable model. In contrast, choose EFA when structure remains unknown.


Common Mistakes in Confirmatory Factor Analysis in R

Many students make avoidable errors. Watch for these:

  • forcing CFA without theoretical basis
  • ignoring poor fit indices
  • deleting items only to raise fit
  • adding many correlated errors
  • keeping items with weak loadings
  • reporting loadings without fit metrics
  • modifying models without justification

Each mistake weakens construct validity.


Practical Workflow Recommendation

First, run exploratory factor analysis when structure remains unclear.

Next, refine the item set. Then run confirmatory factor analysis in R on a new sample. This sequence improves measurement credibility and reviewer acceptance.

Similar Posts