Scree plot

How many dimensions describe digital skills in 300 occupations? Variance per component and a parallel-analysis cut-off.

Scree plot

How many principal components are worth keeping? Bars show the share of variance carried by each component, the orange line the running total. The grey dashed line is Horn's parallel analysis: the 95th percentile of the same eigenvalues computed on random, uncorrelated data of the same size. A component is retained (blue) only if it beats that noise floor; the dotted line marks the older Kaiser rule (eigenvalue > 1).

The setting is Aubert, Bourdeau, Warin, Schneider & Sénegas (2026), "Digital skills assessment in jobs in Canada" (Journal for Labour Market Research): 300 occupations, each scored on 10 digital-skill indicators (office software, data entry, web search, e-mail, online collaboration, social media, content creation, data analysis, programming, cybersecurity). The scores are simulated with numpy (seeded) from three latent skill dimensions plus a weak fourth one, for illustration; they are not the paper's data or results. Eigenvalues of the correlation matrix come from numpy.linalg.eigvalsh; the parallel analysis is 500 seeded simulations. As often, parallel analysis is stricter than the Kaiser rule: the weak fourth dimension passes λ > 1 but not the noise floor.

scree-plot.py · 49 lines
Download GitHub
import matplotlib.pyplot as plt
import numpy as np
from sklearn.preprocessing import StandardScaler

# Simulated data, set in the context of Aubert et al. (2026) [aubert2026]
# 300 occupations x 10 digital-skill scores driven by 3 latent skills (+ a weak 4th)
rng = np.random.default_rng(2026)
F = rng.normal(size=(300, 4))  # basic office, communication, advanced technical, weak niche
L = np.array([[.8, 0, 0, 0], [.75, 0, 0, 0], [.6, .3, 0, 0], [.5, .5, 0, 0], [.2, .7, .1, .5],
              [0, .75, 0, 0], [0, .6, .3, -.5], [.2, 0, .75, 0], [0, 0, .8, 0], [0, .1, .6, .5]])
X = StandardScaler().fit_transform(F @ L.T + rng.normal(0, 0.55, (300, 10)))
n, p = X.shape
eig = np.sort(np.linalg.eigvalsh(np.corrcoef(X.T)))[::-1]  # PCA eigenvalues
pct = 100 * eig / eig.sum()

# Horn's parallel analysis: eigenvalues of pure noise, 95th percentile
rng = np.random.default_rng(42)
sims = [np.sort(np.linalg.eigvalsh(np.corrcoef(rng.normal(size=(n, p)).T)))[::-1]
        for _ in range(500)]
pa = np.percentile(sims, 95, axis=0)
keep = eig > pa
k = np.arange(1, p + 1)

fig, ax = plt.subplots(figsize=(8, 5))
ax.bar(k, pct, width=0.68, color=np.where(keep, "#007AFF", "#C7C7CC"), zorder=2)

# Cumulative share, parallel-analysis floor and Kaiser threshold (all in % of variance)
cum = np.cumsum(pct)
ax.plot(k, cum, color="#FF9500", marker="o", ms=5, mfc="white", mew=1.5, zorder=3)
ax.annotate(f"{cum[keep.sum() - 1]:.0f}% with {keep.sum()} components",
            (keep.sum(), cum[keep.sum() - 1]), xytext=(12, -16), textcoords="offset points",
            fontsize=9.5, color="#FF9500", fontweight="semibold")
ax.text(p, cum[-1] - 4, "cumulative", fontsize=8.5, color="#FF9500", ha="center", va="top")
ax.plot(k, 100 * pa / p, color="#6E6E73", ls="--", lw=1.4, zorder=3)
ax.text(4.6, 100 * pa[4] / p + 1.5, "parallel analysis (noise, 95th pct.)", fontsize=8.5,
        color="#6E6E73", va="bottom")
ax.axhline(100 / p, color="#8E8E93", ls=":", lw=1.2, zorder=1)
ax.text(p + 0.4, 100 / p + 0.8, "Kaiser λ > 1", fontsize=8.5, color="#8E8E93", ha="right", va="bottom")

ax.set_xticks(k, [f"PC{i}\n{v:.1f}%" for i, v in zip(k, pct)], fontsize=8.5)
ax.set_xlim(0.4, p + 0.6)
ax.set_ylim(0, 105)
ax.set_ylabel("Variance explained (%)")
ax.set_title(f"Parallel analysis retains {keep.sum()} of {p} components; Kaiser would keep "
             f"{(eig > 1).sum()}", pad=26)
ax.text(0, 1.02, f"PCA of {p} skill scores · n = {n} occupations (simulated) · λ = "
        f"{', '.join(f'{e:.2f}' for e in eig[:4])}, … · PA: 500 simulations",
        transform=ax.transAxes, fontsize=9.5, color="#6E6E73")
plt.show()

Figures use the optional PyStatlas style: add plt.style.use("pystatlas.mplstyle") to match the look exactly.

Data source

  • Simulated data. Simulated data with a fixed random seed, created for this example.
    No real respondents, documents or measurements: the numbers only illustrate how the chart and its statistics work.
  • Aubert et al. (2026), digital skills in Canadian jobs. Aubert, B., Bourdeau, S., Warin, T., Schneider, J., & Sénegas, T. (2026). Digital skills assessment in jobs in Canada. Journal for Labour Market Research, 60(1), 18. https://doi.org/10.1186/s12651-026-00440-6
    The example is set in the context of this paper; unless its description says otherwise, the numbers are simulated and are not the paper's data or results.

The examples illustrate statistical methods. Their numbers are simulated unless an entry says otherwise, and their titles describe what each figure shows in these simulated data — not findings of the cited papers, nor the author's position on the substantive question. For results, context and data, rely on the papers cited here.

How to cite

PyStatlas is created and maintained by Thierry Warin. If it helped your work, please cite it.

Warin, T. (2026). Scree plot. In PyStatlas: A Python Gallery of Statistical Graphics for the Social Sciences (Version 1.1.0) [Computer software]. https://warin.ca/pystatlas/multivariate/scree-plot/

@misc{warin2026statlas,
  author       = {Warin, Thierry},
  title        = {PyStatlas: A Python Gallery of Statistical Graphics for the Social Sciences},
  year         = {2026},
  version      = {1.1.0},
  howpublished = {\url{https://warin.ca/pystatlas/}},
  note         = {Source code: https://github.com/warint/pystatlas}
}

More in Multivariate & clustering