StatFas.com

Blogs › Multivariate analysis · Updated 19 October 2026 · 15 min read

Principal Component Analysis (PCA): What It Is, How It Works and a Free Online PCA Tool

Principal component analysis (PCA) is a statistical technique for dimensionality reduction. It rewrites many correlated variables as a smaller set of uncorrelated principal components that keep as much of the original variation as possible. In Indonesian, PCA adalah “analisis komponen utama”, with the same meaning. This guide explains PCA analysis step by step, with the formula, an example, the PCA plots, how to interpret them, PCA vs factor analysis, R and Python code, and where to run a PCA analysis online for free.

1. What is PCA analysis?

Imagine a questionnaire with 30 items or a dataset with 50 gene-expression measures. Many of these variables move together, so they carry overlapping information. PCA finds new axes, the principal components (PCs), that are linear combinations of the original variables. The first component (PC1) captures the most variance, PC2 captures the most of what remains while being uncorrelated with PC1, and so on. You then keep only the first few components.

PC1: most variancePC2: perpendicular, less variance
Figure 1. PCA rotates the axes so PC1 lies along the direction of greatest spread and PC2 is perpendicular to it.

2. Why use PCA? Dimensionality reduction and machine learning

3. How PCA works: the formula

Table 1. PCA step by step.
StepOperationFormula
1. StandardizeCentre each variable (and scale it if units differ).z = (x − μ) / σ
2. Covariance or correlation matrixMeasure how variables vary together.C = ZᵀZ / (n − 1)
3. EigendecompositionFind eigenvectors (directions) and eigenvalues (variance).C v = λ v
4. Rank componentsSort by eigenvalue; share of variance explained.λᵢ / Σλ
5. ScoresProject the data onto the kept components.T = Z V
6. LoadingsCorrelation between a variable and a component.loading = vᵢ √λᵢ

Correlation or covariance? Use the correlation matrix (standardized data) when variables have different units, for example age in years and income in dollars. Use the covariance matrix when all variables share one unit and their raw variance matters, such as spectra or gene expression.

4. PCA example

A researcher measures six survey items on N = 300 participants. Before running PCA, check sampling adequacy: KMO = .82 (above .60 is acceptable) and Bartlett’s test χ²(15) = 612.4, p < .001, so the items are correlated enough.

Table 2. Eigenvalues and variance explained (illustrative data).
ComponentEigenvalue% varianceCumulative %
PC12.8547.547.5
PC21.5225.372.8
PC30.6811.384.2
PC40.447.391.5
PC50.315.296.7
PC60.203.3100.0

Two eigenvalues exceed 1 and together explain 72.8% of the variance, so two components are retained.

Table 3. Component loadings after retaining two components (bold = loading ≥ .40).
VariablePC1PC2Communality
Item 1.82.10.68
Item 2.78.15.63
Item 3.74.08.55
Item 4.12.85.74
Item 5.09.80.65
Item 6−.10.72.53

5. PCA plots

The PCA plot comes in three main forms. The scree plot (Figure 2) shows eigenvalues to decide how many components to keep. The score plot maps each observation on PC1 and PC2 to reveal clusters and outliers. The loading plot or biplot (Figure 3) shows how variables relate to the components.

Kaiser line (eigenvalue = 1) PC1 2.85PC2 1.52PC3 0.68PC4 0.44PC5 0.31PC6 0.20
Figure 2. Scree plot of Table 2. The curve bends after PC2, so two components are kept.
Items 1–3Items 4–6PC1 (47.5%)PC2 (25.3%)
Figure 3. Loading plot. Arrows pointing the same way are positively correlated; long arrows are well represented by the two components.

6. PCA analysis interpretation

Table 4. How to interpret PCA output.
QuestionGuideline
How many components?Eigenvalue > 1 (Kaiser, 1960), the scree elbow, parallel analysis (Horn, 1965; Hayton et al., 2004), or 60–80% cumulative variance.
Is PCA suitable?KMO ≥ .60, significant Bartlett’s test, most correlations above |.30|.
What does a loading mean?≥ .40 is meaningful; ≥ .70 is strong. Cross-loadings above .30 on two components need attention.
How well is a variable represented?Communality: share of its variance explained by the kept components (aim for ≥ .40).
What do scores show?Position of each case on a component; distant points are potential outliers.
Naming componentsName each PC after the variables loading highly on it, and note that this is an interpretation.

In the example, Items 1–3 define PC1 and Items 4–6 define PC2, a clean two-component structure.

7. PCA vs factor analysis

Table 5. Principal component analysis compared with exploratory factor analysis.
PCAFactor analysis
GoalData reduction and summaryFind latent constructs
Variance usedTotal varianceShared (common) variance
Measurement errorNot modeledSeparated as unique variance
DirectionComponents are built from variablesVariables are caused by factors
Typical usePreprocessing, visualization, machine learningTheory, scale validation

