public void update(BetaDistribution target, Number data) {
    final int n = this.getN();
    final int success = data.intValue();
    final int failure = n - success;
    double alpha = target.getAlpha();
    double beta = target.getBeta();
    alpha += success;
    beta += failure;

    target.setAlpha(alpha);
    target.setBeta(beta);
  }
 public BetaBinomialDistribution createPredictiveDistribution(BetaDistribution posterior) {
   return new BetaBinomialDistribution(this.getN(), posterior.getAlpha(), posterior.getBeta());
 }
 @Override
 public double computeEquivalentSampleSize(BetaDistribution belief) {
   double alpha = belief.getAlpha();
   double beta = belief.getBeta();
   return (alpha + beta) / this.getN() + 1.0;
 }