Foundations to Frontier
Tests
D. Classical Machine Learning › D9 Dimensionality Reduction and Manifold Learning

Factor Analysis

Factor analysis models observed variables as linear combinations of a few unobserved factors plus independent noise, with each variable allowed its own noise variance (its uniqueness). The covariance is then ΛΛᵀ + Ψ with Ψ diagonal. Unlike PCA, which explains all variance, factor analysis separates shared variance (communality) from variable-specific variance, so noisy variables are not mistaken for structure, and the model is equivariant to rescaling variables. It is fitted by maximum likelihood, usually via EM. Loadings are identified only up to rotation, which motivates rotations such as varimax for interpretability. This page covers the model, communalities and uniquenesses, EM, Heywood cases, rotation, factor scores, choosing the number of factors, and the contrast with PCA and PPCA. In the exercises you implement EM for factor analysis and varimax; then you measure how unequal noise biases PCA but not factor analysis.

Level 0: Foundation

★☆☆☆☆ Introductory⏱ 5 minGeneral audience. No mathematics required.

Shared causes versus individual noise

Imagine eight sensors, four driven by engine temperature and four by vibration, each with its own amount of measurement noise. Factor analysis asks what hidden factors explain what the variables have in common. It splits each variable’s variance into two parts:

  • the part due to shared factors (communality);
  • the part that is the variable’s own noise (uniqueness).

PCA lumps them together, so a very noisy sensor can look important to PCA. Factor analysis knows it’s just noisy.

Factor analysis: shared factors plus each variable's own noise
A1A2A3A4B1B2B3B4
Bars per variable: true communality (grey), factor analysis (orange), "communality" of 2 PCA components (blue). Circles: true noise variance (hollow) and FA's estimate (filled).
With equal noise (1×), PCA and FA agree. As noise becomes unequal, PCA credits the noisiest variables with lots of "shared" variance: their large noise variance looks like structure to a method that assumes equal noise. Factor analysis estimates each variable's noise separately, so its communalities stay close to the truth and its noise estimates track the hollow circles.
Why engineers care

Sensors differ in precision. A model that treats all noise as equal will chase the noisiest channel. Factor analysis gives honest estimates of shared structure and of each sensor’s noise level, which supports sensor validation, latent health indicators and data fusion. It is also the origin of latent-variable models used in psychometrics and human-factors research.

📝 Quick check (Level 0)
0/3 answered
  1. 1. A variable's uniqueness is…
  2. 2. Factor analysis differs from PCA mainly by…
  3. 3. With very unequal noise, PCA tends to…

Level 1: Beginner

★★☆☆☆ Basic⏱ 20 minSecondary-school mathematics: arithmetic and elementary algebra.

Communalities and the model covariance by hand

Model. x = Λz + μ + ε, with z ~ N(0, I) and ε ~ N(0, Ψ), Ψ diagonal. Then Cov(x) = ΛΛᵀ + Ψ.

Communality of variable j is the sum of its squared loadings. Loadings (0.6, 0) give 0.36; (0.6, 0.8) give 0.36 + 0.64 = 1.0.

Model covariance. With Λ = (0.8, 0.6)ᵀ and Ψ = diag(0.36, 0.64):

  • the diagonal entries are 0.64 + 0.36 = 1 and 0.36 + 0.64 = 1;
  • the off-diagonal entry is 0.8 × 0.6 = 0.48.

Standardised variables. Uniqueness = 1 − communality. A loading of 0.9 leaves uniqueness 0.19.

Parameter count. dq − q(q − 1)/2 loadings (after removing rotational freedom) plus d uniquenesses. For d = 8, q = 2: 16 − 1 + 8 = 23. The covariance has d(d + 1)/2 = 36 entries, so the model is identifiable and testable here.

The steps in plain English:

  1. Choose the number of factors q (scree, parallel analysis, likelihood ratio, BIC).
  2. Fit Λ and Ψ by maximum likelihood (EM, or direct optimisation).
  3. Rotate the loadings (varimax or oblique) for interpretability; the fit is unchanged.
  4. Interpret factors from their high loadings. Compute factor scores (posterior means) if needed.
📝 Quick check (Level 1)
0/3 answered
  1. 1. Communality for loadings (0.3, 0.4)?
  2. 2. Uniqueness of a standardised variable with communality 0.64?
  3. 3. Off-diagonal model covariance for loadings 0.5 and 0.4 on one factor?

Level 2: Intermediate

★★★☆☆ Intermediate⏱ 30 minUndergraduate students and practising engineers.

Fitting, rotating and comparing with PCA

EM for factor analysis (Rubin and Thayer, 1982).

  • E-step: β = Λᵀ(ΛΛᵀ + Ψ)⁻¹, so E[z | x] = β(x − μ) and E[zzᵀ | x] = I − βΛ + β(x − μ)(x − μ)ᵀβᵀ.
  • M-step: Λ = Sβᵀ(I − βΛ + βSβᵀ)⁻¹ and Ψ = diag(S − ΛβS).

Exercise 1 had 8 variables, 2 factors and noise variances from 0.1 to 0.8. EM recovered every uniqueness within 0.04 and every communality within 0.05.

Rotation. If Λ fits, so does ΛR for any orthogonal R. Varimax chooses R to maximise the variance of squared loadings within each factor, pushing loadings toward 0 or ±1. That gives simple structure: each variable loads mainly on one factor. Exercise 1’s varimax rotation restored the true two-block pattern. Oblique rotations (promax, oblimin) allow correlated factors.

