Learn R Programming

HWEBayes (version 1.4)

LambdaOptim: Obtains values for the prior specification for lambda

Description

In the single $f$ model we may parameterize in terms of the allele frequencies and $\lambda=\log((f-f_{\min})/(1-f))$ where $f_{\min}=-p_{\min}/(1-p_{\min})$ and $p_{\min}$ is the minimum allele frequency. The prior for $\lambda$ is assumed normal and this function finds the mean and standard deviation of this normal, given two values for $f$, with associated probabilities.

Usage

LambdaOptim(nsim, bvec, f1, f2, p1, p2, init)

Arguments

nsim
the optimization is carried out by simulating from the joint prior on allele frequencies and $\lambda$, and this argument gives the number of simulations to take from the prior
bvec
vector of length $k$ of prior specification for the HWE Dirichlet prior, where $k$ is the number of alleles.
f1
first quantile for inbreeding coefficient $f$
f2
second quantile for inbreeding coefficient $f$
p1
probability associated with f1
p2
probability associated with f2
init
initial values for lambdamu and lambdasd

Value

  • lambdamuprior mean for $\lambda$
  • lambdasdprior standard deviation for $\lambda$

Warning

This function can be unstable and good starting values may be needed. It is also recommended to check the output by simulating from the given prior to see if the empirical quantiles match with those desired; the function SinglefPrior may be used for this

References

Wakefield, J. (2010). Bayesian methods for examining Hardy-Weinberg equilibrium. Biometrics; Vol 66:257-65

See Also

HWEImportSamp

Examples

Run this code
bvec <- c(1,1,1,1)
init <- c(-3,log(1.1))
lampr <- LambdaOptim(nsim=10000,bvec=bvec,f1=0,f2=0.26,p1=0.5,p2=0.95,init)

Run the code above in your browser using DataLab