https://github.com/shixiangwang/regport
Regression Model Processing Port
https://github.com/shixiangwang/regport
batch-processing r-package regression-models rstats
Last synced: 8 months ago
JSON representation
Regression Model Processing Port
- Host: GitHub
- URL: https://github.com/shixiangwang/regport
- Owner: ShixiangWang
- License: other
- Created: 2022-03-24T11:13:20.000Z (about 4 years ago)
- Default Branch: main
- Last Pushed: 2025-08-18T01:52:11.000Z (10 months ago)
- Last Synced: 2025-09-21T16:59:53.524Z (8 months ago)
- Topics: batch-processing, r-package, regression-models, rstats
- Language: R
- Homepage: https://shixiangwang.github.io/regport/
- Size: 1.09 MB
- Stars: 6
- Watchers: 1
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.Rmd
- License: LICENSE
Awesome Lists containing this project
README
---
output: github_document
---
```{r, include = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>",
fig.path = "man/figures/README-",
out.width = "100%"
)
```
# regport
[](https://cran.r-project.org/package=regport)
[](https://lifecycle.r-lib.org/articles/stages.html)
[](https://github.com/ShixiangWang/regport/actions)
[](https://cran.r-project.org/package=regport)
The goal of regport is to provides R6 classes, methods and utilities to construct,
analyze, summarize, and visualize regression models (CoxPH and GLMs).
> This package is been superseded by [bregr](https://cran.r-project.org/package=bregr).
## Installation
You can install the development version of regport like so:
```r
remotes::install_github("ShixiangWang/regport")
```
## Simple case
This is a basic example which shows you how to build and visualize a Cox model.
Prepare data:
```{r}
library(regport)
library(survival)
lung = survival::lung
lung$sex = factor(lung$sex)
```
Create a model:
```{r}
model = REGModel$new(
lung,
recipe = list(
x = c("age", "sex"),
y = c("time", "status")
)
)
model
```
You can also create it with formula:
```{r}
model = REGModel$new(
lung,
recipe = Surv(time, status) ~ age + sex
)
model
```
Take a look at the model result (package `see` is required):
```{r, fig.width=4, fig.width=6}
model$plot()
```
Visualize with more nice forest plot.
```{r dpi=300}
model$get_forest_data()
model$plot_forest()
```
## Batch processing models
For building a list of regression model, unlike above, a lazy building approach
is used, i.e., `$build()` must manually typed after creating `REGModelList` object.
(This also means you can check or modify the setting before building if necessary)
```{r dpi=300}
ml <- REGModelList$new(
data = mtcars,
y = "mpg",
x = c("factor(cyl)", colnames(mtcars)[3:5]),
covars = c(colnames(mtcars)[8:9], "factor(gear)")
)
ml
ml$build(f = "gaussian")
str(ml$result)
str(ml$forest_data)
ml$plot_forest(ref_line = 0, xlim = c(-15, 8))
```
## Coverage
```{r}
covr::package_coverage()
```
## LICENSE
(MIT) Copyright (c) 2022 Shixiang Wang