## The Hardy-Weinberg principle and estimating allele frequencies

Bring your laptop to lecture today. Kristen helped you set up `R` and `JAGS` in lab on Tuesday, so by now, you should know how to download the `R` and `JAGS` scripts below so that you can follow along when I run them in lecture.

If you click on the link in the first bullet under "ABO blood group" alleles, you'll go to a site that illustrates the EM algorithm for making maximum-likelihood estimates of the allele frequencies. The website was written in `R` using the `Shiny` package. You'll see a number of other `R Shiny` applications before the end of the semester. If you'd like to see how the applications work, you can download the source code from my repository on Github: https://kholsinger.github.io/PopGen-Shiny/. Click the "View the Project on Github" link. Then click the "Clone or Download" button. If the "Use Git..." and "Open in Desktop" don't make any sense to you, which they probably won't, click "Download ZIP." You'll find a ZIP file that has a directory for each of the applications I've written. You can look at the source code (in `app.R` within each directory). If you navigate to that directory in `R` and `load(shiny)`, you should be able to run the application locally with `runApp()`. The one case where you might have trouble is with `Coalescent-structured-population`. One of the libraries I use in that application is a bit tricky to install. If you're interested, ask. I'll walk you through it.

### Bayesian estimates of allele frequencies

- One locus, two alleles:
- ABO blood group alleles: