gregorius {GeneticsBase} | R Documentation

## Probability of Observing All Alleles with a Given Frequency in a Sample of a Specified Size.

### Description

Probability of observing all alleles with a given frequency in a sample of a specified size.

### Usage

    gregorius(freq, N, missprob, tol = 1e-10, maxN = 10000, maxiter=100, showiter = FALSE)

### Arguments

`freq` | (Minimum) Allele frequency (required)
`N` | Number of sampled genotypes
`missprob` | Desired maximum probability of failing to observe an allele.
`tol` | Omit computation for terms which contribute less than this value.
`maxN` | Largest value to consider when searching for N.
`maxiter` | Maximum number of iterations to use when searching for N.
`showiter` | Boolean flag indicating whether to show the iterations performed when searching for N.

### Details

If `freq` and `N` are provided, but `missprob` is omitted, this function computes the probability of failing to observe all alleles with true underlying frequency `freq` when `N` diploid genotypes are sampled. This is accomplished using the sum provided in Corollary 2 of Gregorius (1980), omitting terms which contribute less than `tol` to the result.

When `freq` and `missprob` are provide, but `N` is omitted. A binary search on the range of [1,`maxN`] is performed to locate the smallest sample size, `N`, for which the probability of failing to observe all alleles with true underlying frequency `freq` is at most `missprob`. In this case, `maxiter` specifies the largest number of iterations to use in the binary search, and `showiter` controls whether the iterations of the search are displayed.

### Value

A list containing the following values:

`call` | Function call used to generate this object.
`method` | One of the strings, "Compute missprob given N and freq", or "Determine minimal N given missprob and freq", indicating which type of computation was performed.
`retval$freq` | Specified allele frequency.
`retval$N` | Specified or computed sample size.
`retval$missprob` | Computed probability of failing to observe all of the alleles with frequency `freq`.

### Note

This code produces sample sizes that are slightly larger than those given in table 1 of Gregorius (1980). This appears to be due to rounding of the computed `missprob`s by the authors of that paper.

### Author(s)

Code submitted by David Duffy davidD@qumr.edu.au, substantially enhanced by Gregory R. Warnes warnes@bst.rochester.edu.

### References

Gregorius, H.R. 1980. The probability of losing an allele when diploid genotypes are sampled. Biometrics 36, 643-652.

### Examples

    # Compute the probability of missing an allele with frequency 0.15 when
    # 20 genotypes are sampled:
    gregorius(freq=0.15, N=20)

    # Determine what sample size is required to observe all alleles with true
    # frequency 0.15 with probability 0.95
    gregorius(freq=0.15, missprob=1-0.95)

[Package GeneticsBase version 1.6.0 Index]