# calculate.pairwise.Fst: Calculates unbiased pairwise Fst between a pair of... In BEDASSLE: Quantifies Effects of Geo/Eco Distance on Genetic Differentiation

 calculate.pairwise.Fst R Documentation

## Calculates unbiased pairwise Fst between a pair of populations

### Description

This function calculates unbiased F_{ST} (based on Weir and Hill's θ, 2002), between a pair of populations/individuals. Loci for which either of the populations/individuals has missing data (i.e. - the sample size is zero) are excluded.

### Usage

```calculate.pairwise.Fst(allele.counts, sample.sizes)
```

### Arguments

 `allele.counts` A matrix of allele counts of dimensions `nrow = ` 2, one for each of the two populations/individuals between which pairwise F_{ST} is being calculated, and `ncol = ` the number of loci genotyped. `sample.sizes` A matrix of sample sizes of dimensions `nrow = ` 2, one for each of the two populations/individuals between which pairwise F_{ST} is being calculated, and `ncol = ` the number of loci genotyped (i.e. - the dimensions of `sample.sizes` must match those of `counts`). Each cell gives the number of chromosomes successfully genotyped at each locus in each population.

### Value

Pairwise unbiased F_{ST} between a pair of populations/individuals

### References

Weir,B.S. and W.G. Hill. 2002. Estimating F-statistics. Ann.Rev.Gen. 36:949-952.

### Examples

```#With the HGDP dataset
data(HGDP.bedassle.data)

#Draw 2 populations at random from the Eurasian HGDP dataset
pop1 <- sample(nrow(HGDP.bedassle.data\$allele.counts),1)
pop2 <- sample(nrow(HGDP.bedassle.data\$allele.counts),1)

#Calculate unbiased Fst between them
pairwise.Fst <- calculate.pairwise.Fst(
HGDP.bedassle.data\$allele.counts[c(pop1,pop2),],
HGDP.bedassle.data\$sample.sizes[c(pop1,pop2),]
)

#Print that Fst to the console
print(sprintf("Fst between the %s population and the %s population is %s",