Skip to content
Ancestrify
Dark water surface in a stone basin showing two distinct overlapping ripple systems under a narrow beam, a third faint ring barely visible.
All stories

qpWave explained: the rank test, and what it can and cannot count

By Andi Thomaj · 5 min read
Published · Updated

Before you can ask which populations contributed to a genome, there is a prior question almost everyone skips: how many independent components does the data need? That is qpWave’s question. It shares nearly all of its machinery with qpAdm, the same f4-statistics, the same jackknife, the same left-and-right structure, but instead of estimating proportions of named sources it counts how many independent dimensions of ancestry a set of populations carries relative to the outgroups.

6 sections
Introduction1 min

Many bad qpAdm models die at a question qpWave would have answered first. The count is relative to the right set you chose, and it is not a tally of historical migrations.

The idea: rank

1 min

Take your left populations and your right set, and build the matrix of f4-statistics contrasting every left-versus-left pair against every right-versus-right pair. If the left populations can be written as combinations of n ancestry components that the right set can tell apart, that matrix has rank n − 1: the allele-frequency vectors are linearly dependent beyond that. qpWave tests successive ranks and reports, for each, whether the matrix is consistent with it. The lowest rank the data cannot reject, plus one, is the number of components this right set can distinguish. (The same computation appears inside every qpAdm run as the rank test, the f4rank rows in the model record. qpAdm is qpWave plus the assertion that the target sits inside the span of the named sources.)

Degrees of freedom come from the same arithmetic as qpAdm’s, which is why the right set must outnumber the components being tested, and why a rank test against a symmetric right set is a test of nothing.

What the count is, and what it is not

1 min

Harney and colleagues framed the rank in terms of ancestral populations: if the sources descend from n ancestral populations that relate differently to the right set, the matrix has rank n − 1. That reading is exact on an admixture graph with well-behaved outgroups. It stops being a head count when the history is not a graph. Flegontova et al. 2025 simulated continuous stepping-stone landscapes, where every group exchanges migrants with its neighbours, and found that qpAdm experiments stopping at the lowest fitting rank often settled on models that were geometrically sensible but far simpler than the history that produced the target: with close sources available, the method picked just two or three of them. With no close sources available it went the other way, to complex models built from distant sources. In both cases the rank said something true about the data relative to that right set, and nothing reliable about how many migrations happened.

So read the number as a property of the data and of the right set: the minimum number of components this outgroup set can tell apart in these populations. Change the right set and the count can change; sample the region more densely and it can change again.

The two jobs it does

1 min

Counting components. Run qpWave on a set of related populations, say the Bronze Age groups of one region, and it answers whether they can be written as combinations of two components relative to your right set, or need three. That is a useful constraint on the models downstream: a three-source qpAdm model of a target whose left set supports only two components is fitting noise with the third, and a two-source model where the right set resolves three will fail, informatively. It is a constraint on models, not a census of ancestors.

Testing cladality. With exactly two left populations, qpWave asks whether the matrix is consistent with rank zero: whether the pair forms a clade relative to the rights, with no differential relatedness at all. This is the tool for the question that decides source lists: are these two candidate sources distinguishable, or are they the same ancestry wearing two labels? A cladal pair should never both sit in one source list (their weights would trade arbitrarily), and the auditors’ resolution floor makes the same point quantitatively: sources separated by FST under roughly 0.002 cannot be told apart by any right set (Williams et al. 2024).

Where it sits in a real workflow

1 min

Harney et al. 2021 stress “testing all possible models with the lowest rank” first, “before proceeding to test models with higher rank”. That is a qpWave-first discipline:

  1. One component? Test whether the target is cladal with any single candidate source. If it is, the story is resemblance, not admixture, and no mixture model is justified relative to this right set.
  2. Two? Only after every one-component explanation fails do two-source models earn their hearing; the rank test inside each qpAdm run is the referee.
  3. Three? Only when every two-way model over the pool is rejected, and the third component must be one the chronology permits.

This ladder is statistical parsimony: the simplest model that fits, relative to the right set used, not a head count of the migrations in anyone’s history. Our search fits every rung of that ladder whatever the earlier rungs found and ranks the models with the fewest sources first, and the simpler nested models of every proposed model are checked before a person approves it; the worked example climbs it on a real customer file. The same machinery is also yours to run: the Ancestry Workbench runs the full ladder on your own merged genome. Counting components before naming sources is the cheapest check in the toolkit, as long as you remember what is being counted.

Terms used here are defined in the glossary.

References

1 min
  • Reich, D. et al. (2012). Reconstructing Native American population history. Nature, 488, 370 to 374. (qpWave’s rank-test lineage.)
  • Haak, W. et al. (2015). Massive migration from the steppe was a source for Indo-European languages in Europe. Nature, 522, 207 to 211. (SI 10: qpWave and qpAdm as published methods.)
  • Harney, É., Patterson, N., Reich, D. & Wakeley, J. (2021). Assessing the performance of qpAdm. Genetics, 217(4), iyaa045.
  • Williams, M. P. et al. (2024). Testing times. Genetics, 228(1), iyae110.
  • Flegontova, O. et al. (2025). Performance of qpAdm-based screens for genetic admixture on graph-shaped histories and stepping stone landscapes. Genetics, 230(1), iyaf047.

Editorial note: revised on 24 September 2026. An earlier version described the rank as a count of ancestry streams in the target’s history. This version reads it as the number of components a right set can distinguish, and adds the stepping-stone landscape results that show why the two differ.

The tested version of this question
A qpAdm model tested against AADR v66 and approved by a person, published with its p-value, every source’s standard error and z-score, and the full right set, so the result can be argued with.
From €39.99 · one-time
See Ancient AncestrySee a sample report
qpAdmMethodologyPopulation genetics

Keep reading

All stories
Ancestrify

Combining cutting-edge genomic science with rich historical records to map your ancestry across generations and continents.


© 2026 Ancestrify. All rights reserved. · Ancestrify is a trading name of Andi Thomaj, a sole trader registered in Tiranë, Albania · NUIS M61725001N
Card payments processed by POK Payments (RPay Ltd)VISAMASTERCARD