This function turns per-block f2-statistics into per-block f4-statistics of the form f4(pop1, pop2; pop3, pop4)

f4_from_f2(f2_data, pop1, pop2 = NULL, pop3 = NULL, pop4 = NULL)

Arguments

f2_data

A 3d array with blocked f2 statistics, output of f2_from_precomp or f2_from_geno Alternatively, a directory with precomputed data. See extract_f2 and extract_counts.

pop1

Either the name(s) of the first population(s), or a four column matrix with the names of all four populations.

pop2

Population 2 (same length as pop1)

pop3

Population 3 (same length as pop1)

pop4

Population 4 (same length as pop1)

Value

A matrix of per-block f4-statistics (popcomb x block)