StepReg
:exclamation: This is a read-only mirror of the CRAN R package repository. StepReg — Stepwise Regression Analysis Report bugs for this package: https://github.com/JunhuiLi1017/StepReg/issues
Install / Use
/learn @cran/StepRegREADME
StepReg <a href="https://github.com/JunhuiLi1017/StepReg"><img src="man/figures/logo.png" align="right" height="138" /></a>
-
An R package for stepwise regression analysis
StepReg is an R package that streamlines stepwise regression analysis by supporting multiple regression types, incorporating popular selection strategies, and offering essential metrics.
Key Features
- Multiple Regression Types: Linear, logistic, Cox, Poisson, Gamma, and negative binomial regression
- Selection Strategies: Forward selection, backward elimination, bidirectional elimination, and best subsets
- Selection Metrics: AIC, AICc, BIC, CP, HQ, adjRsq, SL, SBC, IC(3/2), IC(1)
- Advanced Features:
- Strata variables for Cox regression
- Continuous-nested-within-class effects
- multivariable multiple linear stepwise regression
- Multicollinearity Detection: Automatic detection and handling of multicollinearity
- Visualization: Plot functions for variable selection processes
- Reporting: Export results in various formats (HTML, DOCX, XLSX, PPTX)
- Shiny App: Interactive web interface for non-programmers
Installation
Install from CRAN
pak::pkg_install("StepReg")
or
install.packages("StepReg")
Or install from GitHub
devtools::install_github("JunhuiLi1017/StepReg")
Quick Start
library(StepReg)
# Basic linear regression
data(mtcars)
formula <- mpg ~ .
res <- stepwise(
formula = formula,
data = mtcars,
type = "linear",
strategy = "bidirection",
metric = "AIC"
)
# View results
res
summary(res$bidirection$AIC)
Advanced Features
Strata Variables in Cox Regression
library(survival)
data(lung)
lung$sex <- factor(lung$sex)
# Cox regression with strata
formula <- Surv(time, status) ~ age + sex + ph.ecog + strata(inst)
res <- stepwise(
formula = formula,
data = lung,
type = "cox",
strategy = "forward",
metric = "AIC"
)
Continuous-Nested-Within-Class Effects
data(mtcars)
mtcars$am <- factor(mtcars$am)
# Nested effects
formula <- mpg ~ am + wt:am + disp:am + hp:am
res <- stepwise(
formula = formula,
data = mtcars,
type = "linear",
strategy = "bidirection",
metric = "AIC"
)
Documentation
- Vignette - Comprehensive guide with examples
- Reference Manual - Function documentation
Shiny Application
- StepReg - StepReg Shiny Appliction
Important Note
StepReg should NOT be used for statistical inference unless the variable selection process is explicitly accounted for, as it can compromise the validity of the results. This limitation does not apply when StepReg is used for prediction purposes.
Citation
If you use StepReg in your research, please cite:
citation("StepReg")
Questions?
Please raise an issue here.
Related Skills
node-connect
343.3kDiagnose OpenClaw node connection and pairing failures for Android, iOS, and macOS companion apps
frontend-design
92.1kCreate distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.
openai-whisper-api
343.3kTranscribe audio via OpenAI Audio Transcriptions API (Whisper).
qqbot-media
343.3kQQBot 富媒体收发能力。使用 <qqmedia> 标签,系统根据文件扩展名自动识别类型(图片/语音/视频/文件)。
