knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>",
  fig.path = "man/figures/README-",
  out.width = "100%"
)

rai

Overview

rai provides a modified implementation of stepwise regression that greedily searches the space of interactions among features in order to build polynomial regression models. Furthermore, the hypothesis tests conducted are valid post model selection due to the use of a revisiting procedure that implements an alpha-investing rule. As a result, the set of rejected sequential hypotheses is proven to control the marginal false discover rate. When not searching for polynomials, the package provides a statistically valid algorithm to run and terminate stepwise regression.

For more information, see the corresponding paper: Revisiting Alpha-Investing: Conditionally Valid Stepwise Regression.

Installation

You can install the released version of rai from CRAN with:

install.packages("rai")

And the development version from GitHub with:

# install.packages("devtools")
devtools::install_github("korydjohnson/rai")

Usage

library(rai)
data("CO2")
theResponse = CO2$uptake
theData = CO2[ ,-5]
rai_out = rai(theData, theResponse)

The returned object includes a linear model object of the identified model:

summary(rai_out$model)

You can view a summary of the series of tests conducted by rai and the results of those tests by calling summary on the returned object:

summary(rai_out)

Necessary functions are provided to use rai within a caret workflow:

# fitControl <- caret::trainControl(method = "repeatedcv",
#                            number = 5, ## 5-fold CV...
#                            repeats = 5)  ## repeated 5 times
# caret::train(x=theData, y=theResponse, method=rai_caret, trControl = fitControl)


korydjohnson/rai documentation built on April 21, 2022, 2:59 p.m.