1. ## K25 calculator for G25 scaled spreadsheet

I've been playing with the following idea:

1. Take the Global25 scaled spreadsheet with all individuals
2. Apply k-means clustering algorithm to find K clusters for individuals in the spreadsheet
3. Label each cluster so that it has a meaningful name
4. Compute the average G25 coordinates for each cluster (take an average of coordinates belonging to all individuals in each cluster)
5. Compose a calculator based on these coordinates

I've chosen K=25 clusters and below is the calculator I've obtained based on the steps above (component names are subjective!):

Code:
```,PC1,PC2,PC3,PC4,PC5,PC6,PC7,PC8,PC9,PC10,PC11,PC12,PC13,PC14,PC15,PC16,PC17,PC18,PC19,PC20,PC21,PC22,PC23,PC24,PC25
Semitic,0.0905674640523,0.137912901961,-0.0551138300654,-0.0692887777778,-0.0214297254902,-0.0219595098039,0.00138392156863,-0.00539041176471,-0.012282130719,0.00223688888889,0.00519854901961,-0.00181309150327,0.00545578431373,0.00247454901961,-0.00601868627451,0.00327229411765,-0.000711607843137,0.000415653594771,0.00283518954248,-0.00250774509804,0.000574980392157,0.000962581699346,-0.00144995424837,-0.00131521568627,0.00111062745098
NW_European+Beakers,0.129666669492,0.131261487288,0.0623886991525,0.0535297224576,0.0366651525424,0.0191506716102,0.00401149788136,0.00544045338983,0.00249761652542,-0.00177911864407,-0.00493322457627,0.00443694491525,-0.0104491038136,-0.0112809639831,0.0212275635593,0.00639268220339,-0.00750705720339,0.00198757627119,0.00269692584746,0.00358536864407,0.00561904237288,0.00290740042373,-0.000372866525424,0.0100151271186,-0.000295046610169
Greek+Albanian,0.120008636364,0.143538444444,0.0194426565657,-0.0142707272727,0.0253566262626,-0.00633277777778,0.00143846464646,0.000881060606061,0.003543,0.0180027272727,-7.3797979798e-05,0.00312297979798,-0.00675282828283,0.00180437373737,-0.0117253737374,-0.000709808080808,0.00637427272727,0.00106213131313,0.0048311010101,-0.00423814141414,-0.00501384848485,0.00167737373737,0.00138808080808,8.50505050505e-06,-0.000951929292929
Maltese+European_Jewish,0.0945465376344,0.145930505376,-0.0177773548387,-0.0568792580645,0.00845137634409,-0.0206858817204,-0.00337595698925,-0.00278893548387,0.00878350537634,0.0211609784946,0.00471622580645,0.00205303225806,-0.000698559139785,-0.00069847311828,-0.00650288172043,-0.00212717204301,0.000713612903226,-0.00084864516129,-0.000609537634409,-0.00339412903226,-0.00303769892473,-0.00199307526882,0.00116760215054,0.000943279569892,0.000909032258065
NE_Asian,0.0451732263374,-0.369151226337,0.102191946502,0.00190742798354,-0.0969005349794,-0.0473964979424,-0.00867025514403,-0.00708702880658,0.0104652386831,0.00377522222222,0.0149718230453,0.000537794238683,-8.53909465021e-06,-0.00822223868313,-0.00840739917695,-0.00474265020576,-0.00127972427984,0.00513164197531,0.0138929917695,0.0098879382716,0.00367663374486,-0.0160687366255,0.00191518106996,0.00579538683128,0.00958931687243
Amerindian,0.0535519516129,-0.307443387097,0.115976766129,0.094785,-0.109640790323,-0.0170123387097,-0.286534790323,-0.342069443548,-0.0120437983871,-0.0158986451613,-0.00114851612903,-0.00214289516129,0.00120009677419,0.0218753709677,-0.00777873387097,0.00441287096774,0.00692926612903,8.175e-05,0.00202130645161,0.000519387096774,-0.00142889516129,0.00601908064516,-0.00143419354839,-0.000851217741935,-0.0016407016129
Finnish,0.126102171717,0.0731898787879,0.0863378080808,0.0740257272727,0.0225060909091,0.0214492424242,0.00964248484848,0.0140716767677,-0.000710707070707,-0.0284214444444,0.00465678787879,-0.00904343434343,0.0180614949495,0.00801131313131,-0.00616084848485,-0.0011611010101,-0.00218626262626,-0.000879141414141,-0.00136616161616,0.00090698989899,0.00350388888889,-0.00100290909091,0.00157231313131,0.000378535353535,0.00248807070707
North_Indian+Kalash,0.0671974036697,-0.0160807637615,-0.113611041284,0.079307809633,-0.0717649288991,0.0476851880734,0.00222226376147,0.00562079357798,0.00229056192661,-0.00183781651376,-0.00544483944954,7.45963302752e-05,-0.000855844036697,-0.00522650917431,0.00681123623853,0.00739336238532,-0.00108045642202,0.000302766055046,0.000759371559633,-0.00733208486239,-0.00130963302752,-0.00411230504587,0.00178229587156,-0.0013724587156,0.00124965825688
African,-0.589981211055,0.0610950653266,0.0127330050251,0.00778446231156,-0.000576814070352,0.00271184422111,0.0281410150754,-0.0157971557789,0.0139713115578,-0.0183215829146,-0.00320534170854,-0.00197913065327,-0.0109575477387,0.000568462311558,0.00539882914573,-0.00767153266332,0.00926315577889,0.0284342763819,-0.00581686934673,-0.00483397487437,-0.00334393467337,0.000449251256281,-0.00027932160804,-0.000772040201005,0.000969396984925
Caucasian,0.0991423832117,0.0912123175182,-0.0415382956204,-0.0187021715328,-0.0371949379562,0.000876346715328,0.00571303284672,-0.00359532846715,-0.0360469379562,-0.0176283430657,-0.000967222627737,0.00275230656934,-0.00500235766423,-0.00163840875912,0.00496123357664,0.000433562043796,0.000757105839416,-0.000417518248175,-0.00135651824818,0.000302624087591,0.000981839416058,-0.00117107664234,0.00036252189781,-0.00252119343066,0.000898094890511
Siberian_Turkic,0.0756485641026,-0.180982969231,0.0710823948718,0.037196374359,-0.0584202769231,-0.0104533948718,-0.000893082051282,0.000370374358974,-0.00613883076923,-0.0201123282051,0.00822854358974,-0.00329248205128,0.00803377948718,-0.0299834051282,-0.00321551794872,-0.00137958461538,-0.00390080512821,0.000869897435897,0.00297937948718,0.00226904615385,-0.0119328153846,0.00562843076923,0.00491345641026,-0.000512246153846,-0.00140506153846
Brahui+Balochi,0.0725053384615,0.0721417076923,-0.110629776923,0.0133523230769,-0.0893160076923,0.0231436384615,0.00710806153846,-0.00262535384615,-0.0531809,-0.0350902461538,-0.00162266153846,-0.000529138461538,0.000303030769231,-0.00849239230769,0.0184662769231,0.0293706615385,-0.00621632307692,0.00332314615385,0.00526284615385,-0.0233814461538,0.00147051538462,-0.0146014461538,-0.00166385384615,-0.0181229692308,0.0122134461538
Balto_Slavic,0.131969350575,0.124338149425,0.0746590862069,0.0667088390805,0.0401754022989,0.0247042931034,0.00958401149425,0.012037954023,-0.000465471264368,-0.0230580804598,-0.00219410344828,-0.00821597701149,0.0155914310345,0.0214272241379,-0.00807768965517,-0.000430517241379,0.000663149425287,-0.000250482758621,0.00261583333333,0.00158627011494,-0.00175267241379,-0.00320928735632,0.00576925287356,-0.00542787931034,0.000450747126437
Iberian+Basques,0.119217313043,0.14825846087,0.0451298347826,0.00100832173913,0.0491836782609,-0.00220689565217,-0.00193726086957,0.00218315652174,0.0257753478261,0.0359401304348,-0.00262644347826,0.00825960869565,-0.0166358086957,-0.0126313652174,0.00849843478261,-0.000119939130435,-0.0028321826087,0.000475852173913,-0.0010012,-0.00115160869565,0.00460923478261,0.000411834782609,-0.00399751304348,-0.0059095826087,0.000538330434783
Neolithic_Farmers,0.122342111801,0.178758372671,0.0147147826087,-0.0830411677019,0.0595217639752,-0.0402572919255,-0.00276894409938,-0.00305432919255,0.0407155093168,0.0818511925466,0.0060850310559,0.0126790807453,-0.0223572670807,0.000112838509317,-0.0359346645963,-0.00931588198758,0.0172244596273,0.00157298136646,0.0111902360248,-0.00989452173913,-0.00903453416149,0.00638539130435,-0.00593349689441,-0.0075068136646,-0.00393611180124
Neolithic_Northern_Europe,0.126215953271,0.167211158879,0.0548622523364,-0.0302986074766,0.085393317757,-0.0210288691589,-0.00406754205607,0.00285969158879,0.0614871121495,0.0854721214953,-0.000479607476636,0.0128241308411,-0.0282400280374,-0.0140194859813,-0.00707269158879,0.00444605607477,0.0110777383178,0.00328563551402,0.00283465420561,-0.0017776728972,0.0126575233645,0.00330046728972,-0.0156743084112,-0.0352487757009,3.46728971963e-05
Arabic,0.00925723404255,0.139899968085,-0.0416517925532,-0.0994277659574,0.00289417553191,-0.0428349414894,-0.0169032553191,-0.0023812287234,0.0525756755319,0.00870180319149,0.0113023723404,-0.0184001170213,0.040627106383,-0.00198089361702,0.00579841489362,0.00765136702128,-0.0101901010638,-0.0043289893617,-0.0127877925532,0.0153391170213,0.00107659574468,-0.00266838297872,0.00394130319149,0.00145746808511,-0.00171468085106
Ethiopian+Somali+Iberomaurusian,-0.295751913386,0.0917734488189,-0.0272684724409,-0.0673696614173,0.0015024015748,-0.0333768425197,-0.00911919685039,-0.00353406299213,0.107966055118,-0.0711208661417,-0.00580252755906,-0.00906041732283,0.007117,-0.00212719685039,0.0241881259843,-0.0165966377953,0.0151697007874,0.00122297637795,0.00189636220472,-0.00136973228346,0.000506992125984,0.000431307086614,-0.000428921259843,0.000479133858268,-0.000534622047244
Sintashta+Srubnaya+Kangju,0.121943371951,0.0984135,0.051601152439,0.0772029207317,0.00205845121951,0.0285913963415,0.00356948170732,0.00301393902439,-0.019687902439,-0.0311723597561,-0.00199121341463,0.00035456097561,-0.00257345121951,-0.0212014512195,0.0223988292683,0.0123324390244,-0.00458330487805,-0.000386237804878,-0.000466768292683,0.00153351219512,-0.00491892682927,0.00277765243902,0.00120765853659,0.00715999390244,-0.00213576219512
European_Hunters_Gatherers,0.129548,0.104985847826,0.172610532609,0.182826021739,0.108943369565,0.0550445326087,0.00870054347826,0.0239412934783,0.053187326087,-0.0213533152174,-0.00509933695652,-0.0172965434783,0.0259380869565,-0.00544056521739,0.0333709891304,0.0453701304348,0.00313342391304,0.00462273913043,-0.00643925,0.0425353804348,0.0616005326087,0.0116851847826,-0.0267018695652,-0.107186391304,0.00906581521739
Central_European,0.127216885246,0.136740190164,0.0513613508197,0.0291886098361,0.0376452754098,0.0102257081967,0.0042948295082,0.00502146557377,0.00567101639344,0.00725716065574,-0.00309763934426,0.00282242622951,-0.00686030163934,-0.00217398688525,0.00553560983607,0.00270440327869,-0.00093406557377,0.000989832786885,0.00320097704918,0.0011349442623,0.000985504918033,0.00120327213115,0.000258639344262,0.00422884918033,-0.000459350819672
South_Asian,0.00644757366771,-0.205862777429,-0.162883025078,0.116968244514,-0.00694794357367,0.0139576426332,-0.00406356112853,0.0110149435737,0.0589355956113,0.0376788746082,0.0033363322884,0.00105607210031,-0.00140040125392,0.00861154858934,-0.0154125736677,-0.0159468934169,0.009084,-0.00157821943574,-0.00324847021944,0.0190832225705,0.00226715673981,0.0117059247649,-0.00414176489028,0.00493693416928,0.00225759874608
East_Asian,0.0169115098814,-0.415090632411,-0.0364033399209,-0.0425287588933,0.0872707233202,0.0393886442688,0.000528505928854,-0.00422935968379,-0.00851317786561,-0.00420296047431,-0.0036791027668,-0.000952513833992,0.00112402371542,-0.00174939525692,-0.000678541501976,-0.000578604743083,0.000843162055336,0.000298940711462,-0.00136082608696,-0.00194014229249,0.0025537826087,0.00317193675889,0.00333839525692,-0.000333407114625,8.09288537549e-05
Uralic,0.0977504597701,-0.0288083505747,0.0568173563218,0.0552534195402,-0.0261657356322,0.00826096551724,0.00351564942529,0.00469475862069,-0.0105012413793,-0.0268358563218,0.00690060344828,-0.00471563793103,0.00943995402299,-0.0212160057471,0.000597477011494,0.000151643678161,-0.00390550574713,-0.00063124137931,-0.00490798850575,-0.00303233908046,-0.00314029885057,0.00246168390805,-0.00422297126437,0.00205879885057,-0.000928327586207
Yamnaya+Afanasievo+EHG,0.119403611111,0.0540204861111,0.0618268888889,0.138392986111,-0.0368871666667,0.0466289722222,-0.00882277777778,-0.0140154444444,-0.0433419583333,-0.0772174722222,0.00695563888889,-0.00382369444444,0.00808956944444,-0.0339354583333,0.0322203472222,0.0149641666667,-0.00651740277778,-0.00266927777778,-0.00350206944444,0.00934820833333,-0.009906125,0.005155625,0.0135573333333,0.0118556666667,-0.004445625```
I think it is a fun calculator with both modern and ancient components.

