Cluster variables: group correlated process variables

Updated

Variable clustering groups variables, not observations, so that variables in the same group are strongly correlated with each other and weakly correlated with variables in other groups. It works like clustering observations, but the distance between two variables comes from their correlation. The result shows which measurements carry the same information, so you can pick one representative from each group for monitoring, modeling or a reduced test plan.

When to use it

  • A machine logs dozens of signals and you want to know which are redundant.
  • You plan a regression or a designed experiment and want to avoid predictors that duplicate each other.
  • You want to cut a long list of incoming tests to a few that cover the same ground.
  • You want a quick, readable alternative to principal components that keeps the original variables.

How it works

1. Compute the correlation matrix of all variables, from rows where all of them were recorded together.

2. Turn correlation into distance. Two choices are common:

d = 1 − |r| (sign ignored) d = 1 − r (sign kept)

With 1 − |r|, two variables that move in opposite directions (r = −0.9) count as close, because one predicts the other. That suits redundancy questions. With 1 − r, they count as far apart, which suits questions about variables that rise together. This example uses 1 − |r|.

3. Join step by step. Start with each variable alone. At each step, join the two closest clusters using a linkage rule (single, complete or average) and record the distance. This example uses average linkage. A similarity level, 100 × (1 − d), is often reported alongside the distance.

4. Choose the clusters. Look for a large jump in the joining distance, and check that each group makes physical sense.

Example

An extrusion line records eight signals every hour. Over 60 hours, their correlations are:

Zone 1Zone 2Melt TSpeedLoadOutputDie PScreen age
Zone 1 temp10.810.65−0.03−0.230.010.12−0.02
Zone 2 temp0.8110.65−0.05−0.240.080.16−0.14
Melt temp0.650.6510.150.020.210.05−0.11
Screw speed−0.03−0.050.1510.840.860.35−0.17
Motor load−0.23−0.240.020.8410.790.26−0.07
Output rate0.010.080.210.860.7910.38−0.19
Die pressure0.120.160.050.350.260.381−0.69
Screen age−0.02−0.14−0.11−0.17−0.07−0.19−0.691

"Screen age" is the hours since the melt filter screen was changed; as the screen clogs, pressure at the die falls, hence r = −0.69.

With d = 1 − |r| and average linkage:

StepJoinedDistanceSimilarity
1Screw speed + Output rate0.14086.0
2+ Motor load0.18581.5
3Zone 1 temp + Zone 2 temp0.19081.0
4Die pressure + Screen age0.31069.0
5(Zone 1, Zone 2) + Melt temp0.35065.0
6(Speed, Load, Output) + (Die pressure, Screen age)0.76323.7
7all0.89210.8

For example, at step 2 the distance from motor load to the (speed, output) cluster is the average of 1 − 0.84 and 1 − 0.79, which is 0.185.

Joining distance at each step of variable clustering0.20.40.60.8Distance1234567Step
Joining distance at each step of variable clustering

The distance jumps from 0.35 to 0.763 after step 5, so the natural answer is three clusters:

  • Temperatures: zone 1, zone 2 and melt temperature.
  • Drive: screw speed, motor load and output rate.
  • Filter: die pressure and screen age.

For a daily dashboard, the team keeps one signal per cluster: melt temperature (closest to the product), output rate and die pressure. The other five are still logged for troubleshooting.

Had the team used d = 1 − r, die pressure and screen age would have been 1.69 apart, the farthest pair in the table, and screen age would have joined last on its own: the strong opposite relationship would have been hidden.

How to read the results

  • Read the groups, then the order. Variables that join early are near duplicates; groups that join late carry different information.
  • Pick representatives with a reason. Choose the variable that is easiest to measure, closest to the customer requirement or most reliable.
  • Check the sign within each group. A cluster built on 1 − |r| can contain variables with opposite signs, as the filter cluster does.
  • Confirm with process knowledge. A cluster that makes no physical sense often reflects a shared data problem, such as two sensors logged by the same faulty channel.

Common mistakes

  • Mixing data from different operating modes. A start-up and steady running in the same data can create correlations that exist only between modes.
  • Using too few rows. Correlations from 10 or 15 observations are noisy and the tree can change with a few more points.
  • Dropping variables only by correlation. Two correlated sensors may both be needed if one serves as a check on the other.
  • Forgetting nonlinear relationships. Correlation measures straight-line association; two variables linked by a curve can look unrelated.

Frequently asked questions

How is variable clustering different from PCA?

PCA builds new variables as weighted combinations of all the originals. Variable clustering keeps the original variables and only groups them, which is easier to explain and act on, but it does not compress the data as efficiently.

Should I use 1 − |r| or 1 − r?

Use 1 − |r| when the question is redundancy: does one variable predict another? Use 1 − r when you care about direction, for example to find variables that rise together.

What linkage should I use for variables?

Average linkage is a good default. Single linkage can chain variables that are only indirectly related; complete linkage demands that every pair in a group be well correlated.

How many variables can I cluster?

Dozens to a few hundred work well. With very many variables, the correlations need many rows to be stable, and the tree is best read cluster by cluster.

Try it with your own data

StatLab SPC is free, open-source statistics for engineers. It runs in your browser, works offline, and never uploads your data.

Open StatLab