Forgive me if this question has been asked here before, because it is something which should be very easy to find, but I can't seem to find an answer no matter where I search.
The question is simply where to learn the mathematics that goes into things like popular ancestry tests, and also more academic things like determining ancestry components of historical groups (e.g. usage of the terms Ancient North Eurasian, Eastern European Hunter-Gatherers and all that).
It is clear that if someone gets an ancestry test saying say 32% Scandinavian, then of course that doesn't mean 32% of their base pairs have a convenient "Scandinavian" label attached to them, rather there is some statistical inference going on behind these percentages, and I would like to understand that.
Suppose I have the raw data of my own fully sequenced genome, and also a database of the genomes of many individuals from various populations (of course grouping them into populations is already something that involves some assumptions that I would like to learn more about). Where would I learn how to analyze that myself to produce something like the results of an ancestry test? Is there a textbook someone could recommend that gets into the actual algorithms used?