<span><span lang="en"><span>For some purpose I found myself generating and analyzing the average of the combinations of a set and when I generated the corresponding histogram I was surprised by its shape.</span></span></span><br><span><span lang="en"><span><br></span></span></span><span><span lang="en"><span>It should be remembered that the combinations C(<span>m</span>, <span>n</span>) of a set are the number of subsets of a set of <span>m</span> elements taken from <span>n</span> in <span>n</span>.</span></span></span><br><br><span><span lang="en"><span><span lang="en"><span>The number of combinations is calculated with:</span></span></span></span></span><br><br><div><a href="https://4.bp.blogspot.com/-UgjCo57nzz8/WIeKqbVY-sI/AAAAAAAACtA/_jzReJbLmfguE8JXg8fdSs6YcA8joJG1gCLcB/s1600/combs.png"></a></div><span><span lang="en"><span></span></span></span><br><span><span lang="en"><span>This is the very simple code to generate the combinations, calculate their mean and generate the histogram:</span></span></span><br><br><br><span><span lang="en"><span><span>m</span> &lt;- 50<br><span>n</span> &lt;- 6<br> </span></span></span><br><span><span lang="en"><span>COMBINATIONS &lt;- t(as.data.frame(combn(<span>m</span>,<span>n</span>)))<br><br>C_M &lt;- apply(COMBINATIONS, 1, mean)<br><br>hist_all &lt;-hist(C_M, breaks<span> </span>= length(unique(C_M)), col = &quot;blue&quot;)</span></span></span><br><span><span lang="en"><span><br></span></span></span><br><div><a href="https://3.bp.blogspot.com/-TFk1PGRZ9iQ/WIePZi3NPjI/AAAAAAAACtU/rvRj4v3pycgv47jwWi-SEDFSLqEfuajAACLcB/s1600/Hist50-6.png"></a></div><span><span lang="en"><span>Interesting histogram.</span> <span>It's as if there are two distributions.</span></span></span><br><span><span lang="en"><span></span></span><span lang="en"><span>But if we change the value of m by:</span></span></span><br><br><span lang="en"><span></span></span><span><span lang="en"><span><span>m</span> &lt;- 50<br><span>n</span> &lt;- 4</span></span></span><br><br><span><span lang="en"><span>We obtain the following histogram:</span></span></span><br><br><div><a href="https://3.bp.blogspot.com/-_7Uy0Kr8GGc/WIeQRbWW3WI/AAAAAAAACtc/xLzMijXK3EAn8jqL2N3gHcpxSPC2IqCgwCLcB/s1600/Hist50-4.png"></a></div><span><span lang="en"><span>Although it is a very simple math and programming exercise, the interesting thing is to interpret why histograms behave this way, so it becomes an exercise in understanding the visualization.</span></span></span><br><br><br><span><span lang="en"><span> <a target="_blank" rel="nofollow" href="https://github.com/pakinja/Data-R-Value/tree/master/Mean_Distribution_Combinations">https://github.com/pakinja/Data-R-Value</a></span></span></span><br><br><br>