べんきのにっき

いろいろと垂れ流します。

多項分布で尤度比検定

概要

多項分布の尤度比検定を計算する

多項分布

尤度

 \displaystyle
l( \theta | x ) = \frac{ n! }{ \prod x _{i} ! } \prod \theta _{i} ^{x _{i} }

対数尤度

 \displaystyle
L = \log l = \log n! - \sum \log x _{i} ! + \sum x _{i} \log \theta _{i}

尤度比検定

帰無仮説 \displaystyle H _{0} : \theta \in \Theta _{0} に対する \displaystyle H _{1} : \theta \in  \Theta - \Theta _{0} を検定する。

検定統計量のもととなる尤度比は次のように定義される。

 \displaystyle
\lambda _{n} = \frac{ \sup _{ \theta \in  \Theta _{0} } \prod f(x| \theta) }{ \sup _{ \theta \in  \Theta} \prod f (x | \theta )}

今回の帰無仮説 \displaystyle \theta _{i}= \frac{1}{c}であるから、尤度比の分子はすべての \theta _{i} \frac{1}{c}を代入すればよい。

分母のほうは、普通にMLEを使用すればよい。

脱線:多項分布のMLEの求め方

ちなみに \sum \theta _{i}=1という制約があるので、ラグランジュ乗数を \rhoとして次を考える。

 \displaystyle
L - \rho \left( 1- \sum \theta _{i} \right)

これを最大化すればよい。

パラメータで微分する

 \displaystyle
\frac{x _{i}}{ \theta _{i}} - \rho =0

ラグランジュ乗数で微分する

 \displaystyle
 1- \sum \theta _{i} =0

パラメータで微分した方の式を全部足すと

 \displaystyle
\rho  \sum \theta _{i} = \sum x _{i}
\longleftrightarrow \rho = n

よって、MLEは次のようになる。

 \displaystyle
\hat{\theta} _{i} = \frac{x _{i}}{n}

求める尤度比

 \displaystyle
\lambda _{n} = \frac{ \sup _{ \theta \in  \Theta _{0} } \prod f(x| \theta) }{ \sup _{ \theta \in  \Theta} \prod f (x | \theta )}

 \displaystyle
= \frac{ \frac{ n! }{ \prod x _{i} ! } \prod \frac{1}{c} ^{x _{i} } }{ \frac{ n! }{ \prod x _{i} ! } \prod \frac{ x _{i} }{n} ^{x _{i} } }

 \displaystyle
= \prod \left( \frac{n}{c x _{i}} \right) ^{x _{i}}

尤度比検定の検定統計量

検定統計量は、尤度比の対数をとって-2倍する。

 \displaystyle
-2 \log L = 2 \sum x _{i} \log \frac{c x _{i}}{n}

今回はこれが自由度 c-1カイ二乗分布に従う。