rmlike {hwep} | R Documentation |
Estimates gamete genotype frequencies using a maximum likelihood approach and runs a likelihood ratio test for random mating.
rmlike(nvec, thresh = 1)
nvec |
A vector containing the observed genotype counts,
where |
thresh |
All groups with counts less than |
Let q
be the genotype frequencies. Let p
be the gamete
frequencies. Then random mating occurs if
q == stats::convolve(p, rev(p), type = "open")
. We test for
this hypothesis using likelihood inference, while estimating p
.
A list with the following elements:
p
The estimated gamete genotype frequencies. p[[i]]
is the estimated frequency for gamete genotype i-1
.
chisq_rm
The likelihood ratio test statistic for testing against the null of random mating.
df_rm
The degrees of freedom associated with
chisq_rm
.
p_rm
The p-value against the null of random mating.
David Gerard
## Randomly generate gamete frequencies set.seed(1) ploidy <- 10 pvec <- stats::runif(ploidy / 2 + 1) pvec <- pvec / sum(pvec) ## Genotype frequencies from gamete frequencies under random mating qvec <- stats::convolve(pvec, rev(pvec), type = "open") ## Generate data nvec <- c(stats::rmultinom(n = 1, size = 100, prob = qvec)) ## Run rmlike() rmlike(nvec = nvec)