ramsey_reset_test: Run a Ramsey's Regression Equation Specification Error Test...

View source: R/linreg-linearity.R

ramsey_reset_testR Documentation

Run a Ramsey's Regression Equation Specification Error Test (RESET)

Description

A wrapper around lmtest::resettest() that standardizes the inputs and outputs.

Usage

ramsey_reset_test(object, power = 2:3, ..., .alpha = 0.05)

## S3 method for class 'lm'
ramsey_reset_test(object, power = 2:3, ..., .alpha = 0.05)

## S3 method for class ''_lm''
ramsey_reset_test(object, power = 2:3, ..., .alpha = 0.05)

## S3 method for class ''_glm''
ramsey_reset_test(object, power = 2:3, ..., .alpha = 0.05)

Arguments

object

A model object (such as a fitted lm object).

power

(Optional) A vector of positive integers indicating the powers of the variables that should be included. The default is 2:3, meaning quadratic or cubic influence of the fitted response.

...

Further arguments passed to lmtest::resettest().

.alpha

(Optional) Critical p-value used to determine test conclusion. The default is 0.05 (5%).

Details

The hypotheses for this test are:

  • Null: Linear Specification is Valid

  • Alternative: Linear Specification is Not Valid

Value

A tibble with columns test, statistic, p_value, result, outcome, and .notes with extra information.

See Also

Other linearity tests: harvey_collier_test()

Examples

library(tidytest)

#> `lm` Method
mod_lm_fit <- lm(mpg ~ disp + wt + hp, data = mtcars)

ramsey_reset_test(mod_lm_fit)

#> `linear_reg` Method
library(parsnip)

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

ramsey_reset_test(mod_linreg_fit)

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