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

◆ neg_binomial_2_log_glm_lpmf() [1/3]

template<bool propto, typename T_y_cl , typename T_x_cl , typename T_alpha_cl , typename T_beta_cl , typename T_phi_cl , require_all_prim_or_rev_kernel_expression_t< T_x_cl, T_y_cl, T_alpha_cl, T_beta_cl, T_phi_cl > * = nullptr>
return_type_t< T_x_cl, T_alpha_cl, T_beta_cl, T_phi_cl > stan::math::neg_binomial_2_log_glm_lpmf ( const T_y_cl &  y,
const T_x_cl &  x,
const T_alpha_cl &  alpha,
const T_beta_cl &  beta,
const T_phi_cl &  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. This is an overload of the GLM in prim/prob/neg_binomial_2_log_glm_lpdf.hpp that is implemented in OpenCL.

Template Parameters
T_y_cltype of independent variable; this can be a matrix_cl vector of intercepts or a single value (wich will be broadcast - used for all instances);
T_x_cltype of the design matrix
T_alpha_cltype 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_beta_cltype of the weight vector; this can also be a scalar;
T_phi_cltype 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 on OpenCL device. If it is a scalar it will be broadcast - used for all instances.
xdesign matrix on OpenCL device. This overload does not support broadcasting of a row vector x!
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 69 of file neg_binomial_2_log_glm_lpmf.hpp.