1 #ifndef STAN_MATH_PRIM_SCAL_PROB_NEG_BINOMIAL_2_CDF_LOG_HPP
2 #define STAN_MATH_PRIM_SCAL_PROB_NEG_BINOMIAL_2_CDF_LOG_HPP
18 #include <boost/math/special_functions/digamma.hpp>
19 #include <boost/random/negative_binomial_distribution.hpp>
20 #include <boost/random/variate_generator.hpp>
28 template <
typename T_n,
typename T_location,
30 typename return_type<T_location, T_precision>::type
33 const T_precision& phi) {
47 static const char*
function(
"stan::math::neg_binomial_2_cdf");
53 "Location parameter", mu,
54 "Precision Parameter", phi);
60 size_t size_phi_mu =
max_size(mu, phi);
63 std::vector<typename return_type<T_location, T_precision>::type>
65 std::vector<typename return_type<T_n>::type> np1(size_n);
67 for (
size_t i = 0; i < size_phi_mu; i++)
68 phi_mu[i] = phi_vec[i]/(phi_vec[i]+mu_vec[i]);
70 for (
size_t i = 0; i < size_n; i++)
74 np1[i] = n_vec[i] + 1.0;
bool check_less(const char *function, const char *name, const T_y &y, const T_high &high)
Return true if y is strictly less than high.
bool check_not_nan(const char *function, const char *name, const T_y &y)
Return true if y is not NaN.
fvar< T > log(const fvar< T > &x)
size_t length(const std::vector< T > &x)
size_t max_size(const T1 &x1, const T2 &x2)
return_type< T_y, T_scale_succ, T_scale_fail >::type beta_cdf_log(const T_y &y, const T_scale_succ &alpha, const T_scale_fail &beta)
bool check_consistent_sizes(const char *function, const char *name1, const T1 &x1, const char *name2, const T2 &x2)
Return true if the dimension of x1 is consistent with x2.
bool check_nonnegative(const char *function, const char *name, const T_y &y)
Return true if y is non-negative.
return_type< T_location, T_precision >::type neg_binomial_2_cdf_log(const T_n &n, const T_location &mu, const T_precision &phi)
VectorView is a template metaprogram that takes its argument and allows it to be used like a vector...
bool check_positive_finite(const char *function, const char *name, const T_y &y)
Return true if y is positive and finite.