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.

1 | ```
LambdaOptim(nsim, bvec, f1, f2, p1, p2, init)
``` |

`nsim` |
the optimization is carried out by simulating from the joint prior on allele frequencies and |

`bvec` |
vector of length |

`f1` |
first quantile for inbreeding coefficient |

`f2` |
second quantile for inbreeding coefficient |

`p1` |
probability associated with |

`p2` |
probability associated with |

`init` |
initial values for |

`lambdamu` |
prior mean for |

`lambdasd` |
prior standard deviation for |

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

Jon Wakefield (jonno@u.washington.edu)

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

1 2 3 | ```
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)
``` |

Questions? Problems? Suggestions? Tweet to @rdrrHQ or email at ian@mutexlabs.com.

Please suggest features or report bugs with the GitHub issue tracker.

All documentation is copyright its authors; we didn't write any of that.