Anova function for quantile regression fits
Compute test statistics for two or more quantile regression fits.
## S3 method for class 'rq' anova(object, ..., test = "Wald", joint = TRUE, score = "tau", se = "nid", iid = TRUE, R = 200, trim = NULL) ## S3 method for class 'rqs' anova(object, ..., se = "nid", iid = TRUE, joint = TRUE) ## S3 method for class 'rqlist' anova(object, ..., test = "Wald", joint = TRUE, score = "tau", se = "nid", iid = TRUE, R = 200, trim = NULL) rq.test.rank(x0, x1, y, v = NULL, score = "wilcoxon", weights = NULL, tau=.5, iid = TRUE, delta0 = rep(0,NCOL(x1)), omega = 1, trim = NULL, pvalue = "F") rq.test.anowar(x0,x1,y,tau,R) ## S3 method for class 'anova.rq' print(x, ...)
object, ... |
objects of class ‘rq’, originating from a call to ‘rq’. or a single object of class rqs, originating from a call to 'rq' with multiple taus specified. |
test |
A character string specifying the test statistic to use. Can be either ‘Wald’ or ‘rank’. |
joint |
A logical flag indicating whether tests of equality of slopes should be done as joint tests on all slope parameters, or whether (when joint = FALSE) separate tests on each of the slope parameters should be reported. This option applies only to the tests of equality of slopes in the case that estimated models correspond to distinct taus. |
score |
A character string specifying the score function to use, only needed or applicable for the ‘rank’ form of the test. |
trim |
optional trimming proportion parameter(s) – only applicable for the
Wilcoxon score function – when one value is provided there is symmetric
trimming of the score integral to the interval |
x |
objects of class ‘summary.rq’, originating from a call to ‘summary’. |
x0 |
design matrix for the null component of the rank and anowar tests. |
x1 |
design matrix for the alternative component of the rank and anowar tests. |
y |
response vector for the alternative component of the rank and anowar tests. |
v |
optional rq process fit |
se |
method for computing standard errors, either "nid" or "ker", note that "boot" cannot be used for testing homogeneity of slopes. |
tau |
quantile of interest for quantile specific forms of testing. |
iid |
logical flag for quantile specific forms of testing, if TRUE the test presumes that the conditional densities take identical values, if it is FALSE then local densities are estimated and used, see Koenker(2005) p. 90. |
delta0 |
vector of hypothetical parameter values under test, typically zeros but can be specified to be nonzero in cases where simulations are being used to evaluate the validity of the non-central chisquare theory of the test. |
omega |
value to be used for the score and F dependent constant appearing in the non-centrality parameter, this is only needed/useful when delta0 is specified to be non-zero. In the usual Wilcoxon (untrimmed) case this value is the integral the squared density. |
pvalue |
type of p-value to be used, by default a pseudo F-statistic is produced and the corresponding F p-value is computed, otherwise the more conventional chisquared p-values are reported. |
weights |
optional weight vector to be used for fitting. |
R |
The number of resampling replications for the anowar form of the test, used to estimate the reference distribution for the test statistic. |
There are two (as yet) distinct forms of the test. In the first the fitted objects all have the same specified quantile (tau) and the intent is to test the hypothesis that smaller models are adequate relative to the largest specified model. In the second form of the test the linear predictor of the fits are all the same, but the specified quantiles (taus) are different.
In the former case there are three options for
the argument ‘test’, by default a Wald test is computed as in
Bassett and Koenker (1982). If test = 'anowar'
is specified
then the test is based on the procedure suggested in Chen, Ying, Zhang
and Zhao (2008); the test is based on the difference in the QR objective
functions at the restricted and unrestricted models with a reference
distribution computed by simulation. The p-value of this form of the
test is produced by fitting a density to the simulation values forming
the reference distribution using the logspline
function from
the logspline package. The acronym anowar stands for analysis
of weighted absolute residuals. If test='rank'
is specified, then a rank
test statistic is computed as described in Gutenbrunner, Jureckova,
Koenker and Portnoy (1993). In the latter case one can also specify
a form for the score function of the rank test, by default the Wilcoxon
score is used, the other options are score=‘sign’ for median (sign) scores,
or score=‘normal’ for normal (van der Waerden) scores. A fourth option
is score=‘tau’ which is a generalization of median scores to an arbitrary
quantile, in this case the quantile is assumed to be the one associated
with the fitting of the specified objects. The computing of
the rank form of the test is carried out in the rq.test.rank
function, see ranks
for further details on the score function
options. The Wald form of the test is local in sense that the null hypothesis
asserts only that a subset of the covariates are “insignificant” at
the specified quantile of interest. The rank form of the test can also be
used to test the global hypothesis that a subset is “insignificant”
over an entire range of quantiles. The use of the score function
score = "tau" restricts the rank test to the local hypothesis of
the Wald test.
In the latter case the hypothesis of interest is that the slope coefficients of the models are identical. The test statistic is a variant of the Wald test described in Koenker and Bassett (1982).
By default, both forms of the tests return an F-like statistic in the sense that the an asymptotically Chi-squared statistic is divided by its degrees of freedom and the reported p-value is computed for an F statistic based on the numerator degrees of freedom equal to the rank of the null hypothesis and the denominator degrees of freedom is taken to be the sample size minus the number of parameters of the maintained model.
An object of class ‘"anova"’ inheriting from class ‘"data.frame"’.
An attempt to verify that the models are nested in the first form of the test is made, but this relies on checking set inclusion of the list of variable names and is subject to obvious ambiguities when variable names are generic. The comparison between two or more models will only be valid if they are fitted to the same dataset. This may be a problem if there are missing values and R's default of ‘na.action = na.omit’ is used. The rank version of the nested model tests involves computing the entire regression quantile process using parametric linear programming and thus can be rather slow and memory intensive on problems with more than several thousand observations.
Roger Koenker
[1] Bassett, G. and R. Koenker (1982). Tests of Linear Hypotheses and L1 Estimation, Econometrica, 50, 1577–83.
[2] Koenker, R. W. and Bassett, G. W. (1982). Robust Tests for Heteroscedasticity based on Regression Quantiles, Econometrica, 50, 43–61.
[3] Gutenbrunner, C., Jureckova, J., Koenker, R, and S. Portnoy (1993). Tests of Linear Hypotheses based on Regression Rank Scores, J. of Nonparametric Statistics, 2, 307–331.
[4] Chen, K. Z. Ying, H. Zhang, and L Zhao, (2008) Analysis of least absolute deviations, Biometrika, 95, 107-122.
[5] Koenker, R. W. (2005). Quantile Regression, Cambridge U. Press.
The model fitting function rq
,
and the functions for testing hypothesis on the entire quantile
regression process KhmaladzeTest
. For further details
on the rank tests see ranks
.
data(barro) fit0 <- rq(y.net ~ lgdp2 + fse2 + gedy2 , data = barro) fit1 <- rq(y.net ~ lgdp2 + fse2 + gedy2 + Iy2 + gcony2, data = barro) fit2 <- rq(y.net ~ lgdp2 + fse2 + gedy2 + Iy2 + gcony2, data = barro,tau=.75) fit3 <- rq(y.net ~ lgdp2 + fse2 + gedy2 + Iy2 + gcony2, data = barro,tau=.25) anova(fit1,fit0) anova(fit1,fit2,fit3) anova(fit1,fit2,fit3,joint=FALSE) # Alternatively fitting can be done in one call: fit <- rq(y.net ~ lgdp2 + fse2 + gedy2 + Iy2 + gcony2, method = "fn", tau = 1:4/5, data = barro)
Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.