首页 文章

NA的优势比是什么意思?

提问于
浏览
0

我目前正在使用独立变量和因变量作为逻辑变量进行着陆页测试 . 我想检查哪些变量(如果为真)是转换的主要因素 .

所以基本上我们正在测试单个变量的多个变体 . 例如,我们有三个不同的图像,如果图像1对于一行为真,则另外两个变量为假 .

我使用Logistic回归进行此测试 . 当我查看比值比输出时,我最终得到了很多NA . 我不确定如何解释它们以及如何纠正它们 .

以下是样本数据集 . 实际数据有18000行 .

enter image description here

classifier1 <- glm(formula = Target ~ .,
              family = binomial,
              data = Dataset)

这是输出 .

enter image description here

这是否意味着我需要更多数据?还有其他方法可以进行多变量登陆页面测试吗?

1 回答

  • 0

    看起来两个或多个变量(列)完全相关 . 尝试删除多个列 .

    您可以在玩具 data.frame 上看到随机内容:

    n <- 20
    y <- matrix(sample(c(TRUE, FALSE), 5 * n, replace = TRUE), ncol = 5)
    colnames(y) <- letters[1:5]
    z <- as.data.frame(y)
    z$target <- rep(0:1, 2 * n)[1:nrow(z)]
    m <- glm(target ~ ., data = z, family = binomial)
    summary(m)
    

    在摘要中,您可以看到一切正常 .

    Call:
    glm(formula = target ~ ., family = binomial, data = z)
    
    Deviance Residuals: 
         Min        1Q    Median        3Q       Max  
    -1.89808  -0.48166  -0.00004   0.64134   1.89222  
    
    Coefficients:
                 Estimate Std. Error z value Pr(>|z|)  
    (Intercept)  -22.3679  4700.1462  -0.005   0.9962  
    aTRUE          3.2286     1.6601   1.945   0.0518 .
    bTRUE         20.2584  4700.1459   0.004   0.9966  
    cTRUE          0.7928     1.3743   0.577   0.5640  
    dTRUE         17.0438  4700.1460   0.004   0.9971  
    eTRUE          2.9238     1.6658   1.755   0.0792 .
    ---
    Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
    
    (Dispersion parameter for binomial family taken to be 1)
    
        Null deviance: 27.726  on 19  degrees of freedom
    Residual deviance: 14.867  on 14  degrees of freedom
    AIC: 26.867
    
    Number of Fisher Scoring iterations: 18
    

    但是,如果你使两列完全相关,如下所示,然后制作广义线性模型:

    z$a <- z$b
    m <- glm(target ~ ., data = z, family = binomial)
    summary(m)
    

    您可以按如下方式观察NA

    Call:
    glm(formula = target ~ ., family = binomial, data = z)
    
    Deviance Residuals: 
         Min        1Q    Median        3Q       Max  
    -1.66621  -1.01173   0.00001   1.06907   1.39309  
    
    Coefficients: (1 not defined because of singularities)
                 Estimate Std. Error z value Pr(>|z|)
    (Intercept)  -18.8718  3243.8340  -0.006    0.995
    aTRUE         18.7777  3243.8339   0.006    0.995
    bTRUE              NA         NA      NA       NA
    cTRUE          0.3544     1.0775   0.329    0.742
    dTRUE         17.1826  3243.8340   0.005    0.996
    eTRUE          1.1952     1.2788   0.935    0.350
    
    (Dispersion parameter for binomial family taken to be 1)
    
        Null deviance: 27.726  on 19  degrees of freedom
    Residual deviance: 19.996  on 15  degrees of freedom
    AIC: 29.996
    
    Number of Fisher Scoring iterations: 17
    

相关问题