1 #ifndef __STAN__PROB__DISTRIBUTIONS__UNIVARIATE__DISCRETE__BINOMIAL_HPP__
2 #define __STAN__PROB__DISTRIBUTIONS__UNIVARIATE__DISCRETE__BINOMIAL_HPP__
16 template <
bool propto,
27 static const char*
function =
"stan::prob::binomial_log(%1%)";
48 "Population size parameter",
52 "Probability parameter",
56 "Probability parameter",
61 "Successes variable",
"Population size parameter",
"Probability parameter",
81 for (
size_t i = 0; i < size; i++) {
86 + (N_vec[i] - n_vec[i]) *
log1m(theta_vec[i]);
91 template <
bool propto,
99 const T_prob& theta) {
104 template <
typename T_n,
114 return binomial_log<false>(n,N,theta,Policy());
118 template <
typename T_n,
125 const T_prob& theta) {
var multiply_log(const var &a, const var &b)
Return the value of a*log(b).
var log1m(const stan::agrad::var &a)
The log (1 - x) function for variables.
boost::math::tools::promote_args< T >::type log1m(T x)
Return the natural logarithm of one minus the specified value.
boost::math::tools::promote_args< T_a, T_b >::type multiply_log(T_a a, T_b b)
double value_of(T x)
Return the value of the specified scalar argument converted to a double value.
boost::math::tools::promote_args< T_N, T_n >::type binomial_coefficient_log(T_N N, T_n n)
Return the log of the binomial coefficient for the specified arguments.
bool check_consistent_sizes(const char *function, const T1 &x1, const T2 &x2, const char *name1, const char *name2, T_result *result, const Policy &)
bool check_bounded(const char *function, const T_y &y, const T_low &low, const T_high &high, const char *name, T_result *result, const Policy &)
bool check_finite(const char *function, const T_y &y, const char *name, T_result *result, const Policy &)
Checks if the variable y is finite.
bool check_nonnegative(const char *function, const T_y &y, const char *name, T_result *result, const Policy &)
boost::math::policies::policy default_policy
Default error-handling policy from Boost.
return_type< T_prob >::type binomial_log(const T_n &n, const T_N &N, const T_prob &theta, const Policy &)
Probability, optimization and sampling library.
size_t length(const T &x)
size_t max_size(const T1 &x1, const T2 &x2)
Template metaprogram to calculate whether a summand needs to be included in a proportional (log) prob...
boost::math::tools::promote_args< typename scalar_type< T1 >::type, typename scalar_type< T2 >::type, typename scalar_type< T3 >::type, typename scalar_type< T4 >::type, typename scalar_type< T5 >::type, typename scalar_type< T6 >::type >::type type