14.7 Poisson-Log Generalized Linear Model (Poisson Regression)
Stan also supplies a single function for a generalized linear model with Poisson likelihood and log link function, i.e. a function for a Poisson regression. This provides a more efficient implementation of Poisson regression than a manually written regression in terms of a Poisson likelihood and matrix multiplication.
14.7.1 Probability Mass Function
If \(x\in \mathbb{R}^{n\cdot m}, \alpha \in \mathbb{R}^n, \beta\in \mathbb{R}^m\), then for \(y \in \mathbb{N}^n\), \[ \text{PoisonLogGLM}(y|x, \alpha, \beta) = \prod_{1\leq i \leq n}\text{Poisson}(y_i|\exp(\alpha_i + x_i\cdot \beta)). \]
14.7.2 Sampling Statement
y ~
poisson_log_glm
(x, alpha, beta)
Increment target log probability density with poisson_log_glm_lupmf(y | x, alpha, beta)
.
14.7.3 Stan Functions
real
poisson_log_glm_lpmf
(int y | matrix x, real alpha, vector beta)
The log Poisson probability mass of y
given the log-rate alpha + x * beta
.
real
poisson_log_glm_lupmf
(int y | matrix x, real alpha, vector beta)
The log Poisson probability mass of y
given the log-rate alpha + x * beta
dropping constant additive terms.
real
poisson_log_glm_lpmf
(int y | matrix x, vector alpha, vector beta)
The log Poisson probability mass of y
given the log-rate alpha + x * beta
.
real
poisson_log_glm_lupmf
(int y | matrix x, vector alpha, vector beta)
The log Poisson probability mass of y
given the log-rate alpha + x * beta
dropping constant additive terms.
real
poisson_log_glm_lpmf
(int[] y | row_vector x, real alpha, vector beta)
The log Poisson probability mass of y
given the log-rate alpha + x * beta
.
real
poisson_log_glm_lupmf
(int[] y | row_vector x, real alpha, vector beta)
The log Poisson probability mass of y
given the log-rate alpha + x * beta
dropping constant additive terms.
real
poisson_log_glm_lpmf
(int[] y | row_vector x, vector alpha, vector beta)
The log Poisson probability mass of y
given the log-rate alpha + x * beta
.
real
poisson_log_glm_lupmf
(int[] y | row_vector x, vector alpha, vector beta)
The log Poisson probability mass of y
given the log-rate alpha + x * beta
dropping constant additive terms.
real
poisson_log_glm_lpmf
(int[] y | matrix x, real alpha, vector beta)
The log Poisson probability mass of y
given the log-rate alpha + x * beta
.
real
poisson_log_glm_lupmf
(int[] y | matrix x, real alpha, vector beta)
The log Poisson probability mass of y
given the log-rate alpha + x * beta
dropping constant additive terms.
real
poisson_log_glm_lpmf
(int[] y | matrix x, vector alpha, vector beta)
The log Poisson probability mass of y
given the log-rate alpha + x * beta
.
real
poisson_log_glm_lupmf
(int[] y | matrix x, vector alpha, vector beta)
The log Poisson probability mass of y
given the log-rate alpha + x * beta
dropping constant additive terms.