r语言 - 根据AIC和BIC,最佳模型只包含一个非显著项



我想知道为什么基于AIC和BIC值的最佳模型(m6)有一个非显著项,而第二最佳模型(m5)有一个显著项。

我有以下竞争型号列表:

m1=gls(Area_Km2~size+cent_Latitude+PCptail+pwingbilltar,corMartins(1,phy=ctree),data = c)
m2=gls(Area_Km2~size+cent_Latitude+PCptail,corMartins(1,phy=ctree),data = c)
m3=gls(Area_Km2~size+cent_Latitude,corMartins(1,phy=ctree),data = c)
m4=gls(Area_Km2~size,corMartins(1,phy=ctree),data = c)
m5=gls(Area_Km2~PCptail,corMartins(1,phy=ctree),data = c)
m6=gls(Area_Km2~cent_Latitude,corMartins(1,phy=ctree),data = c)
m7=gls(Area_Km2~pwingbilltar,corMartins(1,phy=ctree),data = c)

模型比较

   Model df      AIC      BIC    logLik   Test  L.Ratio p-value
m1     1  7 147.2775 157.9620 -66.63873                        
m2     2  6 139.4866 148.8187 -63.74331 1 vs 2 5.790838  0.0161
m3     3  5 133.3334 141.2510 -61.66672 2 vs 3 4.153191  0.0416
m4     4  4 130.7749 137.2186 -61.38746 3 vs 4 0.558517  0.4549
m5     5  4 127.0635 133.5072 -59.53175                        
m6     6  4 125.1006 131.5443 -58.55029                        
m7     7  4 132.4542 138.8979 -62.22711                        

这里是m6

 Generalized least squares fit by REML
  Model: Area_Km2 ~ cent_Latitude 
  Data: c 
       AIC      BIC    logLik
   125.1006 131.5442 -58.55029
Correlation Structure: corMartins
 Formula: ~1  
 Parameter estimate(s):
alpha 
    1 
Coefficients:
               Value Std.Error    t-value p-value
(Intercept)    0.4940905 0.1730082  2.8558795  0.0070
cent_Latitude -0.1592109 0.1726268 -0.9222837  0.3624
 Correlation: 
          (Intr)
cent_Latitude -0.158
Standardized residuals:
   Min         Q1        Med         Q3        Max 
-1.3270048 -0.7088524 -0.2828898  0.4672255  2.2203523 
Residual standard error: 1.066911 
Degrees of freedom: 39 total; 37 residual

Generalized least squares fit by REML
  Model: Area_Km2 ~ PCptail 
  Data: c 
       AIC      BIC    logLik
  127.0635 133.5072 -59.53175
Correlation Structure: corMartins
 Formula: ~1 
 Parameter estimate(s):
alpha 
    1 
Coefficients:
             Value  Std.Error   t-value p-value
(Intercept) 0.19752329 0.20158500 0.9798512  0.3335
PCptail     0.01925621 0.00851536 2.2613499  0.0297
 Correlation: 
        (Intr)
PCptail -0.595
Standardized residuals:
       Min         Q1        Med         Q3        Max 
-1.3416127 -0.6677304 -0.2467510  0.3198370  2.3339127 
Residual standard error: 1.01147 
Degrees of freedom: 39 total; 37 residual

这里至少发生了两件事。首先,断言具有最低AIC的模型是"最佳"模型是没有意义的。对于一组AIC不同的模型,i模型优于AIC最低的模型的相对概率为:(见这里,引用文献):

L = exp ((AIC <子> min - AIC <子>)/2)

因此,比较m5m6:

L = exp ((125.1006 - 127.0635)/2) = 0.374

或者,有37%的机会m5实际上是更好的模型。关键是,AIC为125.2和AIC为127之间没有显著差异,因此您不能说m6是"最好的"。两种模式的表现都差不多。

那么为什么cent_Latitudem6中不重要呢?p值> 0.05表示cent_Latitude对响应的影响与响应中的误差相比较小。这可能是因为真正的效应大小为0,也可能是因为效应大小与cent_latitude中的范围相结合,对响应产生的影响与响应中的误差相比很小。您可以在下面看到这一点,它使用虚构的数据并创建与您看到的真实数据相同的效果。

假设响应变量实际上取决于cent_LatitudePCptail。在m6中,由于PCptail的影响而引起的响应变异性被计入模型中的"误差",从而降低了cent_Latitude的计算意义。另一方面,在m5中,由于cent_Latitude的影响而引起的响应变异性被计入误差,从而降低了PCptail的重要性。如果与真实误差相比,效果大小刚好,就可以得到如下所示的效果。请注意,这是不建议使用单个统计量(如AIC、RSQ,甚至F)比较非嵌套模型的原因之一。

library(nlme)
set.seed(1)
# for simplicity, use un-correlated predictors
c <- data.frame(PCptail=sample(seq(0,10,.1),length(seq)),
                cent_Latitude=sample(seq(0,1,.01),length(seq)))
# response depends on both predictors
c$Area <- 1 + .01*c$PCptail +.1*c$cent_Latitude + rnorm(nrow(c),0,1)
m6 <- gls(Area~cent_Latitude,c)
m5 <- gls(Area~PCptail,c)
summary(m6)
# Generalized least squares fit by REML
#   Model: Area ~ cent_Latitude 
#   Data: c 
#        AIC      BIC    logLik
#   288.5311 296.3165 -141.2656
# 
# Coefficients:
#                    Value Std.Error   t-value p-value
# (Intercept)    1.1835936 0.1924341  6.150645  0.0000
# cent_Latitude -0.1882202 0.3324754 -0.566118  0.5726
# ...
summary(m5)
# Generalized least squares fit by REML
#   Model: Area ~ PCptail 
#   Data: c 
#        AIC      BIC    logLik
#   289.2713 297.0566 -141.6356
# 
# Coefficients:
#                 Value  Std.Error  t-value p-value
# (Intercept) 0.7524261 0.18871413 3.987121  0.0001
# PCptail     0.0674115 0.03260484 2.067530  0.0413
# ...

那么如何处理这个呢?你看过所有这些模型的残差图了吗?你看过Q-Q的情节吗?利用情节?一般来说,在所有其他因素相同的情况下,我会选择具有更重要参数的模型,假设残差是随机的和正态分布的,并且没有数据点具有异常高的杠杆作用。

您正在使用method = "REML"拟合模型,这是受限制的似然。它并不总是遵循REML下的最大似然将接近无限制ML下的似然。设置method = "ML",看看是否解决了AIC/BIC的"问题"。

最新更新