Feature/issue 1129 neg binomial 2 cdfs

#### Summary:
Fix issue #1129. Adds neg_binomial_2 CDFs.

#### Intended Effect:
 Adds neg_binomial_2 CDFs.

#### How to Verify:
Check code and unit tests.

#### Side Effects:
None.

#### Documentation:
Included.

#### Reviewer Suggestions:
Anyone.
I think the right thing to do is throw a domain error if the input
is out of computable range.

For the extreme tails of a (C)CDF, it's valid to just set the
value to 1 and the derivative to 0, because that's the best you
can do with floating point.  

But I think it should be done directly by looking at the input
values.

I also think we still need to make sure we have test cases that
tickle each branch of the code.

- Bob

> On Nov 19, 2014, at 4:40 PM, Marco Inacio <notifications@github.com> wrote:
> 
> In src/stan/prob/distributions/univariate/discrete/neg_binomial_2.hpp:
> 
> > +      VectorView<const T_location> mu_vec(mu);
> > +      VectorView<const T_precision> phi_vec(phi);
> > +      
> > +      size_t size_phi_mu = max_size(mu, phi);
> > +      size_t size_n = length(n);
> > +      
> > +      std::vector<typename return_type<T_location, T_precision>::type> phi_mu(size_phi_mu);
> > +      std::vector<typename return_type<T_n>::type> np1(size_n);
> > +
> > +      for (size_t i = 0; i < size_phi_mu; i++)
> > +        phi_mu[i] = phi_vec[i]/(phi_vec[i]+mu_vec[i]);
> > +
> > +      for (size_t i = 0; i < size_n; i++)
> > +        if (n_vec[i] < 0)
> > +          return 0.0; //log(1.0)        
> > +        else if (n_vec[i] + 1 < 0) //avoid int "overflow"
> 
> If phi is small compared to n, the cdf will be 1.
> 
> I've done this ugly hack because otherwise, the upper bound test wouldn't pass, since if n is largest long int 2147483647, then n + 1 (that is passed to beta_cdf) will be -2147483648!
> 
> But, how is the correct way to deal with that?
> 
> —
> Reply to this email directly or view it on GitHub.
>