| rmlike | R Documentation |
Estimates gamete genotype frequencies using a maximum likelihood approach and runs a likelihood ratio test for random mating.
rmlike(nvec, thresh = 1, nstarts = 10)
nvec |
A vector containing the observed genotype counts,
where |
thresh |
All groups with counts less than |
nstarts |
The number of random restarts to the EM algorithm. Set this to 0 for only one run. |
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:
pThe estimated gamete genotype frequencies. p[[i]]
is the estimated frequency for gamete genotype i-1.
chisq_rmThe likelihood ratio test statistic for testing against the null of random mating.
df_rmThe degrees of freedom associated with
chisq_rm.
p_rmThe 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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.