Skip to content
/ stepwise Public
forked from jkovacic/stepwise

Stepwise methods for selection of "best" fitting linear models

License

Notifications You must be signed in to change notification settings

guhjy/stepwise

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

41 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

About

A simple R library for stepwise selection of the "best" linear model, depending on the selected criterion, such as adjusted R2, AIC, BIC, Mallows' Cp or p-values.

Supported methods

  • forward selection, based on adjusted R2 (function stepwise.fwd.adjR2)
  • backwards elimination, based on adjusted R2 (function stepwise.bck.adjR2)
  • forward selection, based on Mallows' Cp (function stepwise.fwd.mallowsCp)
  • backwards elimination, based on Mallows' Cp (function stepwise.bck.mallowsCp)
  • forward selection, based on Aikake's Information Criterion (function stepwise.fwd.aic)
  • backwards elimination, based on Aikake's Information Criterion (function stepwise.bck.aic)
  • forward selection, based on Bayesian Information Criterion (function stepwise.fwd.bic)
  • backwards elimination, based on Bayesian Information Criterion (function stepwise.bck.bic)
  • forward selection, based on significance of coefficients' p-values (function stepwise.fwd.pval)
  • backwards elimination, based on significance of coefficients' p-values (function stepwise.bck.pval)

Usage

Just call the command source('stepwise.R') and then call any function mentioned in the previous section. For more info, see "documentation" comments in headers of those functions.

Alternatively see the file test.R that performs basic unit tests.

About data frames

The functions do not (pre)process provided data frames in any way. In other words, the data frame must be preprocessed beforehand if required. This includes all desired transformations of variables, columns with factor variables must be provided as vectors of strings, additional columns (such as powers, interactions, etc.) must be added. It is also strongly recommended that undesired variables are removed from the data frame.

License

All files are are licensed under the Apache 2.0 license.

Author

The author of the library is Jernej Kovačič.

About

Stepwise methods for selection of "best" fitting linear models

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • R 100.0%