My results.

with pen=0 (the best fit):

[1] "distance%=2.6273"

michal3141

Balto_Slavic,80.2
Neolithic_Farmers,8.4
Yamnaya+Afanasievo+EHG,7.8
European_Hunters_Gatherers,1.4
Siberian_Turkic,1.2
Arabic,0.8
Finnish,0.2

with pen=0.001 (default, predominately modern populations):

[1] "distance%=2.7295"

michal3141

Balto_Slavic,78.4
Finnish,8.4
Central_European,4.2
Greek+Albanian,1.4
Yamnaya+Afanasievo+EHG,1.4
Maltese+European_Jewish,1.2
Neolithic_Farmers,1.2
Sintashta+Srubnaya+Kangju,1
Semitic,0.8
Neolithic_Northern_Europe,0.6
Uralic,0.6
Arabic,0.2
Brahui+Balochi,0.2
Caucasian,0.2
European_Hunters_Gatherers,0.2

2. ## The Following 8 Users Say Thank You to michal3141 For This Useful Post:

Alain (12-16-2018),  branimir (12-08-2018),  Drewcastle (01-10-2019),  Hurricane (12-08-2018),  JMcB (12-08-2018),  Kelmendasi (12-13-2018),  ph2ter (12-08-2018),  Radboud (12-13-2018)

