Learn R Programming

HWEBayes (version 1.4)

SinglefReject: Samples from the posterior for the single f model

Description

Function to generate samples from the posterior for allele frequencies and $f$, under the single $f$ model. Samples are generated using a rejection algorithm that simulates from the prior.

Usage

SinglefReject(nsim, bvec, lambdamu, lambdasd, nvec)

Arguments

nsim
number of samples to generate from the prior.
bvec
vector of size $k$ that is the specification for the Dirichlet prior on the allele frequencies.
lambdamu
prior mean for $\lambda$.
lambdasd
prior standard deviation for $\lambda$.
nvec
vector of genotype frequencies in the order $n_{11}, n_{21}, n_{22}, ..., n_{k1}, n_{k2}, ..., n_{kk}$.

Value

  • psampsamples for $k$ allele frequencies.
  • fsampsamples for inbreeding coefficient $f$.
  • accrateacceptance rate of the rejection algorithm.
  • PrnH1estimate of normalizing constant (which may be used in Bayes factor calculations). Calculated by averaging the likelihood over the sampled points.
  • varestestimated variance of the estimate of the normalizing constant.

References

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

Examples

Run this code
data(DiabRecess)
postsampf1 <- SinglefReject(nsim=100,bvec=rep(1,4),lambdamu=-2.95,
   lambdasd=1.07,nvec=DiabRecess)

Run the code above in your browser using DataLab