Peter D. Fields Academia, Research, and whatnot

Caballero QG Chp. 2, Problem set Q1 (R)

Chapter 2: Forces of change in allele frequencies

In a population of gazelles, 200 individuals were analyzed for the $\alpha$ - amylase gene, finding three allelic variants (A$_1$,A$_2$,A$_3$) and the observed genotype frequencies indicated in the following table.

Genotype A1A1 A1A2 A1A3 A2A2 A2A3 A3A3 Total
Number 23 61 28 39 41 8 200

(a) What is the value of the expected heterozygosity in the population?

Here we can write out the expected heterozygosity, H, as:

H = 1 - $\sum_{i=1}^{n} p^2_i$,

So, let’s get the frequency for each of these alleles by defining population size and also a variable for each genotype:

N <- 200;
a <- 23;
b <- 61;
c <- 28;
d <- 39;
e <- 49;
f <- 8;
# Now, let's get the frequencies of each allele
p1 <- (23+(61/2)+(28/2))/200
print(p1)
p2 <- ((61/2)+39+(41/2))/200
print(p2)
p3 <- ((28/2)+(41/2)+8)/200
print(p3)
[1] 0.3375
[1] 0.45
[1] 0.2125

Now we just need subtract the squares from 1

H <- 1 - (p1)^2 - (p2)^2 - (p3)^2
print(H)
[1] 0.6384375