仅从逻辑模型中提取p值重要的系数

Jon*_*ton 13 regression r extract

我已经运行了逻辑回归,我给它起了总结."得分"因此,summary(score)给我以下

Deviance Residuals: 
    Min       1Q   Median       3Q      Max  
-1.3616  -0.9806  -0.7876   1.2563   1.9246  

                       Estimate Std. Error    z value    Pr(>|z|)
(Intercept)        -4.188286233 1.94605597 -2.1521921 0.031382230 *
Overall            -0.013407201 0.06158168 -0.2177141 0.827651866
RTN                -0.052959314 0.05015013 -1.0560154 0.290961160
Recorded            0.162863294 0.07290053  2.2340482 0.025479900 *
PV                 -0.086743611 0.02950620 -2.9398438 0.003283778 **
Expire             -0.035046322 0.04577103 -0.7656878 0.443862068
Trial               0.007220173 0.03294419  0.2191637 0.826522498
Fitness             0.056135418 0.03114687  1.8022810 0.071501212 .

---
Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1

(Dispersion parameter for binomial family taken to be 1)

    Null deviance: 757.25  on 572  degrees of freedom
Residual deviance: 725.66  on 565  degrees of freedom
AIC: 741.66

Number of Fisher Scoring iterations: 4
Run Code Online (Sandbox Code Playgroud)

我所希望做到的,是让那些有变量的变量名和系数*,*****挨着他们的Pr(>|z|)价值.换句话说,我希望上述变量和系数Pr(>|z|)<.05.

理想情况下,我想将它们放在数据框中.不幸的是,我尝试过以下代码不起作用.

variable_try <-
  summary(score)$coefficients[if(summary(score)$coefficients[, 4] <= .05, 
                                 summary(score)$coefficients[, 1]),]

Error: unexpected ',' in "variable_try <-
summary(score)$coefficients[if(summary(score)$coefficients[,4] < .05,"
Run Code Online (Sandbox Code Playgroud)

tca*_*h21 22

那这个呢:

data.frame(summary(score)$coef[summary(score)$coef[,4] <= .05, 4])
Run Code Online (Sandbox Code Playgroud)

  • @JonathanRossCharlton除非用户_explicitly_表明他们投了票,否则你无法知道是谁做的.投票完全是匿名的.无论如何,诸如"R Programming"之类的内容和特定用户的提及在标题中被认为是不合适的. (3认同)
  • @JonathanRossCharlton重新命名问题; 请**不要**那样做.它对任何人都有用吗? (2认同)