似然比檢驗 LRT

似然比檢驗(likelihood ratio test, LRT)是一種檢驗參數能否反映真實約束的方法(分佈或模型的某參數 \theta 等於 \theta_0 是否爲真實約束)。似然比檢驗的思想是:“如果參數約束是有效的,那麼加上這樣的約束不應該引起似然函數最大值的大幅度降低。也就是說似然比檢驗的實質是在比較有約束條件下的似然函數最大值與無約束條件下似然函數最大值。” 可以看出,似然比檢驗是一種通用的檢驗方法(比 t 檢驗、\chi ^2 檢驗等具有更廣的適用範圍)。

以下摘自《應用多元統計分析》:

考慮多元正態分佈N_q(\theta ,I),爲了檢驗 \theta 是否等於 \theta_0,我們建立檢驗問題:

      H_0:\theta =\theta _0

      H_1: 對\theta沒有約束

或者等價地,\Omega _0=\left \{ \theta _0 \right \}, \Omega _1=R^q

定義 L_j^*=maxL(X;\theta ) 爲每個假設似然函數的最大值。考慮似然比(LR):

      \lambda (X)=\frac{L_0^*}{L_1^*}      或者寫成對數形式  -2log\lambda =2(l_1^*-l_2^*)   

[ 注:通常寫成乘以2形式是爲了之後推導中近似變換爲卡方值,即-2log\lambda 的漸進分佈是 \chi _{q-r}^2 ,其中 \Omega _0\in \Omega _1 是 r 維 ]

如果LR值比較高,則傾向於接受 H_0 ,否則傾向於接受 H_1 。

關於似然函數,可以參考:

似然與極大似然估計

似然函數及最大似然估計及似然比檢驗

 