3. Could you try my father and I with it please?

4. ## The Following 2 Users Say Thank You to firemonkey For This Useful Post:

JMcB (12-08-2018),  michal3141 (12-08-2018)

5. Here is my coordinates:

,PC1,PC2,PC3,PC4,PC5,PC6,PC7,PC8,PC9,PC10,PC11,PC1 2,PC13,PC14,PC15,PC16,PC17,PC18,PC19,PC20,PC21,PC2 2,PC23,PC24,PC25
Mykhailo_scaled,0.12862,0.125926,0.06939,0.056202, 0.037545,0.019801,0.00658,0.011076,-0.000205,-0.017859,-0.004872,-0.007943,0.017988,0.017891,-0.013843,0.01127,0.02373,-0.000887,-0.001508,0.009379,-0.006364,-0.002102,0.005423,0.000361,0.000718

,PC1,PC2,PC3,PC4,PC5,PC6,PC7,PC8,PC9,PC10,PC11,PC1 2,PC13,PC14,PC15,PC16,PC17,PC18,PC19,PC20,PC21,PC2 2,PC23,PC24,PC25
Mykhailo,0.0113,0.0124,0.0184,0.0174,0.0122,0.0071 ,0.0028,0.0048,-0.0001,-0.0098,-0.003,-0.0053,0.0121,0.013,-0.0102,0.0085,0.0182,-0.0007,-0.0012,0.0075,-0.0051,-0.0017,0.0044,0.0003,0.0006

