Genotype | A1A1 | A1A2 | A1A3 | A2A2 | A2A3 | A3A3 | Total |
---|---|---|---|---|---|---|---|
Number | 23 | 61 | 28 | 39 | 41 | 8 | 200 |
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
H <- 1 - (p1)^2 - (p2)^2 - (p3)^2
print(H)
[1] 0.6384375