R language Access Menu

Title Text Both  

RegBest of FactoMineR package

This is another function that can be used to find best set of predictors. However, both the dependent and predictor variable need to be numeric and continuous for this, hence we will use original birthwt dataset of MASS package for this: 

Code:

> library(MASS)
> library(FactoMineR)
> mydata = birthwt[-1] # first column is 'low' column which only reflects 'bwt' column
> RegBest(mydata[,9], mydata[,-9])$best

Call:
lm(formula = as.formula(as.character(formul)), data = don)

Residuals:
     Min       1Q   Median       3Q      Max 
-1818.56  -454.51    -2.53   475.70  1651.06 

Coefficients:
            Estimate Std. Error t value             Pr(>|t|)    
(Intercept) 3104.438    271.624  11.429 < 0.0000000000000002 ***
lwt            3.434      1.648   2.084             0.038581 *  
race        -187.849     56.349  -3.334             0.001037 ** 
smoke       -366.135    104.342  -3.509             0.000566 ***
ht          -595.820    201.515  -2.957             0.003519 ** 
ui          -523.419    135.976  -3.849             0.000164 ***
---
Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1

Residual standard error: 652.2 on 183 degrees of freedom
Multiple R-squared:  0.2214,    Adjusted R-squared:  0.2001 
F-statistic:  10.4 on 5 and 183 DF,  p-value: 0.000000008451

References: 
Francois Husson, Julie Josse, Sebastien Le and Jeremy Mazet (2014). FactoMineR: Multivariate Exploratory Data Analysis and Data Mining with R. R package version 1.27. http://CRAN.R-project.org/package=FactoMineR
 


    Comments & Feedback