6. ## The Following User Says Thank You to Mykhailo For This Useful Post:

michal3141 (12-08-2018)

7. Originally Posted by firemonkey
Could you try my father and I with it please?
With pen=0:

[1] "distance%=1.8956"

Tim_G_scaled

NW_European+Beakers,91.2
Iberian+Basques,7.6
European_Hunters_Gatherers,1
East_Asian,0.2

[1] "distance%=2.6761"

Tim_G_father_scaled

NW_European+Beakers,88
Iberian+Basques,9.6
Neolithic_Northern_Europe,2.4

With pen=0.001:

[1] "distance%=1.9066"

Tim_G_scaled

NW_European+Beakers,94.6
Iberian+Basques,3.8
Neolithic_Northern_Europe,1
European_Hunters_Gatherers,0.6

[1] "distance%=2.6966"

Tim_G_father_scaled

NW_European+Beakers,90.2
Iberian+Basques,5.2
Neolithic_Northern_Europe,2.4
Central_European,2
Maltese+European_Jewish,0.2

Note: NW_European+Beakers is a cluster that emerged from modern NW-Europeans (Dutch, English, Irish, etc.) and Beakers mostly. So it's interesting they were clustered together.

8. ## The Following 5 Users Say Thank You to michal3141 For This Useful Post:

