# 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

1 | ```
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 |

`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 |

### 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. (2010). Bayesian methods for examining Hardy-Weinberg equilibrium. Biometrics; Vol 66:257-65

### See Also

`HWEImportSamp`

### Examples

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)
``` |