R language Access Menu

Title Text Both  

Most important predictors with bestglm package

This package also gives out  a model with small set of most important predictors.  The function of this package with same name needs all variables to be numeric, hence we use birthwt dataset here:

Code:

> library(bestglm)
Loading required package: leaps
> library(MASS)
> bestglm(birthwt[-1]) # last column should be the outcome variable
# first column has 'low' variable which is from 'bwt' (outcome) variable
BIC
BICq equivalent for q in (0.36036143434253, 0.599907163733692)
Best Model:
             Estimate Std. Error   t value     Pr(>|t|)
(Intercept) 3600.1657  132.24504 27.223447 1.948525e-66
race        -210.7681   55.76493 -3.779581 2.121011e-04
smoke       -389.3848  104.68153 -3.719709 2.647388e-04
ht          -497.1166  197.63849 -2.515282 1.274997e-02
ui          -555.9427  136.29792 -4.078879 6.732273e-05
BIC
BICq equivalent for q in (0.0335857071703994, 0.61036496455489)
Best Model:
              Estimate Std. Error    t value      Pr(>|t|)
(Intercept)  3363.4380   39.84413  84.414889 3.035098e-150
low         -1190.4560   70.10930 -16.980000  1.156766e-39
ui           -318.7814   91.44951  -3.485874  6.118925e-04


References:
A.I. McLeod and Changjiang Xu (2014). bestglm: Best Subset GLM. R package version 0.34.
http://CRAN.R-project.org/package=bestglm
 


    Comments & Feedback