branimir (12-08-2018),  Finn (12-13-2018),  firemonkey (12-08-2018),  JMcB (12-08-2018),  ph2ter (12-08-2018)

9. Originally Posted by Mykhailo
Here is my coordinates:

,PC1,PC2,PC3,PC4,PC5,PC6,PC7,PC8,PC9,PC10,PC11,PC1 2,PC13,PC14,PC15,PC16,PC17,PC18,PC19,PC20,PC21,PC2 2,PC23,PC24,PC25
Mykhailo_scaled,0.12862,0.125926,0.06939,0.056202, 0.037545,0.019801,0.00658,0.011076,-0.000205,-0.017859,-0.004872,-0.007943,0.017988,0.017891,-0.013843,0.01127,0.02373,-0.000887,-0.001508,0.009379,-0.006364,-0.002102,0.005423,0.000361,0.000718

,PC1,PC2,PC3,PC4,PC5,PC6,PC7,PC8,PC9,PC10,PC11,PC1 2,PC13,PC14,PC15,PC16,PC17,PC18,PC19,PC20,PC21,PC2 2,PC23,PC24,PC25
Mykhailo,0.0113,0.0124,0.0184,0.0174,0.0122,0.0071 ,0.0028,0.0048,-0.0001,-0.0098,-0.003,-0.0053,0.0121,0.013,-0.0102,0.0085,0.0182,-0.0007,-0.0012,0.0075,-0.0051,-0.0017,0.0044,0.0003,0.0006
with pen=0:

