Title: | Outlier Robust Specification Testing |
---|---|
Description: | Robust test(s) for model diagnostics in regression. The current version contains a robust test for functional specification (linearity). The test is based on the robust bounded-influence test by Heritier and Ronchetti (1994) <doi:10.1080/01621459.1994.10476822>. |
Authors: | Mikhail Zhelonkin [aut, cre] |
Maintainer: | Mikhail Zhelonkin <[email protected]> |
License: | GPL-2 |
Version: | 0.1 |
Built: | 2024-12-01 08:01:53 UTC |
Source: | CRAN |
The package contains an outlier robust functional miss-specification test.
Package: | lmtestrob |
Type: | Package |
Version: | 0.1 |
Date: | 2023-05-22 |
License: | GPL-2 |
Mikhail Zhelonkin (aut, cre).
Maintainer: Mikhail Zhelonkin <[email protected]>
Heritier, S., and Ronchetti, E. (1994) Robust Bounded-Influence Tests in General Parametric Models. Journal of the American Statistical Association, 89, p. 897-904.
Zeileis, A., and Hothorn, T. (2002) Diagnostic Checking in Regression Relationships. R News, 2, p. 7-10.
robfmtest
Object
Print an object generated by robfmtest
## S3 method for class 'robfmtest' print(x, digits = 4, ...)
## S3 method for class 'robfmtest' print(x, digits = 4, ...)
x |
object returned from the |
digits |
number of significant digits to be printed. |
... |
currently not used. |
No return value.
Mikhail Zhelonkin
Outlier robust test for functional miss-specification. It can be used to test linearity. The test is based on the robust Wald-type test by Heritier and Ronchetti (1994).
robfmtest(formula, power = 2:3, type = c("regressor"), data, x.weights = c("HAT", "MCD"), testtype = "Wald", ...)
robfmtest(formula, power = 2:3, type = c("regressor"), data, x.weights = c("HAT", "MCD"), testtype = "Wald", ...)
formula |
a symbolic description of the model to be tested. |
power |
integer(s). A vector of positive integers specifying the powers of the variables that should be tested. The default option tests second and third powers. |
type |
currently, only powers of regressors can be used. |
data |
an optional data frame containing the variables in the model. If not found in data, the variables are taken from |
x.weights |
a string, indicating how the robustness weights on the covariates should be computed. The default option uses hat-matrix-based weights, second option allows to use robust Mahalanobis distance-based weights, where the Minimum Covariance Determinant is used to estimate location and scatter. |
testtype |
currently, the robust version of Wald test is implemented. |
... |
currently not used. |
Since the classical tests including resettest, raintest and harvtest implemented in lmtest are not resistant to outliers and can become misleading even in the presence of one outlier, we provide a test which is resistant to outliers. The price to pay for robustness is a small loss of power, when the model holds exactly.
A list with class robfmtest containing the following components:
statistic |
the value of the test statistic. |
dof |
the number of degrees of freedom. |
method |
a character string indicating what type of test was performed. |
p.value |
the p-value of the test. |
data.name |
a character string giving the name(s) of the data. |
Mikhail Zhelonkin
Heritier, S., and Ronchetti, E. (1994) Robust Bounded-Influence Tests in General Parametric Models. Journal of the American Statistical Association, 89, p. 897-904.
set.seed(123) n <- 50 x = runif(n, -3, 3) y = rnorm(n) example.dat <- data.frame(x, y) robfmtest(y ~ x, data = example.dat) library(lmtest) resettest(y ~ x, data = example.dat, type = "fitted") x[50] <- -3 y[50] <- -10 example.dat <- data.frame(x, y) robfmtest(y ~ x, data = example.dat) resettest(y ~ x, data = example.dat, type = "fitted")
set.seed(123) n <- 50 x = runif(n, -3, 3) y = rnorm(n) example.dat <- data.frame(x, y) robfmtest(y ~ x, data = example.dat) library(lmtest) resettest(y ~ x, data = example.dat, type = "fitted") x[50] <- -3 y[50] <- -10 example.dat <- data.frame(x, y) robfmtest(y ~ x, data = example.dat) resettest(y ~ x, data = example.dat, type = "fitted")