gofcat
gofcat: An R package for goodness-of-fit of categorical response models - Published in JOSS (2022)
Science Score: 93.0%
This score indicates how likely this project is to be science-related based on various indicators:
-
○CITATION.cff file
-
✓codemeta.json file
Found codemeta.json file -
✓.zenodo.json file
Found .zenodo.json file -
✓DOI references
Found 3 DOI reference(s) in README and JOSS metadata -
○Academic publication links
-
○Committers with academic emails
-
○Institutional organization owner
-
✓JOSS paper metadata
Published in Journal of Open Source Software
Keywords
brant-test
brier-scores
hosmer-lemeshow-test
likelihood-ratio-test
lipsitz-test
log-loss-score-metric
logistic-regression
misclassification
ordinal-regression
proportional-odds-test
pseudo-r2
pulkstenis-robinson-test
Scientific Fields
Earth and Environmental Sciences
Physical Sciences -
40% confidence
Last synced: 4 months ago
·
JSON representation
Repository
Goodness-of-fit tests for categorical response models
Basic Info
- Host: GitHub
- Owner: ejikeugba
- License: gpl-2.0
- Language: R
- Default Branch: main
- Homepage: https://ejikeugba.github.io/gofcat/
- Size: 315 KB
Statistics
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 0
- Releases: 3
Topics
brant-test
brier-scores
hosmer-lemeshow-test
likelihood-ratio-test
lipsitz-test
log-loss-score-metric
logistic-regression
misclassification
ordinal-regression
proportional-odds-test
pseudo-r2
pulkstenis-robinson-test
Created about 4 years ago
· Last pushed almost 3 years ago
Metadata Files
Readme
Changelog
Contributing
License
Code of conduct
README.Rmd
---
output: github_document
---
```{r setup, include = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>",
message = FALSE,
warning = FALSE,
out.width = "100%"
)
```
# gofcat
[](https://www.repostatus.org/#active)
[](https://app.codecov.io/gh/ejikeugba/gofcat?branch=main)
[](https://CRAN.R-project.org/package=gofcat)
[](https://CRAN.R-project.org/package=gofcat)
[](https://www.gnu.org/licenses/gpl-2.0.en.html)
[](https://ci.appveyor.com/project/ejikeugba/gofcat)
[](https://github.com/ejikeugba/gofcat/actions)
### Overview
Crucial post-estimation (goodness-of-fit) tests for some widely used categorical response models (CRM) are implemented in this package. It currently supports inputs from objects of class serp(), clm(), polr(), multinom(), mlogit(), vglm() and glm(). Available tests include the Hosmer-Lemeshow tests for the binary, multinomial and ordinal logistic regression; the Lipsitz and the Pulkstenis-Robinson tests for the ordinal models. The proportional odds, adjacent-category, and constrained continuation-ratio models are particularly supported at ordinal level. Tests for the proportional odds assumptions in ordinal models are also possible with the Brant and the Likelihood-Ratio tests. Moreover, several summary measures of predictive strength (Pseudo R-squared), and some useful error metrics, including, the brier score, misclassification rate and logloss are also available for the binary, multinomial and ordinal models.
### Example
``` r
require(serp)
set.seed(1)
n <- 200
dt <- data.frame(y = ordered(rbinom(n,2,0.5)), x1 = factor(rbinom(n,2,0.7)), x2 = runif(n))
sp <- serp(y ~ x1 + x2, slope="parallel", link = "logit", reverse= TRUE, data = dt)
```
``` r
## Goodness-of-fit
# Hosmer-Lemeshow test
hosmerlem(sp, tables = TRUE)
hosmerlem(sp, tables = TRUE, customFreq = rep(20,10))
# Lipsitz test
lipsitz(sp)
lipsitz(sp, customFreq = rep(20, 10))
# Pulkstenis-Robinson test
pulkroben(sp, test = "chisq", tables = TRUE)
pulkroben(sp, test = "deviance", tables = TRUE)
```
``` r
## Proportional odds test
brant.test(sp)
brant.test(sp, global = TRUE, call = TRUE)
LR.test(sp, call = TRUE)
```
``` r
## Error metrics
erroR(sp, type = "brier")
erroR(sp, type = "logloss")
erroR(sp, type = "misclass")
# with dataframe and custom threshold
df <- data.frame(y, sp$fitted.values)
erroR(df, type = "misclass", thresh = 0.7)
```
``` r
## Summary metrics
Rsquared(sp, measure = "ugba")
Rsquared(sp, measure = "mcfadden")
```
### Installation and Use
Before installing `gofcat`, it is encouraged to have a recent version of [R](https://cran.r-project.org/bin/windows/base/) installed. The released version of `gofcat` can be installed from [CRAN](https://cran.r-project.org/package=gofcat) with:
``` r
install.packages("gofcat")
```
or the development version from [GitHub](https://github.com/ejikeugba/gofcat) with:
``` r
if (!require("devtools")) install.packages("devtools")
devtools::install_github("ejikeugba/gofcat")
```
Load `gofcat` into R environment with:
```{r, eval = FALSE}
library(gofcat)
```
### Community Guidelines
Pull requests are welcomed! Please submit your contributions to `gofcat`
through the list of `Pull Requests`, following the [contributing
guidelines](https://github.com/ejikeugba/gofcat/blob/main/.github/contributing.md). To
report issues and/or seek support, please file a new ticket in the
[issue](https://github.com/ejikeugba/gofcat/issues) tracker, and expect
a feedback ASAP!
### Code of Conduct
Please note that `gofcat` is released with a [Contributor Code of
Conduct](https://github.com/ejikeugba/gofcat/blob/main/CODE_OF_CONDUCT.md).
By contributing to this project, you agree to abide by its terms.
### References
Fagerland, M. W. and Hosmer, D. W. (2017). How to test for goodness of fit
in ordinal logistic regression models. *Stata Journal*, 17, 668-686.
Ugba, E. R. and Gertheiss, J. (2018). An Augmented Likelihood Ratio Index
for Categorical Response Models. In *Proceedings of 33rd International Workshop on Statistical Modelling*, Bristol, 293-298.
Ugba, E. R. (2021). serp: An R package for smoothing in ordinal
regression *Journal of Open Source Software*, 6(66), 3705.
Owner
- Name: Ejike
- Login: ejikeugba
- Kind: user
- Location: Germany
- Company: Helmut Schmidt University, Hamburg
- Website: https://ejikeugba.github.io/DataXotic/
- Twitter: richyejk
- Repositories: 5
- Profile: https://github.com/ejikeugba
Data scientist with many years of experience in ML, data analytics, and software development in R/Python.
JOSS Publication
gofcat: An R package for goodness-of-fit of categorical response models
Published
August 23, 2022
Volume 7, Issue 76, Page 4382
Authors
Tags
proportional odds test brant test hosmer lemeshow test pulkstenis robinson test lipsitz test logistic regression ordinal regressionGitHub Events
Total
Last Year
Issues and Pull Requests
Last synced: 4 months ago
All Time
- Total issues: 2
- Total pull requests: 1
- Average time to close issues: 10 days
- Average time to close pull requests: about 1 hour
- Total issue authors: 1
- Total pull request authors: 1
- Average comments per issue: 1.5
- Average comments per pull request: 1.0
- Merged pull requests: 0
- Bot issues: 0
- Bot pull requests: 0
Past Year
- Issues: 0
- Pull requests: 0
- Average time to close issues: N/A
- Average time to close pull requests: N/A
- Issue authors: 0
- Pull request authors: 0
- Average comments per issue: 0
- Average comments per pull request: 0
- Merged pull requests: 0
- Bot issues: 0
- Bot pull requests: 0
Top Authors
Issue Authors
- NRaillard (2)
Pull Request Authors
- ejikeugba (1)
Top Labels
Issue Labels
Pull Request Labels
Dependencies
DESCRIPTION
cran
- R >= 3.2.0 depends
- Matrix * imports
- VGAM >= 1.1 imports
- crayon * imports
- epiR * imports
- reshape * imports
- stats * imports
- stringr * imports
- utils * imports
- MASS * suggests
- covr * suggests
- dfidx * suggests
- mlogit * suggests
- nnet * suggests
- ordinal * suggests
- serp * suggests
- testthat * suggests
.github/workflows/R-CMD-check.yaml
actions
- actions/checkout v2 composite
- actions/upload-artifact main composite
- r-lib/actions/check-r-package v1 composite
- r-lib/actions/setup-pandoc v1 composite
- r-lib/actions/setup-r v1 composite
- r-lib/actions/setup-r-dependencies v1 composite
.github/workflows/pkgdown.yaml
actions
- actions/checkout v2 composite
- r-lib/actions/setup-pandoc v1 composite
- r-lib/actions/setup-r v1 composite
- r-lib/actions/setup-r-dependencies v1 composite