[1] "distance%=2.8977"

Mykhailo_scaled

Balto_Slavic,88.8
Neolithic_Farmers,6.2
Yamnaya+Afanasievo+EHG,3.2
Arabic,1.8

with pen=0.001:

[1] "distance%=2.9684"

Mykhailo_scaled

Balto_Slavic,90.6
Central_European,3.2
Greek+Albanian,2
Semitic,1.4
Neolithic_Northern_Europe,1
Neolithic_Farmers,0.8
Caucasian,0.4
Maltese+European_Jewish,0.4
Arabic,0.2

10. ## The Following 4 Users Say Thank You to michal3141 For This Useful Post:

Alain (12-16-2018),  branimir (12-08-2018),  Hurricane (12-08-2018),  Mykhailo (12-08-2018)

11. Hello michal,

Would you please run mine, too?

JMcB_scaled,0.132035,0.140143,0.065996,0.040052,0. 040931,0.015339,0.005875,0.005307,0.009817,0.00984 1,0.000162,0.00015,-0.016204,-0.012661,0.013436,0.003182,-0.006128,0.002534,0.006536,0.002001,0.009608,0.002 72,0.001109,0.006145,-0.000479

Many thanks!

12. ## The Following 2 Users Say Thank You to JMcB For This Useful Post:

13. pen = 0
[1] "distance%=1.921"

Branimir_scaled

Balto_Slavic,51
Greek+Albanian,40.8
Neolithic_Farmers,6
Finnish,2.2

pen = 0.001
[1] "distance%=2.2341"

Branimir_scaled

Balto_Slavic,35.4
Central_European,29.6
Greek+Albanian,24.6
Finnish,3.6
Neolithic_Farmers,3.6
Maltese+European_Jewish,2
Semitic,0.8
Caucasian,0.4

14. ## The Following 2 Users Say Thank You to branimir For This Useful Post:

JMcB (12-08-2018),  michal3141 (12-08-2018)

15. Originally Posted by JMcB
Hello michal,

Would you please run mine, too?

JMcB_scaled,0.132035,0.140143,0.065996,0.040052,0. 040931,0.015339,0.005875,0.005307,0.009817,0.00984 1,0.000162,0.00015,-0.016204,-0.012661,0.013436,0.003182,-0.006128,0.002534,0.006536,0.002001,0.009608,0.002 72,0.001109,0.006145,-0.000479

Many thanks!
with pen=0:

[1] "distance%=1.379"

JMcB_scaled

NW_European+Beakers,84.4
Neolithic_Northern_Europe,11.2
Neolithic_Farmers,2.4
Balto_Slavic,2

with pen=0.001:

[1] "distance%=1.4748"

JMcB_scaled

NW_European+Beakers,75.4
Central_European,8.6
Iberian+Basques,7.8
Neolithic_Northern_Europe,5.4
Neolithic_Farmers,1.8
European_Hunters_Gatherers,1

16. ## The Following 5 Users Say Thank You to michal3141 For This Useful Post:

branimir (12-08-2018),  Hurricane (12-08-2018),  JMcB (12-08-2018),  Radboud (12-13-2018),  Trelvern (01-23-2019)

17. [1] "distance%=2.4001"

Garimund_scaled

NW_European+Beakers,68.2
Iberian+Basques,22.8
Neolithic_Northern_Europe,6.4
European_Hunters_Gatherers,1.8
Ethiopian+Somali+Iberomaurusian,0.4
African,0.2
Arabic,0.2

18. ## The Following 3 Users Say Thank You to Garimund For This Useful Post:

Hurricane (12-08-2018),  michal3141 (12-08-2018),  timberwolf (12-08-2018)

19. michal3141, do you want this in the online tool? Looks very interesting!

20. ## The Following 4 Users Say Thank You to poi For This Useful Post:

digital_noise (12-08-2018),  JMcB (12-08-2018),  michal3141 (12-08-2018),  Nino90 (01-25-2019)

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•