For a detailed discussion of when to choose each, see Fabrigar et al. (1999). Use PCA when you only need fewer variables; use factor analysis when you believe unobserved constructs cause the item responses.

8. PCA in R and Python

PCA in R (base R, see the prcomp documentation):

pca <- prcomp(df, scale. = TRUE)   # correlation-based PCA
summary(pca)                       # variance explained
screeplot(pca, type = "lines")     # scree plot
biplot(pca)                        # PCA plot

PCA in Python (scikit-learn, see the PCA documentation):

from sklearn.preprocessing import StandardScaler
from sklearn.decomposition import PCA

X = StandardScaler().fit_transform(df)
pca = PCA(n_components=2).fit(X)
print(pca.explained_variance_ratio_)
scores = pca.transform(X)

9. Free PCA software and online tools

Table 6. Free ways to run PCA analysis.
OptionTypeBest for
StatFas PCA calculatorFree online, no installationQuick PCA with APA7-ready results
R (prcomp, FactoMineR)Free downloadFull control and reproducible scripts
Python (scikit-learn)Free downloadMachine-learning pipelines
JASP, jamoviFree download, point-and-clickSPSS-style menus
Learnbin Lab PCA toolFree onlineInteractive 2D and 3D score plots

For a PCA analysis online free workflow, paste your data into the StatFas PCA calculator, choose the variables, and read the eigenvalues, loadings and plots. Want a PDF copy of this guide? Use your browser’s Print option and choose “Save as PDF”.

10. Reporting PCA in APA7

A principal component analysis with varimax rotation was run on six items (N = 300). The Kaiser-Meyer-Olkin measure was .82 and Bartlett’s test was significant, χ²(15) = 612.4, p < .001. Two components had eigenvalues above 1 and, together, explained 72.8% of the variance. Items 1–3 loaded on the first component (.74–.82) and Items 4–6 on the second (.72–.85). Loadings are shown in Table 3.

Also state the correlation or covariance matrix used, the retention rule, the rotation (or none) and the software.

11. Principal component analysis: a review and recent developments

PCA goes back to Pearson (1901) and Hotelling (1933). Jolliffe and Cadima (2016) reviewed how it has been extended, and Abdi and Williams (2010) give a clear technical tutorial. For a short, accessible introduction, read Ringnér (2008). Modern variants include sparse PCA (fewer non-zero loadings for easier reading), kernel PCA (non-linear structure), robust PCA (resistant to outliers), incremental PCA (very large data) and PCA for compositional or functional data. Classic PCA remains the right first step for most research datasets.

12. FAQ

What is PCA analysis?

A method that turns many correlated variables into a few uncorrelated components that keep most of the variance.

How many components should I keep?

Combine the scree plot, eigenvalues above 1, parallel analysis and 60–80% cumulative variance.

Is PCA the same as factor analysis?

No. PCA summarizes total variance; factor analysis models shared variance and error (Table 5).

Is there a free online PCA tool?

Yes: the StatFas calculator, plus R, Python, JASP and jamovi (Table 6).

Run PCA free on StatFas

References. Abdi, H., & Williams, L. J. (2010). Principal component analysis. WIREs Computational Statistics, 2(4), 433–459. https://doi.org/10.1002/wics.101 Hotelling, H. (1933). Analysis of a complex of statistical variables into principal components. Journal of Educational Psychology, 24(6), 417–441. https://doi.org/10.1037/h0071325 Jolliffe, I. T., & Cadima, J. (2016). Principal component analysis: A review and recent developments. Philosophical Transactions of the Royal Society A, 374(2065), 20150202. https://doi.org/10.1098/rsta.2015.0202 Kaiser, H. F. (1960). The application of electronic computers to factor analysis. Educational and Psychological Measurement, 20(1), 141–151. https://doi.org/10.1177/001316446002000116 Pearson, K. (1901). On lines and planes of closest fit to systems of points in space. Philosophical Magazine, 2(11), 559–572. https://doi.org/10.1080/14786440109462720 Fabrigar, L. R., Wegener, D. T., MacCallum, R. C., & Strahan, E. J. (1999). Evaluating the use of exploratory factor analysis in psychological research. Psychological Methods, 4(3), 272–299. https://doi.org/10.1037/1082-989X.4.3.272 Hayton, J. C., Allen, D. G., & Scarpello, V. (2004). Factor retention decisions in exploratory factor analysis: A tutorial on parallel analysis. Organizational Research Methods, 7(2), 191–205. https://doi.org/10.1177/1094428104263675 Horn, J. L. (1965). A rationale and test for the number of factors in factor analysis. Psychometrika, 30(2), 179–185. https://doi.org/10.1007/BF02289447 Ringnér, M. (2008). What is principal component analysis? Nature Biotechnology, 26(3), 303–304. https://doi.org/10.1038/nbt0308-303