众所周知,有两种评估逻辑回归模型的方法,它们正在测试非常不同的东西
预测能力:
获得一个统计数据,衡量您根据自变量预测因变量的能力。著名的 Pseudo R^2 是 McFadden (1974) 和 Cox 和 Snell (1989)。
拟合优度统计
该测试告诉您是否可以通过使模型更复杂来做得更好,这实际上是在测试您是否遗漏了任何非线性或交互。
我在我的模型上实现了这两个测试,它
已经添加了二次和交互:
    >summary(spec_q2)
    Call:
    glm(formula = result ~ Top + Right + Left + Bottom + I(Top^2) + 
     I(Left^2) + I(Bottom^2) + Top:Right + Top:Bottom + Right:Left, 
     family = binomial())
     Coefficients:
                 Estimate Std. Error z value Pr(>|z|)    
    (Intercept)  0.955431   8.838584   0.108   0.9139    
    Top          0.311891   0.189793   1.643   0.1003    
    Right       -1.015460   0.502736  -2.020   0.0434 *  
    Left        -0.962143   0.431534  -2.230   0.0258 *  
    Bottom       0.198631   0.157242   1.263   0.2065    
    I(Top^2)    -0.003213   0.002114  -1.520   0.1285    
    I(Left^2)   -0.054258   0.008768  -6.188 6.09e-10 ***
    I(Bottom^2)  0.003725   0.001782   2.091   0.0366 *  
    Top:Right    0.012290   0.007540   1.630   0.1031    
    Top:Bottom   0.004536   0.002880   1.575   0.1153    
    Right:Left  -0.044283   0.015983  -2.771   0.0056 ** 
    ---
    Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
    (Dispersion parameter for binomial family taken to be 1)
    Null deviance: 3350.3  on 2799  degrees of freedom
    Residual deviance: 1984.6  on 2789  degrees of freedom
    AIC: 2006.6
预测功率如下,MaFadden 为 0.4004,取 0.2~0.4 之间的值表示模型拟合度非常好(Louviere et al (2000), Domenich and McFadden (1975)):
 > PseudoR2(spec_q2)
    McFadden     Adj.McFadden        Cox.Snell       Nagelkerke McKelvey.Zavoina           Effron            Count        Adj.Count 
   0.4076315        0.4004680        0.3859918        0.5531859        0.6144487        0.4616466        0.8489286        0.4712500 
         AIC    Corrected.AIC 
2006.6179010     2006.7125925 
和拟合优度统计:
 > hoslem.test(result,phat,g=8)
     Hosmer and Lemeshow goodness of fit (GOF) test
  data:  result, phat
  X-squared = 2800, df = 6, p-value < 2.2e-16
据我了解,GOF 实际上是在测试以下零假设和备择假设:
  H0: The models does not need interaction and non-linearity
  H1: The models needs interaction and non-linearity
由于我的模型添加了交互,非线性已经和 p 值显示 H0 应该被拒绝,所以我得出的结论是我的模型确实需要交互,非线性。希望我的解释是正确的,并感谢您提前提供任何建议,谢谢。