Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

bgreenwell/sure

Open more actions menu

Repository files navigation

sure: Surrogate Residuals

r-universe status R-CMD-check codecov

Overview

An R package for constructing SUrrogate-based REsiduals and diagnostics for ordinal and general regression models; based on the approach described in Dungang and Zhang (2017).

Installation

sure is no longer available on CRAN due to CRAN's stringent and ever-changing policies. It is now hosted on r-universe, which provides a reliable alternative for distributing R packages.

# Install from r-universe (recommended):
install.packages("sure", repos = c("https://bgreenwell.r-universe.dev", "https://cloud.r-project.org"))

# Install the latest development version from GitHub:
if (!requireNamespace("pak")) {
  install.packages("pak")
}
pak::pak("bgreenwell/sure")

Quick start

library(sure)

# Simulate an ordinal response with a quadratic true relationship
set.seed(101)
df <- sim_data(n = 500, type = "quadratic")

# Fit a (misspecified) proportional odds model
fit <- MASS::polr(y ~ x, data = df)

# Compute surrogate-based residuals and plot the diagnostics
res <- resids(fit)
plot(res, what = "covariate", covariate = df$x, xlab = "x")

References

Liu, D. and Zhang, H. Residuals and Diagnostics for Ordinal Regression Models: A Surrogate Approach. Journal of the American Statistical Association (accepted). URL http://www.tandfonline.com/doi/abs/10.1080/01621459.2017.1292915?journalCode=uasa20

Greenwell, B.M., McCarthy, A.J., Boehmke, B.C. & Dungang, L. (2018) “Residuals and diagnostics for binary and ordinal regression models: An introduction to the sure package.” The R Journal (pre-print). URL https://journal.r-project.org/archive/2018/RJ-2018-004/index.html

About

Surrogate residuals for cumulative link and general regression models in R

Topics

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages

Morty Proxy This is a proxified and sanitized view of the page, visit original site.