LambdaOptim {HWEBayes}R Documentation

Obtains values for the prior specification for lambda

Description

In the single f model we may parameterize in terms of the allele frequencies and λ=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 λ 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 λ, 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

lambdamu prior mean for λ
lambdasd prior standard deviation for λ

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

Author(s)

Jon Wakefield (jonno@u.washington.edu)

References

Wakefield, J. (2009). Bayesian methods for examining Hardy-Weinberg equilibrium. Biometrics.

See Also

HWEImportSamp

Examples

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)

[Package HWEBayes version 1.0 Index]