Scale equivariance. Rescaling the variables x → Dx just rescales the loadings and uniquenesses (Λ → DΛ, Ψ → D²Ψ). The fitted model is the same. PCA has no such property: its components change with units.

FA versus PCA. With equal noise variances, FA and PPCA coincide. With unequal noise, PCA tilts toward noisy variables. In exercise 2, at a 64× max/min noise ratio, PCA’s subspace error was 0.43 against 0.10 for FA. Standardising before PCA helped partly (0.14), but it divides by each variable’s total variance rather than its noise.

Heywood cases. Sometimes ML drives a uniqueness to zero or below, meaning a variable explained “perfectly”. That signals too many factors, too little data, or misspecification. Implementations clamp Ψ at a small positive floor.

from sklearn.decomposition import FactorAnalysis
fa = FactorAnalysis(n_components=2, rotation="varimax").fit(X)
fa.components_.T            # loadings Λ (d × q)
fa.noise_variance_          # uniquenesses Ψ
Z = fa.transform(X)         # factor scores (posterior means)
🐍 Exercise 1: factor analysis by EM
Implement EM for factor analysis (diagonal noise), communalities and varimax rotation; recover loadings and uniquenesses with unequal noise, restore simple structure, and check scale equivariance.
📝 Quick check (Level 2)
0/3 answered
  1. 1. Varimax rotation aims for…
  2. 2. If variables are rescaled, FA loadings…
  3. 3. A Heywood case is…

Level 3: Advanced

★★★★☆ Advanced⏱ 25 minGraduate level, with full derivations and proofs.

Theory

Identifiability. ΛΛᵀ + Ψ determines Λ only up to rotation, and determines Ψ only if each factor has at least three variables loading on it, or similar conditions; Anderson and Rubin give conditions. The degrees of freedom of the model’s likelihood-ratio test are [(d − q)² − (d + q)]/2. That must be non-negative for the model to be testable, which limits q for given d.

Choosing q.

  • Likelihood-ratio χ² tests (over-sensitive with large n).
  • BIC.
  • Parallel analysis (Horn’s procedure originated for factor analysis).
  • Interpretability.

Factor scores. Factors are latent, so scores are only estimates.

  • Regression (Thomson) scores are posterior means E[z | x]. They are shrunk toward 0.
  • Bartlett scores are weighted least-squares estimates. They are unbiased but noisier.

For one factor with loadings (1, 1), Ψ = I and x = (1, 1), the regression score is 2/3 rather than 1.

Interview questions.

  • PCA or factor analysis? PCA for data compression and decorrelation. Factor analysis when you believe in latent causes and want shared variance separated from variable-specific noise, especially with heterogeneous measurement error.
  • Why rotate? To get interpretable loadings, since the fit is identical for every rotation. Report which rotation you used.
📝 Quick check (Level 3)
0/3 answered
  1. 1. Model degrees of freedom for d = 6, q = 2?
  2. 2. Regression factor scores are…
  3. 3. Parallel analysis was introduced for…

Level 4: Expert

★★★★★ Expert⏱ 25 minResearchers: original papers and open problems.

When does unequal noise mislead PCA?

History.

  • C. Spearman (1904) proposed a single general factor for test scores.
  • L. Thurstone (1930s) developed multiple-factor analysis and simple structure.
  • D. Lawley (1940) introduced maximum-likelihood factor analysis.
  • H. Kaiser (1958) proposed varimax.
  • D. Rubin and D. Thayer (1982) gave the EM algorithm.

Exercise 2. d = 12 variables, 2 factors with dense random loadings, n = 300, noise variances spread so that the noisiest is “ratio” times the cleanest (geometric mean 0.5), 4 datasets. Values are sin of the largest angle between the estimated and true loading subspaces.

noise ratio factor analysis PCA / PPCA PCA on standardised data
1× 0.076 0.074 0.104
4× 0.064 0.092 0.109
16× 0.079 0.225 0.129
64× 0.095 0.434 0.138
  • With equal noise, FA and PCA were equally accurate. That is the PPCA special case.
  • As noise became unequal, PCA’s error grew sixfold, while FA’s barely moved. PCA’s largest-variance directions were pulled toward the noisiest variables.
  • Standardising first helped but didn’t fix it, because it scales by total variance, not noise. Only modelling per-variable noise does.
🐍 Exercise 2 (research): heterogeneous noise
With 2 factors in 12 variables and noise variances whose max/min ratio grows from 1 to 64, compare the loading subspace recovered by factor analysis, PCA, and PCA on standardised data.

Factor analysis in AI, robotics and aerospace

  • Sensor validation: estimated uniquenesses flag channels whose noise has grown.
  • Latent health indicators: a few factors summarising many correlated degradation signals.
  • Human-factors and workload studies: classic psychometric factor models for questionnaires and physiological measures.

References

  1. D. B. Rubin, D. T. Thayer (1982). “EM algorithms for ML factor analysis.” Psychometrika 47(1).
  2. D. N. Lawley, A. E. Maxwell (1971). Factor Analysis as a Statistical Method, 2nd ed. Butterworths.
  3. H. F. Kaiser (1958). “The varimax criterion for analytic rotation in factor analysis.” Psychometrika 23.
  4. T. W. Anderson, H. Rubin (1956). “Statistical inference in factor analysis.” Proc. 3rd Berkeley Symposium 5.
  5. scikit-learn developers. “FactorAnalysis.” Documentation.