StepReg

StepReg — Stepwise Regression Analysis

Version: v1.4.4

StepReg logo

1. Introduction

2. Statistical and coding details in this package

3. Usage and Examples

#install.package("StepReg")

library(StepReg)

## stepwise linear regression

# remove intercept and add new variable yes which is the same as variable wt in mtcars dataset

data(mtcars)
mtcars$yes <- mtcars$wt
formula <- cbind(mpg,drat) ~ . + 0
stepwise(formula=formula,
         data=mtcars,
         include=NULL,
         selection="bidirection",
         select="AIC",
         sle=0.15,
         sls=0.15,
         multivarStat="Pillai",
         weights=NULL,
         best=NULL)

## stepwsise logistic regression

formula=vs ~ .
stepwiseLogit(formula,
              data=mtcars,
              include=NULL,
              selection="bidirection",
              select="SL",
              sle=0.15,
              sls=0.15,
              sigMethod="Rao",
              weights=NULL,
              best=NULL)
                            
## stepwise cox regression
lung <- survival::lung
my.data <- na.omit(lung)
my.data$status1 <- ifelse(my.data$status==2,1,0)
data <- my.data
formula = Surv(time, status1) ~ . - status

stepwiseCox(formula,
data,
include=NULL,
selection=c("bidirection"),
select="SL",
method=c("efron"),
sle=0.15,
sls=0.15,
weights=NULL,
best=NULL)

4.Validation

Result of multivariate stepwise regression are consistent with the reference * SAS software validation

The final results from this package are validated with SAS software,

data set1 without class effect: 13 dependent variable, 129 independent variable and 216 samples.

data set2 with 4 class effect: 12 dependent variable, 1270 independent variable and 647 samples.

data set3 with 6 class effect: 5 dependent variable, 2068 independent variable and 412 samples.