hwefit {hwep} | R Documentation |
Estimates and tests for either equilibrium or random mating across many loci
using hwelike()
, hweustat()
,
rmlike()
, hwenodr()
, or hweboot()
.
hwefit( nmat, type = c("ustat", "mle", "rm", "nodr", "boot"), effdf = TRUE, thresh = 3, nboot = 2000, verbose = TRUE )
nmat |
A matrix of counts. The rows index the loci and the columns
index the genotypes. So |
type |
The method to use:
|
effdf |
A logical. Should we use the effective degrees of freedom?
Only applicable if |
thresh |
A non-negative numeric. The threshold for aggregating
genotypes. Only applicable if |
nboot |
The number of bootstrap iterations to use if
|
verbose |
Should we print more ( |
We provide parallelization support through the future package.
A data frame. The columns of which can are described in
hwelike()
, hweustat()
,
rmlike()
, or hwenodr()
.
David Gerard
## Generate random data set.seed(5) ploidy <- 4 nloc <- 100 size <- 1000 r <- 0.25 alpha <- 1/12 qvec <- hwefreq(r = r, alpha = alpha, ploidy = ploidy) nmat <- t(rmultinom(n = nloc, size = size, prob = qvec)) ## Run the analysis in parallel on the local computer with two workers future::plan(future::multisession, workers = 2) hout <- hwefit(nmat = nmat, type = "ustat") ## Shut down parallel workers future::plan("sequential") ## Show that p-values are uniform ## QQ-plot on -log10 scale qqpvalue(pvals = hout$p_hwe, method = "base") ## Kolmogorov-Smirnov Test stats::ks.test(hout$p_hwe, "qunif") ## Can control for Type I error mean(hout$p_hwe < 0.05) ## Consistent estimate for alpha alpha mean(hout$alpha1)