似然比檢驗LRT的應用廣泛,包括:均值(包括均值向量的比較重複度量輪廓分析(趨勢比較)、模型適合度等等。

均值向量的比較:以二維向量爲例,比如同時檢驗A、B兩組人羣的身高 x_1 和 體重 x_2 是否來自同一總體,可將身高和體重的均值組合成向量,即A組的均值向量爲 \vec{\mu}_A=(x_{1A},x_{2A}),B組的均值向量爲 \vec{\mu}_B=(x_{1B},x_{2B}),對這兩組均值向量進行檢驗(此處LRT其實等價於Hotelling's T2檢驗)。均值向量的問題,其實本質上是線性假設(線性約束)問題,並且也可以用作迴歸係數的假設檢驗。

重複度量:同一個指標在同一個主體上進行多次測量,檢驗多次測量值之間是否有差異(比如是否存在時間效應及治療效應)。

輪廓分析:以兩組的輪廓爲例,當重複測量發生在兩組主體中時,想考量兩組的重複測量趨勢是否一致。對於這個問題,可以從這3方面考慮(這3方面需依次考慮):

  1. 基於平行的定義,這些輪廓相似嗎(輪廓是否平行,注意這裏不相交便意味着平行)?
  2. 如果輪廓是平行的,二者處於同一水平嗎(兩組輪廓是否爲同一輪廓)?
  3. 如果輪廓是平行的,但二者不處於同一水平,輪廓存在治療效應嗎(無論接受何種治療,輪廓是否始終保持相同,趨勢是否一致)?

這些問題可以轉換爲均值的線性約束問題進行求解。

這些內容的具體介紹請參考《應用多元統計分析》。

下面僅介紹使用似然比檢驗評估模型的適合度。

 

評估模型的適合度

似然比檢驗用來評估兩個模型中那個模型更適合當前數據分析。具體來說,一個相對複雜的模型與一個簡單模型比較,來檢驗它是不是能夠顯著地適合一個特定的數據集。如果可以,那麼這個複雜模型的附加參數能夠用在以後的數據分析中。LRT應用的一個前提條件是這些待比較的模型應該是分級的巢式模型。具體來講,是說相對於簡單模型,複雜模型僅僅是多了一個或者多個附加參數。增加模型參數必定會導致高似然值成績。因此根據似然值的高低來判斷模型的適合度是不準確的。LRT提供了一個客觀的標準來選擇合適的模型。LRT檢驗的公式: LR = 2*(InL1- InL2)

其中L1爲複雜模型最大似然值,L2爲簡單標準模型最大似然值LR近似的符合卡方分佈。爲了檢驗兩個模型似然值的差異是否顯著,我們必須要考慮自由度。LRT 檢驗中,自由度等於在複雜模型中增加的模型參數的數目。這樣根據卡方分佈臨界值表,我們就可以判斷模型差異是否顯著。

以下摘自維基百科:

In statistics, a likelihood ratio test (LR test) is a statistical test used for comparing the goodness of fit of two statistical models — a null model against an alternative model. The test is based on the likelihood ratio, which expresses how many times more likely the data are under one model than the other. This likelihood ratio, or equivalently its logarithm, can then be used to compute a p-value, or compared to a critical value to decide whether or not to reject the null model.

When the logarithm of the likelihood ratio is used, the statistic is known as a log-likelihood ratio statistic, and the probability distribution of this test statistic, assuming that the null model is true, can be approximated using Wilks' theorem.

In the case of distinguishing between two models, each of which has no unknown parameters, use of the likelihood ratio test can be justified by the Neyman–Pearson lemma, which demonstrates that such a test has the highest power among all competitors.

Being a function of the data x, the likelihood ratio is therefore a statistic. The likelihood ratio test rejects the null hypothesis if the value of this statistic is too small. How small is too small depends on the significance level of the test, i.e., on what probability of Type I error is considered tolerable ("Type I" errors consist of the rejection of a null hypothesis that is true).

The numerator corresponds to the likelihood of an observed outcome under the null hypothesis. The denominator corresponds to the maximum likelihood of an observed outcome varying parameters over the whole parameter space. The numerator of this ratio is less than the denominator. The likelihood ratio hence is between 0 and 1. Low values of the likelihood ratio mean that the observed result was less likely to occur under the null hypothesis as compared to the alternative. High values of the statistic mean that the observed outcome was nearly as likely to occur under the null hypothesis as the alternative, and the null hypothesis cannot be rejected.

The likelihood-ratio test requires nested models – models in which the more complex one can be transformed into the simpler model by imposing a set of constraints on the parameters. If the models are not nested, then a generalization of the likelihood-ratio test can usually be used instead: the relative likelihood.

也就是說,比較的兩個模型之間存在“嵌合關係”,其中一個模型的變量無約束,另一個模型的變量是前者經過約束後得到的。如果兩個模型之間不是嵌套關係,那麼就不能使用LRT,而要使用廣義的LRT,即相對LR。

在R裏面有很多包都有這個函數,最常使用的是rms包中的lrtest()。如:

library(rms)
all.X <-data.frame(x.T=data.T, x.N=data.N, x.S=data.S, x.G=data.G, x.V=data.V, x.P=data.P, x.CEA2=data.CEA2, x.CA1992=data.CA1992)
TN.model <- cph(Surv(survival.time,survival.status)~ x.T+x.N, 
                data=all.X, na.action=na.omit )
TNC.model <- cph(Surv(survival.time,survival.status)~ x.T+x.N+x.CEA2, 
                 data=all.X, na.action=na.omit )
TN2TNC <- lrtest(TN.model, TNC.model)

 

除了似然比檢驗,還有Wald檢驗、拉格朗日乘數檢驗都是基於最大似然估計MLE。當樣本量較大時,三者是漸進等價的。

尼曼-皮爾森引理說明,似然比檢驗是所有具有同等顯著性差異的檢驗中最有統計效力的檢驗。

另外這個博客可以參考以下:似然函數及最大似然估計及似然比檢驗

 

參考資料:

《應用多元統計分析》 Wolfgang Hardle等著,陳詩一譯. 北京大學出版社

似然函數及最大似然估計及似然比檢驗

似然與極大似然估計

維基百科 - likelihood ratio test

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章