r - Extract only coefficients whose p values are significant from a logistic model -
i have run logistic regression, summary of name. "score" accordingly, summary(score)
gives me following
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 binomial family taken 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
what hoping achieve variables names , coefficients of variables have *
, **
, or ***
next pr(>|z|)
value. in other words, want aforementioned variables , coefficients pr(>|z|)
< .05.
ideally, i'd them in data frame. unfortunately, following code i've tried not work.
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,"
what this:
data.frame(summary(score)$coef[summary(score)$coef[,4] <= .05, 4])
Comments
Post a Comment