variance_number_of_distinct_alleles {numberofalleles}R Documentation

Compute the variance of the number of distinct alleles observed in a DNA mixture for a locus

Description

For a given number of independent alleles, compute the mean and variance of the number of distinct alleles observed in a DNA mixture.

Usage

variance_number_of_distinct_alleles(number_of_independent_alleles, f, fst = 0)

Arguments

number_of_independent_alleles

Integer. Number of independent alleles in the mixture.

f

Numeric vector with allele frequencies

fst

Numeric value for sub-population correction (also known as theta)

Details

Due to allele sharing between DNA mixture contributors, the number of distinct alleles observed in a mixture is often less than the number of independent alleles in the mixture. For example, if mixture comprises two unrelated contributors, there are four independent alleles. Some of these four independent alleles may be of the same allelic type so that at least one and at most four distinct alleles are observed.

This function computes the probability distribution of the number of distinct alleles observed when the mixtures comprises a given number of independent alleles. Optionally, a sub-population correction may be applied by setting fst>0.

Value

Variance (numeric of length one)

Examples

f <- c(A = 0.1, B = 0.2, C = 0.7)
v <- variance_number_of_distinct_alleles(3, f)

# now compute variance by hand from the full pr. dist of N
p <- pr_number_of_distinct_alleles(3, f)

n <- as.numeric(names(p))
p_n <- as.vector(p)

# compute expected value
ev <- expected_number_of_distinct_alleles(3, f)

# and variance by hand
v2 <- sum(p_n * (n - ev)^2)

stopifnot(all.equal(v,v2))

[Package numberofalleles version 1.0.1 Index]