=&quot;posterior prob for population 2&quot;)</code></pre>
</div>
<div id="exercise-3" class="section level3">
<h3>Exercise 3</h3>
<pre class="r"><code>#&#39; Compute the posterior parameters for allele frequencies given genotypes 
#&#39; and population labels
#&#39; @param x an n by R matrix of genotypes
#&#39; @param z an n vector of population assignments
#&#39; @param a a 2-vector of prior parameters
posterior_param_allele_frequencies=function(x,z,a){
 K = 2
 R = ncol(x)
 post_param = array(dim=c(2,K,R)