
Researchers collecting survey data often wonder whether their questions actually measure what they intend to measure. A researcher studying anxiety might design three groups of questions — one targeting physical symptoms, one targeting cognitive patterns, and one targeting behavioral responses — but how can they confirm that each group genuinely reflects a distinct underlying dimension?
Confirmatory Factor Analysis (CFA) is a statistical method used to test whether a hypothesized relationship between observed variables and their underlying latent factors holds up in real data. Rather than discovering structure from scratch, CFA starts with a theory — you specify in advance which variables measure which constructs, then use the data to evaluate how well that model fits.
CFA belongs to the broader family of structural equation modeling (SEM). It treats directly measured items (such as survey responses or test scores) as imperfect indicators of constructs that cannot be observed directly — things like intelligence, job satisfaction, or depression. These unobservable constructs are called latent variables, while the measured items are called observed variables or indicators.
The defining feature of CFA is its confirmatory nature. A researcher using CFA already has a theoretically grounded model in mind, typically drawn from prior research, expert judgment, or an established measurement framework. The analysis then produces statistical evidence that either supports or challenges that model, using fit indices, factor loadings, and other diagnostics to guide the evaluation.
This stands in direct contrast to Exploratory Factor Analysis (EFA), which imposes no prior structure and instead lets patterns in the data determine how variables cluster together. CFA is the appropriate choice when you have a clear hypothesis about factor structure and need to rigorously test it — for example, when validating a psychological scale, replicating a model from a previous study, or confirming that a questionnaire measures distinct constructs rather than one general trait.
In practice, CFA is most commonly used to assess construct validity — the degree to which a measurement instrument actually captures the theoretical construct it is designed to measure. It also enables researchers to test whether the same factor structure holds across different groups, a procedure known as measurement invariance testing.
As introduced above, CFA distinguishes between two types of variables. Observed variables (also called indicators or manifest variables) are the items you directly measure — individual questions on a survey, scores on a subtest, or ratings on a scale. Latent variables (also called factors or constructs) are the underlying dimensions that the observed variables are assumed to reflect. Because latent variables cannot be measured directly, their existence is inferred from patterns of correlation among the indicators.
For example, a researcher measuring emotional intelligence might use 12 survey items. If the theory holds that emotional intelligence comprises three dimensions — self-awareness, empathy, and emotional regulation — CFA tests whether those 12 items cluster onto those three factors in the expected pattern.
A factor loading is a numerical value that expresses the strength of the relationship between an observed variable and its assigned latent factor. Factor loadings in CFA are analogous to regression coefficients: they indicate how much change in the observed variable is associated with a one-unit change in the latent factor.
Loadings typically range from 0 to 1 in standardized form, with higher values indicating a stronger, more reliable relationship. As a general benchmark:
| Loading Value | Interpretation |
|---|---|
| ≥ 0.70 | Strong indicator; preferred in scale validation |
| 0.50 – 0.69 | Acceptable; commonly retained |
| 0.40 – 0.49 | Weak; consider revising or dropping |
| < 0.40 | Poor; indicator may not reflect the factor |
All factor loadings should be statistically significant, and at least three strong indicators per factor is recommended for a stable, well-identified model.
No observed variable captures its latent factor perfectly. CFA explicitly accounts for this imprecision through measurement error (also called residual variance or error variance). Each indicator has an associated error term representing the portion of its variance not explained by the latent factor — due to random noise, ambiguous wording, response bias, or other sources of irrelevant variation.
One of CFA’s advantages over simpler methods is that it models measurement error directly, rather than assuming indicators are perfectly reliable. This produces more accurate estimates of the relationships among constructs.
A related concept is the proportion of an indicator’s variance explained by its latent factor, known as the communality. In CFA, the squared standardized factor loading gives the communality for each indicator. For instance, a loading of 0.80 means the factor explains 64% (0.80²) of that indicator’s variance, with the remaining 36% attributed to measurement error.
When a CFA model contains more than one latent factor, the model typically estimates factor covariances (or correlations) between those factors. These values indicate the degree to which the constructs are related to one another. A high correlation between two factors (e.g., r > 0.85) may suggest that the factors are not sufficiently distinct — a concern for discriminant validity.
Researchers can also fix the correlation between factors to zero if theory demands orthogonal (uncorrelated) constructs, though this constraint is rarely defensible in social science research.
Before a CFA model can be estimated, it must be identified — meaning the data contain enough information to produce a unique solution for all unknown parameters. Identification depends on the ratio of known values (observed variances and covariances) to unknown parameters (loadings, error variances, factor variances, and covariances).
A model can be:
A practical rule of thumb for achieving identification is to constrain the scale of each latent factor, either by fixing one factor loading per factor to 1.0 (the marker variable method) or by fixing the factor variance to 1.0 (the standardization method).
Every CFA model involves choices about which parameters to fix (set to a specific value, usually 0 or 1) and which to freely estimate from the data. A loading fixed to zero means the researcher asserts that a particular indicator does not measure a particular factor — a key theoretical constraint that distinguishes CFA from EFA. Parameters left free are estimated by the software and reported in the output.
Step 1: Specify the Model
The process begins with model specification — a formal statement of the hypothesized factor structure. Drawing on theory, prior research, or an established measurement framework, the researcher defines:
This structure is often represented as a path diagram, a visual map in which latent factors appear as circles or ovals, observed variables appear as rectangles, and arrows indicate hypothesized relationships. A single-headed arrow from a factor to an indicator represents a factor loading; a double-headed curved arrow between two factors represents a covariance.
Model specification is the most consequential step in CFA. Because the model is imposed on the data rather than derived from it, a poorly specified model — one that misrepresents the true factor structure — will produce misleading results regardless of sample size or estimation quality.
Step 2: Identify the Model
Before estimation can proceed, the researcher must confirm that the model is over-identified, meaning there are more known values (observed variances and covariances) than unknown parameters to estimate. As discussed in the key concepts section, an under-identified model has no unique solution and cannot be estimated.
Two practical steps ensure identification:
Step 3: Collect and Prepare Data
CFA requires data that meet several conditions before estimation begins.
Sample size is an important consideration. While no universal minimum exists, general guidance suggests at least 100–200 observations as a floor, with larger samples (300–500+) preferred when models are complex, indicators are weakly loaded, or fit is evaluated using sensitive indices. Rules of thumb such as 10–20 observations per estimated parameter are commonly cited, though simulation research suggests that absolute sample size matters more than the ratio alone.
Scale of measurement also matters. CFA with continuous, normally distributed indicators is typically estimated using maximum likelihood (ML) estimation. Ordinal data — such as Likert-scale responses with five or fewer categories — often require alternative estimators such as weighted least squares mean and variance adjusted (WLSMV) or diagonally weighted least squares (DWLS).
Data should also be screened for missing values, univariate and multivariate outliers, and violations of multivariate normality, all of which can distort parameter estimates and fit statistics.
Step 4: Estimate the Model
With the model specified and the data prepared, the software estimates all free parameters simultaneously by finding values that minimize the discrepancy between the observed covariance matrix (the actual variances and covariances among indicators in the sample) and the model-implied covariance matrix (the variances and covariances the model predicts if its parameter estimates are correct).
Under maximum likelihood estimation — the most widely used method — this discrepancy is quantified by the fitting function:
Where:
The estimation algorithm iterates until it converges on parameter values that bring Σ(θ) as close as possible to S. The resulting estimates — factor loadings, error variances, and factor covariances — are then reported in the output.
Step 5: Evaluate Model Fit
Once the model is estimated, the central question becomes: how well does the hypothesized model reproduce the observed data? This is assessed through a combination of global fit indices and local diagnostics.
Global fit indices summarize overall model-data correspondence across all parameters simultaneously. The most commonly reported include:
| Fit Index | Full Name | Acceptable Threshold |
|---|---|---|
| χ² | Chi-square test | Non-significant (p > .05); sensitive to large N |
| CFI | Comparative Fit Index | ≥ 0.95 (good); ≥ 0.90 (acceptable) |
| TLI | Tucker–Lewis Index | ≥ 0.95 (good); ≥ 0.90 (acceptable) |
| RMSEA | Root Mean Square Error of Approximation | ≤ 0.06 (good); ≤ 0.08 (acceptable) |
| SRMR | Standardized Root Mean Square Residual | ≤ 0.08 (acceptable) |
No single index tells the complete story. Researchers typically report and interpret several indices together, flagging any inconsistencies for discussion.
Local fit diagnostics examine specific parts of the model rather than overall fit. The two most important are:
Step 6: Respecify if Necessary
When fit is inadequate, researchers may respecify the model — making theoretically justified adjustments guided by modification indices and residual diagnostics. Common respecifications include freeing correlated error terms between indicators that share method variance (e.g., two negatively worded items) or adding cross-loadings where an indicator plausibly reflects more than one factor.
Respecification must be approached with caution. Changes driven purely by statistical criteria without theoretical justification risk overfitting — tailoring the model so closely to one sample that it fails to generalize. Any post-hoc modifications should be clearly disclosed and, wherever possible, replicated in an independent sample.
Step 7: Interpret and Report Results
A well-fitting model is interpreted through its parameter estimates. Researchers examine:
Factor analysis comes in two forms — exploratory and confirmatory — and choosing between them is one of the most consequential methodological decisions a researcher faces. Although both techniques model the relationships between observed variables and latent factors, they differ fundamentally in purpose, logic, and the constraints placed on the model.
The Core Distinction
Exploratory Factor Analysis (EFA) is a data-driven technique. The researcher specifies the number of factors to extract but imposes no prior constraints on which indicators load onto which factors. Every indicator is free to load onto every factor simultaneously, and the resulting pattern of loadings is then interpreted to infer what each factor represents. EFA is appropriate when theory is underdeveloped, when a new scale is being constructed, or when the researcher genuinely does not know how variables will cluster.
Confirmatory Factor Analysis (CFA), by contrast, is theory-driven. The researcher specifies in advance exactly which indicators load onto which factors, fixes all cross-loadings to zero unless theory demands otherwise, and uses the data to evaluate whether that pre-specified structure holds. CFA is appropriate when a clear factor structure has already been proposed or previously identified and the goal is to test it rigorously.
The difference is not merely technical — it reflects a fundamentally different relationship between theory and data. EFA asks: What structure do these data suggest? CFA asks: Does this hypothesized structure fit these data?
Key Differences at a Glance
| Feature | EFA | CFA |
|---|---|---|
| Purpose | Discover factor structure | Test a hypothesized factor structure |
| Prior theory required | No | Yes |
| Cross-loadings | All estimated freely | Fixed to zero by default |
| Error covariances | Not typically modeled | Can be specified if justified |
| Factor correlations | Determined by rotation method | Freely estimated or fixed |
| Model fit evaluation | Limited; relies on interpretability | Formal fit indices (CFI, RMSEA, etc.) |
| Confirmatory power | Low | High |
| Risk | Over-extraction; arbitrary interpretation | Model misspecification; confirmation bias |
Constraints and Cross-Loadings
One of the most practically significant differences between EFA and CFA concerns cross-loadings — the extent to which a single indicator reflects more than one factor. In EFA, every indicator loads onto every factor; the researcher applies a rotation method (such as oblimin or varimax) to simplify the pattern and then interprets the result. Indicators with large loadings on multiple factors are common and expected.
In CFA, cross-loadings are fixed to zero by default. A researcher who assigns an indicator to Factor A is asserting that it carries no systematic relationship with Factors B, C, or D. This is a strong theoretical claim, and when it is incorrect — when an indicator genuinely reflects more than one construct — the model fit will suffer and modification indices will flag the omitted path.
This constraint gives CFA its confirmatory power but also its primary vulnerability. If the pre-specified structure is wrong, CFA will detect the misfit but cannot identify the correct structure on its own.
When to Use Each Method
The choice between EFA and CFA should be guided by the state of theory and the stage of the research program, not by which method is more familiar or more likely to produce favorable results.
Use EFA when:
Use CFA when:
Using EFA and CFA Together
In practice, the two methods are often used in sequence within the same research program. EFA is conducted on one sample to identify a plausible factor structure, and CFA is then conducted on an independent sample to confirm it. This two-stage approach is particularly common in scale development, where the exploratory phase generates a candidate model and the confirmatory phase subjects it to a formal test.
Critically, running EFA and CFA on the same dataset and reporting the CFA as confirmatory is a methodological error. When the CFA model is derived from patterns in the same data it is then tested on, the analysis is exploratory in practice regardless of the label applied. Independent samples — or at minimum, a random split of the available data into development and validation subsets — are required for the confirmatory step to be meaningful.
A Note on Exploratory Structural Equation Modeling (ESEM)
A hybrid approach called Exploratory Structural Equation Modeling (ESEM) has gained traction in recent years as a middle ground between EFA and CFA. ESEM estimates cross-loadings freely (like EFA) while still producing formal fit indices and allowing the full apparatus of SEM (like CFA). It is particularly useful in domains — such as personality research and educational measurement — where indicators are expected to reflect multiple factors to some degree, and where forcing zero cross-loadings in a standard CFA model would be theoretically unrealistic.
Estimating a CFA model produces parameter estimates, but those estimates are only meaningful if the model itself adequately represents the data. Model fit refers to the degree of correspondence between the covariance structure implied by the hypothesized model and the covariance structure actually observed in the sample. Evaluating fit is not a single test but a judgment informed by multiple indices, each capturing a different aspect of model-data correspondence.
When a CFA model is estimated, the software produces a model-implied covariance matrix — the pattern of variances and covariances among indicators that would be expected if the hypothesized factor structure were exactly correct. This matrix is compared against the observed covariance matrix computed directly from the sample data. The smaller the discrepancy between these two matrices, the better the fit.
Perfect fit — where the model-implied and observed covariance matrices are identical — is theoretically possible only in a just-identified model, where the number of estimated parameters exactly equals the number of known values. In practice, researchers aim for close fit: a model that reproduces the observed covariance structure well enough that the remaining discrepancy can be attributed to sampling error rather than systematic model misspecification.
The foundational test of model fit in CFA is the model chi-square (χ²). It tests the null hypothesis that the model-implied covariance matrix exactly equals the population covariance matrix. A non-significant χ² (p > .05) indicates that the discrepancy between the two matrices is no larger than would be expected from sampling error alone — in other words, the model fits.
In practice, however, χ² has well-documented limitations:
Because of these limitations, χ² is rarely used as the sole criterion for fit evaluation. It is reported as a matter of convention and interpreted alongside approximate fit indices.
Approximate fit indices were developed to overcome the limitations of χ² by evaluating how closely — rather than exactly — a model fits the data. They fall into two broad categories: incremental fit indices, which compare the target model against a baseline, and absolute fit indices, which assess fit without reference to a comparison model.
Incremental (or comparative) fit indices evaluate the target model relative to a null model — typically one that assumes all observed variables are uncorrelated. The most widely reported are:
Comparative Fit Index (CFI)
CFI ranges from 0 to 1, with values closer to 1 indicating better fit. It is relatively insensitive to sample size, making it one of the most dependable incremental indices. Values of ≥ 0.95 are conventionally considered good fit, and ≥ 0.90 acceptable fit.
Tucker–Lewis Index (TLI)
TLI (also called the Non-Normed Fit Index, NNFI) penalizes model complexity: adding parameters that do not meaningfully improve fit will lower TLI. Unlike CFI, TLI can exceed 1.0 in well-fitting, parsimonious models. Thresholds mirror those of CFI: ≥ 0.95 for good fit, ≥ 0.90 for acceptable.
Absolute indices assess how well the model reproduces the observed data without reference to a comparison model.
Root Mean Square Error of Approximation (RMSEA)
RMSEA estimates the amount of misfit per degree of freedom in the model, adjusting for model complexity. Lower values indicate better fit. Conventional thresholds are:
| RMSEA Value | Interpretation |
|---|---|
| ≤ 0.05 | Close fit |
| 0.05 – 0.08 | Reasonable fit |
| 0.08 – 0.10 | Mediocre fit |
| > 0.10 | Poor fit |
RMSEA is accompanied by a 90% confidence interval; a well-fitting model’s interval should include or approach zero at its lower bound. A formal test of close fit evaluates whether RMSEA ≤ 0.05 in the population (p-value for close fit, or pclose).
Standardized Root Mean Square Residual (SRMR)
Where σ^ij are model-implied covariances, sij are observed covariances, and p is the number of indicators. SRMR is the average standardized difference between observed and model-implied covariances. Values ≤ 0.08 are generally considered acceptable. Unlike RMSEA, SRMR is sensitive to the magnitude of factor loadings and tends to decrease as loadings increase.
No single fit index is sufficient. The consensus recommendation is to report a combination that includes at least one incremental index (CFI or TLI), one parsimony-adjusted absolute index (RMSEA with confidence interval), and the SRMR. The chi-square statistic and its degrees of freedom should always be reported as well.
| Index | Good Fit | Acceptable Fit | Sensitive To |
|---|---|---|---|
| χ² | p > .05 | — | Sample size, normality |
| CFI | ≥ 0.95 | ≥ 0.90 | Model complexity |
| TLI | ≥ 0.95 | ≥ 0.90 | Model complexity (penalized) |
| RMSEA | ≤ 0.05 | ≤ 0.08 | Degrees of freedom |
| SRMR | ≤ 0.06 | ≤ 0.08 | Loading magnitude |
Global fit indices summarize overall model-data correspondence, but poor fit often originates in specific parts of the model. Local fit diagnostics help identify where the model falls short.
Modification indices (MIs) estimate the expected decrease in model χ² if a currently fixed parameter were freed. Each fixed parameter receives an MI value; those exceeding 10 (a common but not universal threshold) suggest that freeing the corresponding path would meaningfully improve fit. MIs are accompanied by expected parameter change (EPC) values, which indicate the direction and magnitude of the estimated parameter if freed.
Standardized residuals are element-by-element comparisons of the observed and model-implied covariance matrices, expressed in standardized units. Residuals with absolute values greater than 2.0 indicate pairs of indicators whose relationship the model fails to reproduce adequately.
Local diagnostics are useful for diagnosing fit problems, but respecifications based on them must be theoretically justified. Freeing parameters solely because their MIs are large — without a substantive rationale — constitutes capitalization on chance and undermines the confirmatory logic of CFA.
Fit thresholds are guidelines, not absolute rules. They were established through simulation studies under specific conditions and may not generalize to all modeling contexts. Several factors complicate their interpretation:
A model that meets conventional thresholds on all reported indices, shows no large modification indices pointing to theoretically meaningful omissions, and produces standardized residuals within acceptable bounds can be considered adequately fitting. When fit is borderline, transparent reporting — including all indices, the full covariance residual matrix, and the rationale for any respecifications — allows readers to evaluate the evidence for themselves.
The most fundamental assumption in CFA is that the hypothesized model reflects the true underlying factor structure. This means the researcher has correctly identified the number of factors, assigned each indicator to the right factor, and appropriately constrained cross-loadings and error covariances.
This assumption cannot be verified by fit indices alone. A model can achieve acceptable fit while still being misspecified in ways the data cannot detect — for example, when two competing models fit equally well, or when misspecifications cancel each other out. Correct specification is primarily a theoretical judgment, grounded in prior research and substantive knowledge of the constructs being measured.
Standard maximum likelihood (ML) estimation assumes that the observed indicators follow a multivariate normal distribution. This requirement extends beyond each variable being normally distributed on its own — it requires that all linear combinations of the indicators are also normally distributed.
Violations of multivariate normality — common with Likert-scale data, skewed response distributions, or bounded scales — can produce:
How to check: Assess univariate skewness and kurtosis for each indicator (skewness > |2| and kurtosis > |7| are commonly cited thresholds for concern). Mardia’s coefficient of multivariate kurtosis provides a formal test of multivariate normality; values exceeding 3.0 (or more conservatively, the critical ratio exceeding 5.0) indicate meaningful non-normality.
Remedies: When normality assumptions are violated, consider:
CFA assumes that the correlations among indicators are explained by the latent factors — not by direct relationships among the indicators themselves. When two indicators share variance for reasons unrelated to the common factor (for example, two items sharing similar wording or response format), the model’s assumption that residuals are uncorrelated is violated.
High inter-indicator correlations that persist after accounting for the common factor produce correlated residuals, which the standard CFA model does not accommodate unless explicitly specified. Unmodeled correlated residuals inflate fit statistics and can distort factor loading estimates.
How to check: Examine the correlation matrix of indicators for pairs with very high correlations (r > 0.85–0.90). After model estimation, inspect standardized residuals for large off-diagonal values, which signal pairs of indicators whose relationship the model underpredicts.
Remedy: When correlated residuals are theoretically justified — for example, two negatively worded items on the same scale, or two items administered on the same occasion — they can be explicitly freed in the model. This respecification should be grounded in substantive reasoning, not driven purely by modification indices.
Local independence is the assumption that, after accounting for the common latent factor(s), the residuals of all indicators are uncorrelated with one another. In other words, once the factor is controlled for, knowing a respondent’s score on one indicator should provide no additional information about their score on any other indicator.
This assumption is closely related to the absence of correlated residuals discussed above and is central to the logic of factor analysis: if a common factor fully explains the shared variance among indicators, no systematic covariance should remain in the residuals.
Violations of local independence frequently arise from:
CFA is a large-sample technique. The accuracy of ML parameter estimates, standard errors, and fit indices depends on having enough observations to stably estimate all free parameters. Small samples produce unstable estimates, inflated standard errors, and fit indices that are poorly calibrated against established thresholds.
Commonly cited minimum guidelines include:
| Guideline | Recommended Minimum |
|---|---|
| Absolute floor | N ≥ 100–200 |
| Per estimated parameter | 10–20 observations |
| Per indicator | 5–10 observations |
| Complex models or weak loadings | N ≥ 300–500 |
These thresholds are approximate and interact with other model features. Models with many strong indicators per factor can achieve stable estimates with smaller samples; models with weak loadings, few indicators, or many factors require larger samples. Simulation studies and a priori power analysis — using tools such as the semTools package in R — offer more principled guidance for specific model configurations.
CFA assumes that the relationships between latent factors and their observed indicators are linear. The factor loading model posits that each indicator is a linear function of its latent factor plus error:
Where is the observed indicator, is the factor loading, is the latent factor, and is the residual.
If the true relationship between a latent variable and an indicator is nonlinear — for example, if anxiety has a threshold effect on physiological indicators rather than a linear dose-response relationship — standard CFA will misrepresent it.
How to check: Examine scatterplots between pairs of indicators. Strong nonlinear patterns suggest that linear factor models may be inappropriate for some variable pairs.
While moderate correlations among indicators are expected and desirable in CFA (they reflect the influence of the common factor), perfect or near-perfect multicollinearity — where one indicator is a linear combination of others — causes computational problems. The observed covariance matrix becomes singular or nearly singular, making inversion impossible and estimation unstable.
In practice, this most commonly arises when scale total scores or subscale averages are included alongside their constituent items, or when redundant items are inadvertently included in the model.
How to check: Compute the determinant of the observed covariance matrix; values at or near zero indicate singularity. Variance Inflation Factors (VIFs) among indicators can also flag near-collinear relationships.

