Automatic Differentiation
 
Loading...
Searching...
No Matches

◆ neg_binomial_2_log_glm_lpmf() [2/3]

template<bool propto, typename T_y , typename T_x , typename T_alpha , typename T_beta , typename T_precision , require_matrix_t< T_x > * = nullptr>
return_type_t< T_x, T_alpha, T_beta, T_precision > stan::math::neg_binomial_2_log_glm_lpmf ( const T_y &  y,
const T_x &  x,
const T_alpha &  alpha,
const T_beta &  beta,
const T_precision &  phi 
)

Returns the log PMF of the Generalized Linear Model (GLM) with Negative-Binomial-2 distribution and log link function.

The idea is that neg_binomial_2_log_glm_lpmf(y, x, alpha, beta, phi) should compute a more efficient version of neg_binomial_2_log_lpmf(y, alpha + x * beta, phi) by using analytically simplified gradients. If containers are supplied, returns the log sum of the probabilities.

Template Parameters
T_ytype of positive int vector of variates (labels); this can also be a single positive integer value;
T_x_scalartype of a scalar in the matrix of independent variables (features)
T_x_rowscompile-time number of rows of x. It can be either Eigen::Dynamic or 1.
T_alphatype of the intercept(s); this can be a vector (of the same length as y) of intercepts or a single value (for models with constant intercept);
T_betatype of the weight vector; this can also be a scalar;
T_precisiontype of the (positive) precision(s); this can be a vector (of the same length as y, for heteroskedasticity) or a scalar.
Parameters
yfailures count scalar or vector parameter. If it is a scalar it will be broadcast - used for all instances.
xdesign matrix or row vector. If it is a row vector it will be broadcast - used for all instances.
alphaintercept (in log odds)
betaweight vector
phi(vector of) precision parameter(s)
Returns
log probability or log sum of probabilities
Exceptions
std::invalid_argumentif container sizes mismatch.
std::domain_errorif x, beta or alpha is infinite.
std::domain_errorif phi is infinite or non-positive.
std::domain_errorif y is negative.

Definition at line 67 of file neg_binomial_2_log_glm_lpmf.hpp.