HWData generates samples of genotypic counts under various schemes. It mainly uses sampling from the multinomial distribution given Hardy-Weinberg allele frequencies.
HWData(nm = 100, n = rep(100, nm), f = rep(0, nm), p = NULL, conditional
= FALSE, exactequilibrium = FALSE, pdist = "runif", x.linked = FALSE, nA
= NULL,
n.males=rep(round(0.5*n),nm), ...)
A matrix containing the genotype counts.
The number of bi-allelic markers.
The sample sizes.
The inbreeding coefficients (only for autosomal markers)
a vector of allele frequencies
if TRUE
Haldane's distribution is used for sampling,
if FALSE
a multinomial distribution is used. Replaces
parameter pfixed
from the previous version of the package
generates data in exact HWE if set to
TRUE
Take a random allele frequency from a uniform or beta
distribution of pfixed = FALSE
and p
is not given.
Simulated autosomal markers (x.linked=FALSE
,
the default) or X-chromosomal markers (x.linked=TRUE
)
A vector of minor allele counts, one for each marker. If not
specified, it will be calculated from p
The number of males (only relevant if x.linked = TRUE
)
specific parameters for the uniform or beta
Jan Graffelman (jan.graffelman@upc.edu)
The exactequilibrium
option only takes effects for autosomal
markers (x.linked=FALSE
) and multinomial sampling
(conditional=FALSE
).
Option pfixed
is deprecated and replaced by conditional
HWData
returns a matrix of genotype counts, nm
by 3 for
autsomal markers or nm
by 5 for X-chromosomal markers. Output
is no longer supplied in the compositional form. Function
HWClo
can be used to convert the genotype counts to a composition.
If the inbreeding coefficient is specified (f
) it will only
take effect for autosomal markers (x.linked=FALSE
) and
multinomial sampling (conditional=FALSE
).
HWTernaryPlot
nm <- 100
n <- 100
out <- HWData(nm,n)
Run the code above in your browser using DataLab