knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>",
  fig.path = "man/figures/README-",
  out.width = "100%"
)

tidytest

Lifecycle: experimental R-CMD-check Codecov test coverage

Overview

The goal of the tidytest package is to provide a tidy unified interface to common statistical tests, specifically those used when developing and validating statistical models.

Installation

You can install the development version of tidytest from GitHub with:

# install.packages("devtools")
devtools::install_github("RobbyLankford/tidytest")

Usage

The tidytest package is designed to be used with the tidymodels ecosystem, particularly the parsnip package. Currently, methods exist for the following parsnip models:

library(parsnip)
library(tidytest)

mod_fit <- linear_reg() %>%
  set_engine("lm") %>%
  fit(mpg ~ disp + wt + hp, data = mtcars)

Tests in the tidytest package are designed to require minimal input. For most tests, the model object is the only required input.

Linear Tests

Tests for linear regression often focus on the behavior of the residuals. The classic assumptions for a linear model are the "LINE" assumptions of the residuals, specifically:

Linearity

Currently, the implemented linearity tests are:

ramsey_reset(mod_fit)
harvey_collier_test(mod_fit)

Independence

Currently, the implemented independence tests are:

durbin_watson_test(mod_fit)
ljung_box_test(mod_fit)

Normality

Currently, the implemented normality tests are:

anderson_darling_test(mod_fit)
shapiro_wilk_test(mod_fit)

Equal Variance

Currently, the implemented equal variance (homoscedasticity) tests are:

bruesch_pagan_test(mod_fit)
goldfeld_quandt_test(mod_fit)


RobbyLankford/tidytest documentation built on Jan. 27, 2024, 7:36 a.m.