CFA is available in several statistical software environments, each with its own syntax and output conventions. This section walks through the full procedure in R (lavaan), Stata, and Python (semopy) — the three most commonly used platforms — using a consistent worked example throughout.
A researcher is validating a 9-item psychological wellbeing scale. Theory proposes three latent factors, each measured by three indicators:
The three factors are permitted to correlate freely. Sample size is N = 300.
The lavaan package is the most widely used CFA tool in R. It uses a readable model syntax, produces comprehensive output, and integrates with the semTools package for reliability estimates and invariance testing.
Step 1: Install and load packages
r
install.packages(c("lavaan", "semTools"))
library(lavaan)
library(semTools)
Step 2: Define the model
lavaan uses the =~ operator to define factor-indicator relationships. Each line specifies a latent factor and its indicators.
r
model <- '
autonomy =~ aut1 + aut2 + aut3
competence =~ comp1 + comp2 + comp3
relatedness =~ rel1 + rel2 + rel3
'
By default, lavaan fixes the first indicator loading for each factor to 1.0 (the marker variable method) to set the factor scale. Factors are allowed to correlate freely unless otherwise constrained.
Step 3: Fit the model
r
fit <- cfa(model, data = wellbeing_data, estimator = "ML")
For ordinal Likert data, replace estimator = "ML" with estimator = "WLSMV".
Step 4: Inspect the output
r
summary(fit, fit.measures = TRUE, standardized = TRUE)
Key sections in the output:
Std.all column)Step 5: Extract fit indices
r
fitMeasures(fit, c("chisq", "df", "pvalue", "cfi", "tli", "rmsea",
"rmsea.ci.lower", "rmsea.ci.upper", "srmr"))
Step 6: Inspect modification indices
r
modindices(fit, sort = TRUE, maximum.number = 10)
This returns the 10 largest modification indices, each accompanied by the expected parameter change (EPC). Look for values above 10 that have a plausible theoretical interpretation before considering any respecification.
Step 7: Compute reliability estimates
r
reliability(fit)
This returns Composite Reliability (CR) and Average Variance Extracted (AVE) for each factor — the two key indicators of convergent validity.
Sample output (standardized loadings):
| Indicator | Factor | Std. Loading | SE | z | p |
|---|---|---|---|---|---|
| aut1 | Autonomy | 0.81 | 0.04 | 19.2 | < .001 |
| aut2 | Autonomy | 0.76 | 0.05 | 15.7 | < .001 |
| aut3 | Autonomy | 0.78 | 0.05 | 16.3 | < .001 |
| comp1 | Competence | 0.83 | 0.04 | 20.1 | < .001 |
| comp2 | Competence | 0.79 | 0.04 | 17.8 | < .001 |
| comp3 | Competence | 0.74 | 0.05 | 14.9 | < .001 |
| rel1 | Relatedness | 0.80 | 0.04 | 18.6 | < .001 |
| rel2 | Relatedness | 0.77 | 0.05 | 16.1 | < .001 |
| rel3 | Relatedness | 0.72 | 0.05 | 14.2 | < .001 |
All loadings exceed 0.70 and are statistically significant, supporting strong indicator reliability.
Sample fit indices:
| Index | Value | Threshold | Verdict |
|---|---|---|---|
| χ²(24) | 31.4 | p > .05 | p = .14 ✓ |
| CFI | 0.98 | ≥ 0.95 | ✓ |
| TLI | 0.97 | ≥ 0.95 | ✓ |
| RMSEA | 0.038 | ≤ 0.06 | ✓ |
| SRMR | 0.042 | ≤ 0.08 | ✓ |
The model demonstrates close fit across all reported indices.
Useful lavaan resources:
Stata’s sem command provides a flexible interface for structural equation modeling, including CFA. Stata users who prefer graphical model building can use the SEM Builder (sembuilder), which generates syntax automatically.
Step 1: Define and fit the model
stata
sem (autonomy -> aut1 aut2 aut3) ///
(competence -> comp1 comp2 comp3) ///
(relatedness -> rel1 rel2 rel3), ///
method(ml) standardized
Stata uses the -> operator to indicate that a latent variable predicts its indicators. The standardized option returns standardized coefficients alongside unstandardized estimates.
For ordinal data, replace method(ml) with method(adf) or use gsem with an ordinal family specification.
Step 2: Request fit statistics
stata
estat gof, stats(all)
This returns the chi-square test, CFI, TLI, RMSEA (with confidence interval), SRMR, and several additional indices including the AIC and BIC for model comparison.
Step 3: Inspect modification indices
stata
estat mindices
Step 4: Retrieve standardized results
stata
estat stdize
Or include standardized in the original sem command to display standardized loadings in the main output table.
Step 5: Display factor correlations
stata
sem, coeflegend
estat correlation
Useful Stata resources:
semopy is a Python library for structural equation modeling that follows a lavaan-style model syntax, making it straightforward for users already familiar with R. It supports maximum likelihood estimation and produces standardized output compatible with standard reporting conventions.
Step 1: Install semopy
bash
pip install semopy
Step 2: Import and define the model
python
import semopy
import pandas as pd
model_desc = """
autonomy =~ aut1 + aut2 + aut3
competence =~ comp1 + comp2 + comp3
relatedness =~ rel1 + rel2 + rel3
"""
Step 3: Fit the model
python
model = semopy.Model(model_desc)
result = model.fit(wellbeing_data)
wellbeing_data should be a pandas DataFrame with columns matching the indicator names in the model description.
Step 4: Inspect parameter estimates
python
estimates = model.inspect(std_est=True)
print(estimates)
The std_est=True argument adds a column of standardized estimates to the output table. The output includes factor loadings, error variances, and factor covariances with standard errors and z-statistics.
Step 5: Retrieve fit statistics
python
stats = semopy.calc_stats(model)
print(stats.T)
This returns a transposed DataFrame of fit indices including chi-square, CFI, TLI, RMSEA, SRMR, AIC, and BIC.
Step 6: Visualize the path diagram
python
semopy.semplot(model, "cfa_diagram.png", std_est=True)
This generates a path diagram with standardized loadings annotated on each arrow, saved as a PNG file.
Useful semopy resources:
| Feature | R (lavaan) | Stata | Python (semopy) |
|---|---|---|---|
| Syntax style | Formula-based (=~) | Arrow-based (->) | Formula-based (=~) |
| Default estimator | ML | ML | ML |
| Ordinal data support | WLSMV, DWLS | ADF, GSem | Limited |
| Fit indices | Comprehensive | Comprehensive | Core indices |
| Modification indices | Yes (modindices()) | Yes (estat mindices) | Limited |
| Reliability estimates | Yes (semTools) | Manual calculation | Manual calculation |
| Path diagram output | Yes (semPlot package) | Yes (SEM Builder) | Yes (semplot()) |
| Cost | Free | Commercial license | Free |
| Best for | Academic research | Existing Stata users | Python workflows |
For most academic and applied research contexts, lavaan in R remains the most fully featured and widely documented option, with the broadest support for advanced procedures such as measurement invariance testing, robust standard errors, and multiple-group CFA. Stata is the natural choice for researchers already embedded in that environment. semopy is well suited for integration with Python-based data pipelines, though its fit diagnostics and post-estimation tools are less extensive than lavaan’s.