16.2 Normal-id generalized linear model (linear regression)
Stan also supplies a single function for a generalized linear lodel with normal likelihood and identity link function, i.e. a function for a linear regression. This provides a more efficient implementation of linear regression than a manually written regression in terms of a normal likelihood and matrix multiplication.
16.2.1 Probability distribution function
If x∈Rn⋅m,α∈Rn,β∈Rm,σ∈R+, then for y∈Rn, NormalIdGLM(y|x,α,β,σ)=∏1≤i≤nNormal(yi|αi+xi⋅β,σ).
16.2.2 Sampling statement
y ~
normal_id_glm
(x, alpha, beta, sigma)
Increment target log probability density with normal_id_glm_lupdf(y | x, alpha, beta, sigma)
.
16.2.3 Stan functions
real
normal_id_glm_lpdf
(real y | matrix x, real alpha, vector beta, real sigma)
The log normal probability density of y
given location alpha + x * beta
and scale sigma
.
real
normal_id_glm_lupdf
(real y | matrix x, real alpha, vector beta, real sigma)
The log normal probability density of y
given location alpha + x * beta
and scale sigma
dropping constant additive terms.
real
normal_id_glm_lpdf
(real y | matrix x, vector alpha, vector beta, real sigma)
The log normal probability density of y
given location alpha + x * beta
and scale sigma
.
real
normal_id_glm_lupdf
(real y | matrix x, vector alpha, vector beta, real sigma)
The log normal probability density of y
given location alpha + x * beta
and scale sigma
dropping constant additive terms.
real
normal_id_glm_lpdf
(vector y | row_vector x, real alpha, vector beta, real sigma)
The log normal probability density of y
given location alpha + x * beta
and scale sigma
.
real
normal_id_glm_lupdf
(vector y | row_vector x, real alpha, vector beta, real sigma)
The log normal probability density of y
given location alpha + x * beta
and scale sigma
dropping constant additive terms.
real
normal_id_glm_lpdf
(vector y | row_vector x, vector alpha, vector beta, real sigma)
The log normal probability density of y
given location alpha + x * beta
and scale sigma
.
real
normal_id_glm_lupdf
(vector y | row_vector x, vector alpha, vector beta, real sigma)
The log normal probability density of y
given location alpha + x * beta
and scale sigma
dropping constant additive terms.
real
normal_id_glm_lpdf
(vector y | matrix x, real alpha, vector beta, real sigma)
The log normal probability density of y
given location alpha + x * beta
and scale sigma
.
real
normal_id_glm_lupdf
(vector y | matrix x, real alpha, vector beta, real sigma)
The log normal probability density of y
given location alpha + x * beta
and scale sigma
dropping constant additive terms.
real
normal_id_glm_lpdf
(vector y | matrix x, vector alpha, vector beta, real sigma)
The log normal probability density of y
given location alpha + x * beta
and scale sigma
.
real
normal_id_glm_lupdf
(vector y | matrix x, vector alpha, vector beta, real sigma)
The log normal probability density of y
given location alpha + x * beta
and scale sigma
dropping constant additive terms.