)
 for(k in 1:K){
   for(r in 1:R){
     ...
   }
 }
 return(post_param)
}</code></pre>
<p>Here we can run this on the example data:</p>
<pre class="r"><code>set.seed(123)
sim = r_simplemix(n=20,P)
posterior_param = posterior_param_allele_frequencies(sim$x,sim$z,a = c(1,1))
posterior_param[,1,] # these should be the posterior parameters for population 1
posterior_param[,2,] # these should be the posterior parameters for population 2</code></pre>
<br>
<p>
<button type="button" class="btn btn-default btn-work