Characterizing the "prominence" of a poll response
<p>I’m trying to characterize how prominent a selection is. 
You poll 10 people for their
favorite color and you get the following response:</p>

<pre><code>r = c(rep("blue",5),rep("green",4),rep("red",1))
</code></pre>

<p>And you make a contingency table:</p>

<pre><code>tab = table(r)
</code></pre>

<p>If you take the density of this...</p>

<pre><code>d = density(tab)
</code></pre>

<p>If you ask someone else and they say "red", you characterize the prominence
of this response by the integral of the portion of the probability density function equal to or less than the rate of their response:</p>

<pre><code>get.prominence = function(new.response){
  rate = tab[new.response]
  window.index = tail(which(d$x&lt;=rate),n=1)
  sum(d$y[1:window.index])/sum(d$y)
}
get.prominence("red") # .16
get.prominence("blue") # .77
</code></pre>

<p>Is this a reasonable way of doing this? There must be a known technique
for this and I don't know the name of it.</p>