Analyses · Data Reduction · Standard

Running a k-means cluster analysis in Quanta

Cases grouped into a number of clusters you choose in advance. How to pick that number, what within-cluster sum of squares actually measures, and how to report a clustering honestly.

What it does

K-means splits cases into a number of clusters you specify. It places k centres, assigns every case to its nearest centre, moves each centre to the average of the cases assigned to it, and repeats until nothing moves. Quanta reports how many iterations that took and that the run converged.

The result is a set of groups whose members are close to their own centre and further from the others. It is fast, it scales, and it is the most widely used clustering method in applied research.

It also has two properties people forget: you have to choose k before you see anything, and the answer depends on where the centres started.

Reading within-cluster sum of squares

The headline fit figure is total within-cluster sum of squares, or WCSS. Quanta labels it as within-cluster spread, which is the accurate description.

WCSS is the variance the clustering did not explain. It is the total squared distance from each case to its own cluster centre, so it measures how much spread remains inside the groups after grouping. Lower is better.

That is worth stating plainly because it is easy to invert. A larger WCSS is not more variance captured; it is more variance left over. The per-cluster column tells you which groups are tight and which are loose: a cluster of 98 cases with a within sum of squares of 1122.5 is considerably more diffuse than one of 65 cases at 504.1.

WCSS always falls as k rises, reaching zero when every case is its own cluster. So it cannot be used to choose k on its own, only to compare solutions at the same k or to look for the point where adding a cluster stops buying much.

Choosing k

Theory first. If your research question implies a number of groups, use it and say so.

The elbow method. Run k across a range, plot total WCSS against k, and look for where the curve bends. The bend is where an additional cluster stops meaningfully reducing within-group spread.

Stability. Rerun with different starting points. If cluster membership shifts substantially, the structure is not robust and the number of clusters is not the real problem.

Interpretability. A solution you cannot describe substantively is not useful, however good its fit statistic.

Standardize your variables unless they are already on a common scale. Distance-based methods are dominated by whichever variable has the largest numeric range.

What k-means cannot tell you

It cannot tell you whether the clusters are real. K-means will return three clusters from data with no group structure at all, cheerfully and with a fit statistic.

It cannot test whether clusters differ significantly. There is no p value here, and running a test on differences between clusters you created from those same variables is circular.

It assumes roughly spherical, similarly sized groups, because it works from distance to a centre. Elongated or very unequal clusters are recovered poorly.

If you need to know whether groups exist rather than to impose them, a model-based approach such as latent profile analysis answers that question and clustering does not.

Running it in Quanta

Lay the data out one row per case, one column per clustering variable, all numeric.

Open Data Reduction and choose K-means Clusters, then set your variables, k, whether to standardize, and the seed in the Setup panel on the right.

Note the seed. K-means starts from randomly placed centres, so a fixed seed is what makes your result reproducible. Record it with the analysis.

Check the iterations and convergence tile. A run that hits the iteration ceiling rather than converging has not settled, and its clusters should not be interpreted.

Use the action bar to add the result to a report, copy the table, or copy the APA text.

Reporting it

Clustering is descriptive. Report it as an exploratory grouping, not a finding about types of people.

A k-means cluster analysis of 18 standardized variables (N = 250) with k = 3 converged in 6 iterations, producing clusters of 98, 65 and 87 cases (total within-cluster sum of squares = 2426.5).

Report k, how you chose it, whether variables were standardized, the seed, and the convergence status. Those five make the result reproducible.

Give the per-cluster sizes and within sums of squares rather than only the total. A tidy overall figure can hide one diffuse cluster doing all the work.

Do not describe clusters as significantly different from each other. No test was run, and the groups were built from the variables you would be comparing.

Explaining the result, on your Mac

Every result carries a ReliCheck Intelligence card with one action: explain this result in plain language. It runs entirely on your Mac with Apple Intelligence. No upload, no API key, nothing to configure. The model only explains the result Quanta has already computed and validated. It never computes a statistic, and it never applies a decision on your behalf.

From the action bar you can add the result to a report, copy the table, or copy the APA text. Exported reports carry the APA table, its note, and a caution specific to that analysis beneath it.

Validation

Pure Swift, validated

Quanta's engine is pure Swift on Apple's Accelerate framework, with no R or Python at runtime. Every engine is checked against an independent reference rather than internal consistency alone, and the automated suite exceeds 500 checks. Full record on the validation page.

Included in

Standard

Data Reduction is part of every Quanta subscription, $9.99 a month or $79.99 a year after the 30-day trial. One price for everyone. See pricing.

On your Mac

Runs offline

The analysis, the report builder, and the on-device explanations all work with the network off. Your dataset is never uploaded.

Related analyses

Hierarchical clustering when you do not want to fix k in advance · Principal components reducing variables rather than grouping cases · One-way ANOVA comparing an outcome across groups you already have · the complete list on the analyses page.