title: Creating a cumulative distribution from a vector
body: <p>I need to create a cumulative distribution from some numbers contained in a vector. The vector counts the number of times a dot product operation occurs in an algorithm I've been given.</p>
  
  <p>An example vector would be</p>
  
  <pre><code>myVector = [100 102 101 99 98 100 101 110 102 101 100 99]
  </code></pre>
  
  <p>I'd like to plot the probability that I have fewer than 99 dot products, against a range from 0 to 120. The built in function</p>
  
  <pre><code>Cumdist(MyVector)
  </code></pre>
  
  <p>Isn't appropriate as I need to plot over a wider range than cumdist currently provides. </p>
  
  <p>I've tried using </p>
  
  <pre><code>plot([0 N],cumsum(myVector))
  </code></pre>
  
  <p>but I have multiple entries which are the same value in my vector, and I can't work out how not to double count.</p>
  
  <p>Here is some python code which does what I want:</p>
  
  <pre><code>count = [x[0] for x in tests]
  found = [x[1] for x in tests]
  found.sort()
  num = Counter(found)
  freqs = [x for x in num.values()]
  cumsum = [sum(item for item in freqs[0:rank+1]) for rank in xrange(len(freqs))]
  normcumsum  = [float(x)/numtests for x in cumsum]
  </code></pre>
  
  <p>tests is a list of numbers representing the number of times a dot product was done. </p>
  
  <p>Here is an example of what I'm looking for:</p>
  
  <p><a href="http://i.stack.imgur.com/3v6pJ.png" rel="nofollow">Example cumulative distribution</a></p>