heterozygosity: Heterozygosities

Description Usage Arguments Value Author(s) See Also Examples

Description

Functions to calculate the observed and expected heterozygosities per locus. The input is the vector of numbers of individuals at each multilocus genotype.

Usage

1
2
het_obs(N, init.par, fG = NULL)
het_exp(N, init.par, fA = NULL)

Arguments

N

Vector (1-D array) giving the number of individuals of each multilocus genotype. Typically this is obtained from the output of a multilocus simulation by subsetting a single deme / age class / time step. See the example.

init.par

A list of arguments necessary to initialize the simulations and obtained with the function initialize.monoecious.multilocus. It must be the same list that has been used to simulate N.

fG

The genotype frequencies that will be used to the calculate allele frequencies: the output of freq_genotypes. If NULL, the function will call freq_genotypes.

fA

The allele frequencies that will be used to the calculate the expected heterozygosity: the output of freq_alleles. If NULL, the function will call freq_alleles.

Value

For het_obs, a vector of observed heterozygosities (ratio of number of heterozygotes to total number of individuals) per locus.

For het_exp, a vector of expected heterozygosities per locus, calculated as 1 - sum(p^2), where p is the allele frequency and the sum is taken over all alleles at a locus.

Author(s)

Marco Andrello

See Also

freq_genotypes freq_alleles

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
## Not run: 
data(MultilocusMonoecious)
N <- sim.metapopgen.monoecious.multilocus(init.par=init.par,
                                          sigma=sigma,
                                          phi_F=phi_F, phi_M=phi_M,
                                          delta.prop=delta.prop, delta.ad=delta.ad,
                                          T_max=T_max)
# Subsetting to get results from deme 1, age class 1 at time 3
N_deme1_age1_time3 <- N[,1,1,3]

# Observed heterozygosity
Ho <- het_obs(N_deme1_age1_time3, init.par)

# Expected heterozygosity
He <- het_exp(N_deme1_age1_time3, init.par)

## End(Not run)

MarcoAndrello/MetaPopGen-2.0 documentation built on Nov. 25, 2020, 11:20 p.m.