View source: R/p_anc_hat_beta_mle.R
p_anc_est_beta_mle | R Documentation |
For each sample allele frequency x
in the input, this function calculates the maximum likelihood estimate of the true allele frequency passuming that the sample was drawn from a Beta distribution with mean
p and variance p*(1-p)*kinship
, where kinship
is the mean kinship of the sample and is known.
Note that, oddly, this function estimates the unknown p
from a single data point x
.
Nevertheless, this procedure results in favorable shrinkage of estimate towards 0.5.
p_anc_est_beta_mle(p_anc_est, kinship)
p_anc_est |
A vector of sample allele frequencies (each refered to as |
kinship |
The mean kinship coefficient of the data |
A vector of maximum likelihood estimates of allele frequencies.
The length of the vector is the same as the input p_anc_est
, and each element in the output was estimated from each corresponding element in the input only.
inv_var_est_bayesian()
for another way to get unbiased estimates of a specific class of inverse variance terms of interest in this project.
# select a relatively high value for example
kinship <- 0.1
# try a grid of values, including edge cases (0,1)
m_loci <- 1000
p_anc_est <- 0 : (m_loci - 1) / (m_loci - 1)
# calculate the desired estimates!
p_anc_mle <- p_anc_est_beta_mle( p_anc_est, kinship )
# notice values tend to be shrunk towards 0.5,
# except values near the edges of the range are shrunk less
plot( p_anc_est, p_anc_mle )
abline(0,1)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.