Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Principal component analysis

What it is

Principal component analysis (PCA) takes a set of numeric fields that overlap and rebuilds them as a few new combined measures, called components, that carry most of the information. The first component is the single weighted blend of your fields that varies the most across rows; the second is the next most varying blend that is unrelated to the first, and so on. Ten overlapping survey items often collapse into one or two components.

It is a way to ask how many separate things your fields are really measuring, and which fields belong to which.

When to use it

  • You have many correlated fields and want a handful of summary scores.
  • You want to know whether a battery of items measures one idea or several.
  • You want to reduce overlap before a regression or a clustering.

If you believe a hidden trait causes the answers and want to model that, look at factor analysis (MAT_FACTOR) instead. PCA just summarises; it makes no claim about causes. The Measure a construct guide shows when to reach for which, with a worked reliability story on a six-item battery.

How to read it in Pulse

List the fields on a MAT_PCA matrix (inline as fields, or once as a named vector in the request’s vectors block) (pulse examples show principal_components prints a runnable request; its cohorts: Get the data). Check these in order:

  1. Is it worth doing? The result reports a KMO figure (the Kaiser-Meyer-Olkin measure of how well the fields share variation, from 0 to 1; higher is better) and Bartlett’s sphericity test (are the fields related at all). If they fail, the fields have too little in common to summarise.
  2. How many components? eigenvalues, explained_variance and cumulative list every component with its share of the total variation. An eigenvalue is the amount of variation a component carries, counted in fields: on the default correlation basis each field brings 1, so an eigenvalue above 1 carries more than a single field does. A big first share and then a sharp drop means one dominant dimension. By default Pulse keeps components with an eigenvalue above 1; set params.components to choose a number or a variance share.
  3. What does each mean? The primary block holds the loadings: one row per field, one column per component (PC1, PC2, …). Large loadings, in size, say which fields make up a component; name the component after them.
  4. Per-field fit. communalities say how much of each field the kept components explain; a low one means the field does not belong with the rest.

Component signs are arbitrary: a flipped sign says nothing. Only the pattern of large and small loadings matters.

To put a component on every row, add ATTR_PC_SCORE with the component number: each row gets its standardized score, which you can then average by group or feed to a regression.

Common traps

  • Scale matters. The default works on correlations, so field units do not dominate. Working on covariances (params.on) lets large-unit fields take over; use it only on purpose.
  • Too few rows. Components built from a small sample are unstable. Check the row count in the result’s components before reading detail.
  • Reading too much into small loadings. Focus on the largest ones.
  • Rotation. params.rotation makes components easier to name, but it spreads the variation across them, so read rotated_variance afterwards.
  • Missing data. listwise drops whole rows; pairwise can give an inconsistent grid (PULSE_MATRIX_NOT_PSD), which params.repair can fix.

Where next