確率変数 Y {\displaystyle Y} が指数型分布族 である、つまり確率密度関数 f ( y ) {\displaystyle f(y)} は正準 (canonical) パラメーター θ {\displaystyle \theta } , 分散 (dispersion) パラメーター ϕ {\displaystyle \phi } とスカラー関数 a ( θ ) {\displaystyle a(\theta )} , c ( y , θ ) {\displaystyle c(y,\,\theta )} を用いて指数型
f ( y ; θ , ϕ ) = exp { y θ − a ( θ ) ϕ + c ( y , ϕ ) } {\displaystyle f(y;\theta ,\phi )=\exp \left\{{\frac {y\,\theta -a(\theta )}{\phi }}+c(y,\phi )\right\}}
で表すことができるものとする。
一般化線形モデルでは、指数型分布族の(正準パラメーター ) θ {\displaystyle \theta } について、リンク関数 (link function) と呼ばれる滑らかな関数 g ( θ ) {\displaystyle g(\theta )} と、別の確率変数 X {\displaystyle \mathbf {X} } の実現値 x {\displaystyle \mathbf {x} } とを用いて、 g ( θ ) = x T β {\displaystyle g(\theta )=\mathbf {x} ^{T}\,{\boldsymbol {\beta }}} と表すことができるものとする。
一般化線型モデルは下記の3つの要素から構成される。
1. 指数型分布族 の確率分布 2. 線形予測子 (linear predictor) η = x T β {\displaystyle \eta =\mathbf {x} ^{T}{\boldsymbol {\beta }}} 3. リンク関数 (link function) g {\displaystyle g} such that g ( θ ) = η {\displaystyle g(\theta )=\eta } 下記のように尤度関数を定める。
L ≡ log f ( y ; θ , ϕ ) = y θ − a ( θ ) ϕ + c ( y , ϕ ) {\displaystyle L\equiv \log {f(y;\theta ,\phi )}={\frac {y\,\theta -a(\theta )}{\phi }}+c(y,\phi )}
このとき、下記等式が成立する。
E ( ∂ L ∂ θ ) = 0 , E ( ∂ 2 L ∂ θ 2 ) = − E ( ∂ L ∂ θ ) 2 {\displaystyle E\left({\frac {\partial L}{\partial \theta }}\right)=0,\;E\left({\frac {\partial ^{2}L}{\partial \theta ^{2}}}\right)=-E\left({\frac {\partial L}{\partial \theta }}\right)^{2}}
この等式を用いて計算すると、確率変数 Y {\displaystyle Y} の平均 は a ′ ( θ ) {\displaystyle a'(\theta )} 、分散 は ϕ a ″ ( θ ) {\displaystyle \phi \,a''(\theta )} であることが分かる。
下記の他、多くの確率分布が指数分布族に分類される。
正規分布 ベルヌーイ分布 ポアソン分布 二項分布 ガウス分布 正規分布に従うモデル 既知の値 σ 2 {\displaystyle \sigma ^{2}} を用いて a ( θ ) = θ 2 / 2 {\displaystyle a(\theta )=\theta ^{2}/2} , ϕ = σ 2 {\displaystyle \phi =\sigma ^{2}} , c ( y , ϕ ) = − ( y 2 / σ 2 + log 2 π σ 2 ) / 2 {\displaystyle c(y,\,\phi )=-\left(y^{2}/\sigma ^{2}+\log {2\pi \sigma ^{2}}\right)/2} と表されるとき、 f ( y ; θ ) = 1 2 π σ exp ( − ( y − θ ) 2 2 σ 2 ) {\displaystyle f(y;\theta )={\frac {1}{{\sqrt {2\pi }}\sigma }}\exp {\left(-{\frac {(y-\theta )^{2}}{2\sigma ^{2}}}\right)}} は平均 θ {\displaystyle \theta } , 分散 σ 2 {\displaystyle \sigma ^{2}} の正規分布 に相当する。
リンク関数として g ( θ ) = θ {\displaystyle g(\theta )=\theta } (正準リンク<canonical link>とよぶ) を取るとき、これは、(正規線型モデル ) (通常の線型回帰) に相当する。平均 θ {\displaystyle \theta } は x T β {\displaystyle \mathbf {x} ^{T}\,{\boldsymbol {\beta }}} で与えられる。
ベルヌーイ分布に従うモデル p = e θ / ( 1 + e θ ) {\displaystyle p=e^{\theta }/(1+e^{\theta })} を用いて a ( θ ) = − log ( 1 − p ) {\displaystyle a(\theta )=-\log {(1-p)}} , ϕ = 1 {\displaystyle \phi =1} , c = 0 {\displaystyle c=0} と表されるとき、 f ( y ; θ ) = p y ( 1 − p ) 1 − y {\displaystyle f(y;\theta )=p^{y}(1-p)^{1-y}} は生起確率 p {\displaystyle p} のベルヌーイ分布 に相当する。
リンク関数として g ( θ ) = θ {\displaystyle g(\theta )=\theta } を取るとき、これは(ロジスティック回帰モデル ) (logistic regression model) に相当する。 Y = 1 , 0 {\displaystyle Y=1,0} の確率は、それぞれ、
P ( Y = 1 ∣ x ) = exp ( x T β ) 1 + exp ( x T β ) {\displaystyle P(Y=1\mid \mathbf {x} )={\frac {\exp {(\mathbf {x} ^{T}\,{\boldsymbol {\beta }})}}{1+\exp {(\mathbf {x} ^{T}\,{\boldsymbol {\beta }})}}}}
P ( Y = 0 ∣ x ) = 1 1 + exp ( x T β ) {\displaystyle P(Y=0\mid \mathbf {x} )={\frac {1}{1+\exp {(\mathbf {x} ^{T}\,{\boldsymbol {\beta }})}}}}
で与えられる。
リンク関数として g ( θ ) = ψ − 1 ( p ) {\displaystyle g(\theta )=\psi ^{-1}(p)} (ただし、 ψ {\displaystyle \psi } は標準正規分布 の累積分布関数) を取るとき、これは(プロビット回帰モデル )に相当する。 p = ψ ( x T β ) {\displaystyle p=\psi (\mathbf {x} ^{T}\,{\boldsymbol {\beta }})} となる。
パラメーターの決定には、ニュートン法 を用いた最尤法 などがある。