title: Estimating a probability given other probabilities from a prior
body: <p>I have a bunch of data coming in (calls to an automated callcenter) about whether or not a person buys a particular product, 1 for buy, 0 for not buy.</p>
  
  <p>I want to use this data to create an estimated probability that a person will buy a particular product, but the problem is that I may need to do it with relatively little historical data about how many people bought/didn't buy that product.</p>
  
  <p>A friend recommended that with Bayesian probability you can "help" your probability estimate by coming up with a "prior probability distribution", essentially this is information about what you expect to see, prior to taking into account the actual data.</p>
  
  <p>So what I'd like to do is create a method that has something like this signature (Java):</p>
  
  <pre><code>double estimateProbability(double[] priorProbabilities, int buyCount, int noBuyCount);
  </code></pre>
  
  <p>priorProbabilities is an array of probabilities I've seen for previous products, which this method would use to create a prior distribution for this probability.  buyCount and noBuyCount are the actual data specific to this product, from which I want to estimate the probability of the user buying, given the data and the prior.  This is returned from the method as a double.</p>
  
  <p>I don't need a mathematically perfect solution, just something that will do better than a uniform or flat prior (ie. <em>probability = buyCount / (buyCount+noBuyCount)</em>).  Since I'm far more familiar with source code than mathematical notation, I'd appreciate it if people could use code in their explanation.</p>