Skip to content

broom methods for heteroscedasticity diagnostics

Source: man/tidy.hetero_test.Rd ยท Help: ?tidy.hetero_test

Tidy, glance and augment methods integrating heteroscedasticity diagnostics with the broom generics from the generics package.

Usage

## S3 method for class 'hetero_test'
tidy(x, ...)
## S3 method for class 'hetero_test'
glance(x, ...)
## S3 method for class 'hetero_test'
augment(x, data = NULL, ...)
## S3 method for class 'hetero_test_suite'
tidy(x, ...)
## S3 method for class 'hetero_test_suite'
glance(x, ...)
## S3 method for class 'hetero_test_suite'
augment(x, data = NULL, ...)
## S3 method for class 'hetero_grouped_suite'
tidy(x, ...)

Arguments

x
Heteroscedasticity diagnostic result(s) returned by runHeteroTests.
data
Optional data frame used to augment diagnostics; defaults to the data embedded within the fitted model when available. The rows of data are matched to the observations of the fit as the tests match them, by row name in any order, or for data that only number their rows by the row numbers of the fit or in its order, and bound as broom binds them, in the order of data, each row with its own fitted value and residual: on a fit without na.action = na.exclude the rows the fit used, so the full data of a fit that dropped rows give those rows; on a fit with na.exclude those rows and the rows it dropped, with NA there, every row of its full data. Given the rows of its observations only, as its model frame without data, a fit with na.exclude binds them in the order of the fit with a row of NA at each row it dropped. Data whose rows cannot be shown to hold the observations are refused (see test_results). The data of a tidymodels workflow, or of a parsnip fit of fit_xy(), are mapped to the variables of its engine as runHeteroTests() maps them, and each mapped row is traced to the row of data it was made from: the data of a preprocessing that drops or adds rows of new data, such as step_filter() with skip = FALSE, or reorders them, such as step_arrange(), are refused, since it does not say which row of data each observation comes from, and so are those of a step that makes a row from other rows, such as step_mutate(cs = cumsum(x)), whose values 0.16.0 bound right in the order of the fit. Before 0.17.0 the rows were bound row by row: named data in another order than the fit had the values of other observations bound to them, and the full data of a fit with na.omit could not be bound.
...
Passed through for compatibility.

Value

A data frame summarising the diagnostic(s), or an augmented data set containing fitted values and residuals alongside the original predictors.

tidy returns one row per test. parameter is the first parameter of the test and parameter2 the second, for a test that has two (the denominator degrees of freedom of an F statistic, or the number of bootstrap replications); it is NA otherwise. estimate is given when the test reports exactly one estimate. Up to 0.12.0 a test with two parameters was returned as two rows.

See also

generics::tidy, generics::glance, generics::augment

Examples

if (requireNamespace("generics", quietly = TRUE)) {
  data(mtcars)
  fit <- lm(mpg ~ wt + qsec, data = mtcars)
  suite <- runHeteroTests(fit, mtcars, tests = c("white", "breusch_pagan"))
  generics::tidy(suite)
}