Rank-based permutation heteroscedasticity test¶
Source: R/modern_diagnostics.R ยท Help: ?performRankPermutationTest
Performs a non-parametric permutation test based on the rank correlation between absolute residuals and a chosen ordering variable. Significant correlations imply systematic changes in residual spread.
Usage¶
performRankPermutationTest(
model,
data = NULL,
order_by = NULL,
B = 999,
progress = interactive()
)
Arguments¶
model- A fitted stats::lm object describing the mean structure whose residual variance is to be assessed.
data- The data frame
modelwas fitted to, orNULL, the default. The response, design, weights and offset are read from the fit itself, so a model that transforms its variables, has anoffset()term, or takes itsweightsoroffsetfrom a column of the data needs nodata, and the model frame ofmodelis accepted asdata(since 0.16.0; before, such models neededdata), unlessorder_bynames a variable the model frame does not hold, which is then read fromdata. Data that are given are matched to the observations of the fit: rows with row names of their own by name, in any order; rows that only number themselves (a tibble, a data.table, a data frame whose row names were reset) by the row numbers of the fit, or in the order of the fit when they hold one row per observation and, whenorder_byis read fromdata, no two rows of the fit tie on every column of its model frame. The rows the fit dropped may be there or not. Data whose rows cannot be shown to hold the observations of the fit are refused; see test_results. order_by- Optional name of a predictor variable used to rank the observations. Defaults to the first non-intercept term in the model matrix.
B- Number of permutation replications used to approximate the null distribution. Defaults to 999, the default of every resampling test in the package.
progress- Logical toggle for progress reporting during permutations.
Value¶
An htest object containing the observed Spearman
correlation and a permutation-based p-value.
Supported models¶
It accepts an lm and a glm with the Gaussian family and the identity link,
unweighted or with positive weights, a fitWLS() fit and, since 0.16.0, a
rank-deficient fit, which it tests on the estimable part of its design: it gives
the value of the same model fitted without the aliased columns. It refuses a
glm of another family or link, a survey::svyglm() fit, a fit with a zero
weight, a coefficient that is not finite for another reason, and data that
lack rows or variables of the fit. Which model each test accepts, and why, is
set out in test_results, under Supported models.
References¶
Hollander, M., Wolfe, D. A., & Chicken, E. (2013). Nonparametric Statistical Methods (3rd ed.). Wiley.